Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
import according to arglist
does not break anything, but does not seem to get arglists working either
  • Loading branch information
moritz committed May 6, 2012
1 parent 5162c8b commit 7b98e2a
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/Perl6/Grammar.pm
Expand Up @@ -480,7 +480,7 @@ grammar Perl6::Grammar is HLL::Grammar {
my $module := $*W.load_module($/,
$longname,
$*GLOBALish);
do_import($module, [], $longname);
do_import($module, ['DEFAULT'], $longname);
$/.CURSOR.import_EXPORTHOW($module);
}
}
Expand Down Expand Up @@ -715,6 +715,7 @@ grammar Perl6::Grammar is HLL::Grammar {
my $found := 0;
try { $module := $*W.find_symbol($longname.components()); $found := 1; }
if $found {
# todo: fix arglist
do_import($module.WHO, $<arglist>, ~$<module_name><longname>);
}
else {
Expand All @@ -726,7 +727,7 @@ grammar Perl6::Grammar is HLL::Grammar {

token statement_control:sym<use> {
:my $longname;
:my $arglist;
:my $arglist := [];
:my $*IN_DECL := 'use';
:my $*HAS_SELF := '';
:my $*SCOPE := 'use';
Expand Down Expand Up @@ -760,6 +761,8 @@ grammar Perl6::Grammar is HLL::Grammar {
else {
$arglist := $*W.create_thunk($/, $ast)();
}
$arglist := nqp::getattr($arglist.list.eager,
$*W.find_symbol(['List']), '$!items');

}
|| {
Expand All @@ -768,7 +771,7 @@ grammar Perl6::Grammar is HLL::Grammar {
my $module := $*W.load_module($/,
~$longname,
$*GLOBALish);
do_import($module, $<arglist>, ~$longname);
do_import($module, $arglist, ~$longname);
$/.CURSOR.import_EXPORTHOW($module);
}
}
Expand All @@ -779,10 +782,13 @@ grammar Perl6::Grammar is HLL::Grammar {
}

sub do_import($module, $arglist, $package_source_name) {
$arglist := ['DEFAULT'] unless +$arglist;
if pir::exists($module, 'EXPORT') {
my $EXPORT := $module<EXPORT>.WHO;
if pir::exists($EXPORT, 'DEFAULT') {
$*W.import($EXPORT<DEFAULT>, $package_source_name);
for $arglist -> $tag {
if pir::exists($EXPORT, $tag) {
$*W.import($EXPORT{$tag}, $package_source_name);
}
}
}
}
Expand Down

0 comments on commit 7b98e2a

Please sign in to comment.