Author: jonathan
Date: Fri Jul 18 07:26:57 2008
New Revision: 29585
Modified:
trunk/languages/perl6/src/classes/Object.pir
trunk/languages/perl6/src/parser/actions.pm
Log:
[rakudo] Implement .^ (call on metaclass) syntax, with passing the invocant in
as a first argument to the metaclass method, as specified in S12.
Modified: trunk/languages/perl6/src/classes/Object.pir
==============================================================================
--- trunk/languages/perl6/src/classes/Object.pir (original)
+++ trunk/languages/perl6/src/classes/Object.pir Fri Jul 18 07:26:57 2008
@@ -437,6 +437,17 @@
.end
+.sub '!.^' :method
+ .param string method_name
+ .param pmc pos_args :slurpy
+ .param pmc named_args :slurpy :named
+
+ # Get the HOW or the object and do the call on that.
+ .local pmc how
+ how = self.'HOW'()
+ .return how.method_name(self, pos_args :flat, named_args :flat :named)
+.end
+
=back
=cut
Modified: trunk/languages/perl6/src/parser/actions.pm
==============================================================================
--- trunk/languages/perl6/src/parser/actions.pm (original)
+++ trunk/languages/perl6/src/parser/actions.pm Fri Jul 18 07:26:57 2008
@@ -1234,7 +1234,7 @@
}
elsif $key eq '.*' {
$past := $( $<methodop> );
- if $/[0] eq '.?' || $/[0] eq '.+' || $/[0] eq '.*' {
+ if $/[0] eq '.?' || $/[0] eq '.+' || $/[0] eq '.*' || $/[0] eq '.^' {
my $name := $past.name();
unless $name {
$/.panic("Cannot use " ~ $/[0] ~ " when method is a code ref");