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

[svn:parrot] r34248 - in trunk: src/pmc t/pmc

From:
pmichaud
Date:
December 22, 2008 10:35
Subject:
[svn:parrot] r34248 - in trunk: src/pmc t/pmc
Message ID:
20081222183505.7EBC9CBA12@x12.develooper.com
Author: pmichaud
Date: Mon Dec 22 10:35:04 2008
New Revision: 34248

Modified:
   trunk/src/pmc/sub.pmc
   trunk/t/pmc/sub.t

Log:
[core]:  Correct .arity for subs with optional named parameters (RT #61606).
* Also adjust test to only test valid PIR.



Modified: trunk/src/pmc/sub.pmc
==============================================================================
--- trunk/src/pmc/sub.pmc	(original)
+++ trunk/src/pmc/sub.pmc	Mon Dec 22 10:35:04 2008
@@ -733,15 +733,17 @@
                         else
                             sub->arg_info->pos_slurpy = 1;
                     }
-                    else if (PARROT_ARG_OPTIONAL_ISSET(sig_item)) {
-                        if (PARROT_ARG_NAME_ISSET(sig_item))
+                    else if (PARROT_ARG_NAME_ISSET(sig_item)) {
+                        i++;
+                        sig_item = SIG_ITEM(sig, i);
+                        if (PARROT_ARG_OPTIONAL_ISSET(sig_item))
                             sub->arg_info->named_optional++;
-                        else
-                            sub->arg_info->pos_optional++;
+                        else 
+                            sub->arg_info->named_required++;
                     }
                     else if (!PARROT_ARG_OPT_FLAG_ISSET(sig_item)) {
-                        if (PARROT_ARG_NAME_ISSET(sig_item))
-                            sub->arg_info->named_required++;
+                        if (PARROT_ARG_OPTIONAL_ISSET(sig_item)) 
+                            sub->arg_info->pos_optional++;
                         else
                             sub->arg_info->pos_required++;
                     }

Modified: trunk/t/pmc/sub.t
==============================================================================
--- trunk/t/pmc/sub.t	(original)
+++ trunk/t/pmc/sub.t	Mon Dec 22 10:35:04 2008
@@ -1414,17 +1414,17 @@
 .end
 
 .sub some_named
-    .param int a :named
     .param int b
-    .param int c :named
+    .param int a :named('a')
+    .param int c :named('c')
 .end
 
 .sub allsorts
-    .param int a :named
+    .param int c
     .param int b :optional
     .param int bo :opt_flag
-    .param int c
     .param pmc s :slurpy
+    .param int a :named('a')
 .end
 CODE
 0



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