Skip to content

Commit

Permalink
Make "need" enable to throw an exception when it detects version token
Browse files Browse the repository at this point in the history
Fixes RT#132214: https://rt.perl.org/Public/Bug/Display.html?id=132214

Disallows "need" to accept version token and to interpret content of the token (e.g., "v6") as a module name.

This fix avoids the different behavior between "use" and "need-import" approach.
For example, if "need" is allowed to interpret "v6" as a module name, "use" invokes pragma but "need-import" approach imports the module.
  • Loading branch information
titsuki committed Jan 14, 2018
1 parent 7537f89 commit 0cdd82a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Perl6/Grammar.nqp
Expand Up @@ -1574,9 +1574,9 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
rule statement_control:sym<need> {
<sym>
[
| <version>
| <version> <.sorry('In case of using pragma, use "use" instead (e.g., "use v6;", "use v6.c;").')>
| <module_name>
] +% ','
]+ % ','
{
for $<module_name> {
my $lnd := $*W.dissect_longname($_<longname>);
Expand Down

0 comments on commit 0cdd82a

Please sign in to comment.