Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
make "require PAKAGE/STRING" return said PACKAGE/STRING
Previously it returned True on success which is not that helpful. Now we can use
the return value as specified by S11: my $foo = (require Foo).new;

Fixes RT #126100
  • Loading branch information
FROGGS committed Nov 21, 2015
1 parent fa3ce11 commit 95558bb
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/Perl6/Actions.nqp
Expand Up @@ -1414,9 +1414,15 @@ Compilation unit '$file' contained the following violations:

method statement_control:sym<require>($/) {
my $past := QAST::Stmts.new(:node($/));
my $name_past := $<module_name>
?? $*W.dissect_longname($<module_name><longname>).name_past()
!! $<file>.ast;
my $name_past;
my $longname;
if $<module_name> {
$longname := $*W.dissect_longname($<module_name><longname>);
$name_past := $longname.name_past();
}
else {
$name_past := $<file>.ast;
}
my $op := QAST::Op.new(
:op('callmethod'), :name('load_module'),
QAST::WVal.new( :value($*W.find_symbol(['CompUnitRepo'])) ),
Expand Down Expand Up @@ -1459,7 +1465,9 @@ Compilation unit '$file' contained the following violations:
$past.push($import_past);
}

$past.push(QAST::WVal.new( :value($*W.find_symbol(['True'])) ));
$past.push($<module_name>
?? self.make_indirect_lookup($longname.components())
!! $<file>.ast);

make $past;
}
Expand Down

0 comments on commit 95558bb

Please sign in to comment.