[svn:parrot] r41708 - branches/pcc_reapply/src/call

allison at svn.parrot.org allison at svn.parrot.org
Sun Oct 4 18:53:36 UTC 2009


Author: allison
Date: Sun Oct  4 18:53:35 2009
New Revision: 41708
URL: https://trac.parrot.org/parrot/changeset/41708

Log:
[pcc] The :optional flag is marked on the named parameter itself, not on the
name string.

Modified:
   branches/pcc_reapply/src/call/args.c

Modified: branches/pcc_reapply/src/call/args.c
==============================================================================
--- branches/pcc_reapply/src/call/args.c	Sun Oct  4 18:51:16 2009	(r41707)
+++ branches/pcc_reapply/src/call/args.c	Sun Oct  4 18:53:35 2009	(r41708)
@@ -755,7 +755,6 @@
     arg_index = 0;
     param_index = 0;
     while (1) {
-        INTVAL optional_param = 0;
         INTVAL param_flags;
 
         /* Check if we've used up all the parameters. */
@@ -776,11 +775,6 @@
 
         param_flags = VTABLE_get_integer_keyed_int(interp, raw_sig, param_index);
 
-        /* If the parameter is optional, set a flag for error checking */
-        if (param_flags & PARROT_ARG_OPTIONAL) {
-            optional_param = 1;
-        }
-
         /* If the parameter is slurpy, collect all remaining positional
          * arguments into an array.*/
         if (param_flags & PARROT_ARG_SLURPY_ARRAY) {
@@ -861,7 +855,7 @@
             }
 
             /* Mark the option flag for the filled parameter. */
-            if (optional_param) {
+            if (param_flags & PARROT_ARG_OPTIONAL) {
                 INTVAL next_param_flags;
 
                 if (param_index + 1 < param_count) {
@@ -876,7 +870,7 @@
         }
         /* We have no more positional arguments, fill the optional parameter
          * with a default value. */
-        else if (optional_param) {
+        else if (param_flags & PARROT_ARG_OPTIONAL) {
             INTVAL next_param_flags;
 
             /* We don't handle optional named params here, handle them in the
@@ -918,7 +912,6 @@
 
     /* Now iterate over the named arguments and parameters. */
     while (1) {
-        INTVAL optional_param = 0;
         STRING *param_name    = NULL;
         INTVAL param_flags;
 
@@ -935,11 +928,6 @@
                     "named parameters must follow all positional parameters");
         }
 
-        /* If the parameter is optional, set a flag for error checking */
-        if (param_flags & PARROT_ARG_OPTIONAL) {
-            optional_param = 1;
-        }
-
         /* Collected ("slurpy") named parameter */
         if (param_flags & PARROT_ARG_SLURPY_ARRAY) {
             PMC * const collect_named = pmc_new(interp,
@@ -1024,7 +1012,7 @@
                 }
 
                 /* Mark the option flag for the filled parameter. */
-                if (optional_param) {
+                if (param_flags & PARROT_ARG_OPTIONAL) {
                     INTVAL next_param_flags;
 
                     if (param_index + 1 < param_count) {
@@ -1037,7 +1025,7 @@
                     }
                 }
             }
-            else if (optional_param) {
+            else if (param_flags & PARROT_ARG_OPTIONAL) {
                 INTVAL next_param_flags;
 
                 assign_default_param_value(interp, param_index, param_flags,


More information about the parrot-commits mailing list