develooper Front page | perl.cvs.parrot | Postings from December 2008

[svn:parrot] r34630 - trunk/compilers/pirc/new

From:
kjs
Date:
December 30, 2008 02:13
Subject:
[svn:parrot] r34630 - trunk/compilers/pirc/new
Message ID:
20081230101252.BF82BCB9FA@x12.develooper.com
Author: kjs
Date: Tue Dec 30 02:12:49 2008
New Revision: 34630

Modified:
   trunk/compilers/pirc/new/pircompunit.c

Log:
[pirc] count :named arguments twice as well; once for the argument itself, once for the :named() flag value.

Modified: trunk/compilers/pirc/new/pircompunit.c
==============================================================================
--- trunk/compilers/pirc/new/pircompunit.c	(original)
+++ trunk/compilers/pirc/new/pircompunit.c	Tue Dec 30 02:12:49 2008
@@ -1559,18 +1559,25 @@
 */
 invocation *
 set_invocation_args(invocation * const inv, argument * const args) {
-    argument *count_iter;
+    argument *arg_iter;
     unsigned  arg_count = 0;
 
     inv->arguments = args;
 
     if (args) {
-        count_iter = args->next;
+        arg_iter = args->next;
         do {
-            count_iter = count_iter->next;
-            ++arg_count;
+            arg_iter = arg_iter->next;
+
+            /* count :named arguments twice, once for the argument,
+             * once for the :named flag value.
+             */
+            if (TEST_FLAG(arg_iter->flags, TARGET_FLAG_NAMED))
+                arg_count += 2;
+            else
+                ++arg_count;
         }
-        while (count_iter != args->next);
+        while (arg_iter != args->next);
     }
 
     /* fprintf(stderr, "invocation has %u args\n", arg_count); */



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About