Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Suggestions for unknown subs specified with &sigil
  • Loading branch information
lizmat committed Mar 7, 2014
1 parent 318a41a commit be9ffea
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/Perl6/Grammar.nqp
Expand Up @@ -3737,19 +3737,21 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
next if $decl == 1;
next if $*W.is_lexically_visible('&' ~ $name, %sym<lex>);

# just a guess, but good enough to improve error reporting
if $_ lt 'a' {
%unk_types{$name} := [] unless %unk_types{$name};
my @suggs := $*W.suggest_typename($name);
%type_suggestion{$name} := @suggs;
push_lines(%unk_types{$name}, %sym<pos>);
}
else {
# no sigil or &
if $name ge 'a' || nqp::substr($name,0,1) eq '&' {
%unk_routines{$name} := [] unless %unk_routines{$name};
my @suggs := $*W.suggest_routines($name);
%routine_suggestion{$name} := @suggs;
push_lines(%unk_routines{$name}, %sym<pos>);
}

# hopefully improve error reporting
else {
%unk_types{$name} := [] unless %unk_types{$name};
my @suggs := $*W.suggest_typename($name);
%type_suggestion{$name} := @suggs;
push_lines(%unk_types{$name}, %sym<pos>);
}
}

if %post_types || %unk_types || %unk_routines {
Expand Down

0 comments on commit be9ffea

Please sign in to comment.