develooper Front page | perl.cvs.parrot | Postings from January 2009

[svn:parrot] r35872 - in trunk/languages/perl6/src: classes parser

From:
jonathan
Date:
January 21, 2009 10:36
Subject:
[svn:parrot] r35872 - in trunk/languages/perl6/src: classes parser
Message ID:
20090121183633.DC683CB9AE@x12.develooper.com
Author: jonathan
Date: Wed Jan 21 10:36:33 2009
New Revision: 35872

Modified:
   trunk/languages/perl6/src/classes/Role.pir
   trunk/languages/perl6/src/parser/actions.pm

Log:
[rakudo] Revert last patch - foo(::T) should act like a type capture after all, according to TimToady++. And then a Role hands back itself in response to .WHAT.

Modified: trunk/languages/perl6/src/classes/Role.pir
==============================================================================
--- trunk/languages/perl6/src/classes/Role.pir	(original)
+++ trunk/languages/perl6/src/classes/Role.pir	Wed Jan 21 10:36:33 2009
@@ -197,6 +197,25 @@
 .end
 
 
+=item WHICH
+
+=cut
+
+.sub 'WHICH' :method
+    $I0 = get_addr self
+    .return ($I0)
+.end
+
+
+=item WHAT
+
+=cut
+
+.sub 'WHAT' :method
+    .return (self)
+.end
+
+
 =back
 
 =head1 Methods on Parrot Roles
@@ -261,6 +280,15 @@
     .return ($I0)
 .end
 
+
+=item WHAT
+
+=cut
+
+.sub 'WHAT' :method
+    .return (self)
+.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	Wed Jan 21 10:36:33 2009
@@ -1167,16 +1167,15 @@
     my $quant := $<quant>;
 
     ##  if it was type a type capture and nothing else, need to make a PAST::Var
-    my $types_handled := 0;
     unless $<param_var> {
-        unless +@($<type_constraint>) == 1 {
+        unless $<type_constraint> == 1 {
             $/.panic("Invalid signature; cannot have two consecutive parameter separators.");
         }
         our @?BLOCK;
-        my $name := substr($<type_constraint>[0].text(), 2); # knock off ::
-        $var     := PAST::Var.new( :name($name), :scope('parameter') );
+        my $name := ~$<type_constraint>[0];
+        $var     := PAST::Var.new( :scope('parameter') );
+        $var.name($var.unique());
         @?BLOCK[0].symbol( $var.name(), :scope('lexical') );
-        $types_handled := 1;
     }
 
     ##  handle slurpy and optional flags
@@ -1208,7 +1207,7 @@
     ##  keep track of any type constraints
     my $typelist := PAST::Op.new( :name('all'), :pasttype('call') );
     $var<type> := $typelist;
-    if !$types_handled && $<type_constraint> {
+    if $<type_constraint> {
         for @($<type_constraint>) {
             my $type_past := $( $_ );
             if $type_past.isa(PAST::Var) && $type_past.scope() eq 'lexical' {



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