Author: jonathan
Date: Thu Dec 4 15:57:41 2008
New Revision: 33495
Modified:
trunk/languages/perl6/src/parser/actions.pm
Log:
[rakudo] When we see a proto routine, mark it :multi() so it ends up in the Perl6MultiSub and set a proto property on it.
Modified: trunk/languages/perl6/src/parser/actions.pm
==============================================================================
--- trunk/languages/perl6/src/parser/actions.pm (original)
+++ trunk/languages/perl6/src/parser/actions.pm Thu Dec 4 15:57:41 2008
@@ -479,8 +479,8 @@
create_sub($/, $past);
}
- # If it was multi, then emit a :multi and a type list.
- if $<sym> eq 'multi' {
+ # If it was multi or a proto, then emit a :multi.
+ if $<sym> eq 'multi' || $<sym> eq 'proto' {
# For now, if this is a multi we need to add code to transform the sub's
# multi container to a Perl6MultiSub.
$past.loadinit().push(
@@ -500,6 +500,21 @@
unless $pirflags { $pirflags := '' }
$past.pirflags($pirflags ~ ' :multi()');
}
+
+ # Protos also need the proto property setting on them.
+ if $<sym> eq 'proto' {
+ $past.loadinit().push(
+ PAST::Op.new(
+ :inline(' setprop %0, "proto", %1'),
+ PAST::Var.new(
+ :name('block'),
+ :scope('register')
+ ),
+ 1
+ )
+ );
+ }
+
make $past;
}