Permalink
Browse files

Avoid spurious error on &[+], reduce reparsing in check_variable

  • Loading branch information...
1 parent 9d10d16 commit f54d02cb955dc98e2d3901b26a273776e747970f @sorear committed May 27, 2012
Showing with 5 additions and 2 deletions.
  1. +5 −2 src/NieczaActions.pm6
View
7 src/NieczaActions.pm6
@@ -2000,12 +2000,15 @@ method check_strict() {
# redo a lot of the same scanning.
method check_variable ($variable) {
return () unless defined $variable;
+ my $vast = $variable.ast;
+ return () if $vast<term>; # pseudo-var
my $name = $variable.Str;
my $here = $variable.CURSOR.cursor($variable.from);
$here.deb("check_variable $name") if $*DEBUG +& DEBUG::symtab;
- my ($sigil, $twigil, $first) = $name ~~ /(\$|\@|\%|\&)(\W*)(.?)/;
+ my $sigil = $vast<sigil> // '';
+ my $twigil = $vast<twigil> // '';
+ my $first = substr($vast<name> // '', 0, 1);
$variable.ast<checked> || $here.sorry("do_variable_reference must always precede check_variable");
- ($first,$twigil) = ($twigil, '') if $first eq '';
given $twigil {
when '' {
my $ok = 0;

0 comments on commit f54d02c

Please sign in to comment.