Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
compile-time evaluate argument lists to "require"; check for redeclar…
…ations
  • Loading branch information
moritz committed Jun 9, 2012
1 parent 0fde4a1 commit 715efa4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/Perl6/Actions.pm
Expand Up @@ -820,8 +820,16 @@ class Perl6::Actions is HLL::Actions {

method statement_control:sym<require>($/) {
if $<module_name> && $<EXPR> {
$*W.throw($/, ['X', 'Comp', 'NYI'],
feature => 'require with argument list');
my $arglist := $*W.compile_time_evaluate($/, $<EXPR>.ast);
$arglist := nqp::getattr($arglist.list.eager,
$*W.find_symbol(['List']), '$!items');
my $lexpad := $*W.cur_lexpad();
for $arglist {
my $symbol := nqp::unbox_s($_.Str());
$*W.throw($/, ['X', 'Redeclaration'], :$symbol)
if $lexpad.symbol($symbol);
# TODO: stub symbol
}
}
my $name_past := $<module_name>
?? PAST::Val.new(:value($<module_name><longname><name>.Str))
Expand Down

0 comments on commit 715efa4

Please sign in to comment.