Skip to content

Instantly share code, notes, and snippets.

@FROGGS
Created August 27, 2015 17:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FROGGS/da2607dd8fc9d9774d6d to your computer and use it in GitHub Desktop.
Save FROGGS/da2607dd8fc9d9774d6d to your computer and use it in GitHub Desktop.
~/dev/rakudo$ git diff
diff --git a/src/Perl6/Actions.nqp b/src/Perl6/Actions.nqp
index c20f441..4b48f54 100644
--- a/src/Perl6/Actions.nqp
+++ b/src/Perl6/Actions.nqp
@@ -2440,9 +2440,6 @@ Compilation unit '$file' contained the following violations:
}
my $name := $<defterm>.ast;
my $cur_lexpad := $*W.cur_lexpad;
- if $cur_lexpad.symbol($name) {
- $*W.throw($/, ['X', 'Redeclaration'], symbol => $name);
- }
if $*OFTYPE {
my $type := $*OFTYPE.ast;
$cur_lexpad[0].push(QAST::Var.new( :$name, :scope('lexical'),
diff --git a/src/Perl6/Grammar.nqp b/src/Perl6/Grammar.nqp
index 8906760..58527f2 100644
--- a/src/Perl6/Grammar.nqp
+++ b/src/Perl6/Grammar.nqp
@@ -2287,6 +2287,14 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
# STD.pm6 uses <defterm> here, but we need different
# action methods
| '\\' <defterm>
+ {
+ my $name := $<defterm>.Str;
+ my $curpad := $*W.cur_lexpad();
+ if $curpad.symbol($name) {
+ $*W.throw(self.CURSOR, ['X', 'Redeclaration'], symbol => $name);
+ }
+ $curpad.symbol($name, :scope('lexical'));
+ }
[ <.ws> <term_init=initializer> || <.typed_panic: "X::Syntax::Term::MissingInitializer"> ]
| <variable_declarator>
[
~/dev/rakudo$ perl6 -e 'my $a = 1; my $b = 2; $a = (a => 2,:b($a, $b)); say $a.perl'
Use of uninitialized value of type Any in numeric context in block <unit> at -e:1
Use of uninitialized value of type Any in numeric context in block <unit> at -e:1
(my \List_139996377897776 = (:a(2), :b($(List_139996377897776, 2))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment