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

[svn:parrot] r34537 - in branches/rvar/languages/perl6: src/parser t/00-parrot

From:
pmichaud
Date:
December 28, 2008 18:47
Subject:
[svn:parrot] r34537 - in branches/rvar/languages/perl6: src/parser t/00-parrot
Message ID:
20081229024654.60F0CCB9FA@x12.develooper.com
Author: pmichaud
Date: Sun Dec 28 18:46:53 2008
New Revision: 34537

Modified:
   branches/rvar/languages/perl6/src/parser/actions.pm
   branches/rvar/languages/perl6/t/00-parrot/05-var.t
   branches/rvar/languages/perl6/t/00-parrot/08-regex.t

Log:
[rakudo]:  Complain about declaring a lexical twice in same scope.
* Fix some double-declarations in 00-parrot tests.


Modified: branches/rvar/languages/perl6/src/parser/actions.pm
==============================================================================
--- branches/rvar/languages/perl6/src/parser/actions.pm	(original)
+++ branches/rvar/languages/perl6/src/parser/actions.pm	Sun Dec 28 18:46:53 2008
@@ -1754,12 +1754,17 @@
 
 
 method variable_declarator($/) {
-    my $past := $( $<variable> );
+    our $?BLOCK;
+    my $past   := $( $<variable> );
+    my $name   := $past.name();
+    my $symbol := $?BLOCK.symbol( $name );
+    if $symbol<scope> eq 'lexical' {
+        $/.panic("Redeclaration of variable " ~ $name);
+    }
+    
     $past.isdecl(1);
-    my $name     := $past.name();
     my $type     := List.new();
     my $viviself := container_type($<variable><sigil>);
-    our $?BLOCK;
     $?BLOCK.symbol($name, :type($type), :viviself($viviself) );
     make $past;
 }

Modified: branches/rvar/languages/perl6/t/00-parrot/05-var.t
==============================================================================
--- branches/rvar/languages/perl6/t/00-parrot/05-var.t	(original)
+++ branches/rvar/languages/perl6/t/00-parrot/05-var.t	Sun Dec 28 18:46:53 2008
@@ -34,5 +34,5 @@
 
 ##   nested 'our' declarations
 
-our $x = 'not ok 12';  { our $x = 'ok 12'; };  say $x;
+$x = 'not ok 12';  { our $x = 'ok 12'; };  say $x;
 

Modified: branches/rvar/languages/perl6/t/00-parrot/08-regex.t
==============================================================================
--- branches/rvar/languages/perl6/t/00-parrot/08-regex.t	(original)
+++ branches/rvar/languages/perl6/t/00-parrot/08-regex.t	Sun Dec 28 18:46:53 2008
@@ -19,7 +19,7 @@
 '5'  ~~ $r and say 'ok 6';
 '25' ~~ $r or  say 'ok 7';
 
-my $r = / 5 /;
+$r = / 5 /;
 $l   ~~ $r and say 'ok 8';
 5    ~~ $r and say 'ok 9';
 '5'  ~~ $r and say 'ok 10';



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