Author: jonathan
Date: Sat Jul 26 07:47:35 2008
New Revision: 29756
Modified:
trunk/languages/perl6/src/parser/actions.pm
Log:
[rakudo] Make multi sub foo { } work (the case where you have a multi, but no
signature, which means it's a parameterless variant).
Modified: trunk/languages/perl6/src/parser/actions.pm
==============================================================================
--- trunk/languages/perl6/src/parser/actions.pm (original)
+++ trunk/languages/perl6/src/parser/actions.pm Sat Jul 26 07:47:35 2008
@@ -423,7 +423,10 @@
# If it was multi, then emit a :multi and a type list.
if $<sym> eq 'multi' {
our $?PARAM_TYPE_CHECK;
- my @check_list := @($?PARAM_TYPE_CHECK);
+ my @check_list;
+ if $?PARAM_TYPE_CHECK {
+ @check_list := @($?PARAM_TYPE_CHECK);
+ }
# Go over the parameters and build multi-sig.
my $pirflags := ~ $past.pirflags();
@@ -433,7 +436,10 @@
if $<routine_declarator><sym> eq 'method' {
# For methods, need to have a slot in the multi list for the
# invocant. XXX could be a type constraint in the sig on self.
- $pirflags := $pirflags ~ '_, ';
+ $pirflags := $pirflags ~ '_';
+ if $arity {
+ $pirflags := $pirflags ~ ', ';
+ }
}
while $count != $arity {
# How many types do we have?