Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
implement argumentless form of require
  • Loading branch information
moritz committed Sep 24, 2010
1 parent c94bfe1 commit b3efa7a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/Perl6/Actions.pm
Expand Up @@ -514,6 +514,23 @@ method statement_control:sym<use>($/) {
make $past;
}

method statement_control:sym<require>($/) {
if $<EXPR> {
$/.CURSOR.panic("require with argument list not yet implemented");
}
my $name := $<module_name><longname><name>.Str;
my @module_loader := Perl6::Grammar::parse_name('Perl6::Module::Loader');
my $past := PAST::Op.new(
:node($/),
:pasttype('callmethod'),
:name('need'),
PAST::Var.new( :name(@module_loader.pop),
:namespace(@module_loader), :scope('package') ),
$name
);
make $past;
}

method statement_control:sym<given>($/) {
my $past := $<xblock>.ast;
$past.push($past.shift); # swap [0] and [1] elements
Expand Down

0 comments on commit b3efa7a

Please sign in to comment.