Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Handle EXPORTHOW, so we can haz meta-objects available.
  • Loading branch information
jnthn committed May 7, 2011
1 parent cf7946d commit 5eddfaa
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/Perl6/Grammar.pm
Expand Up @@ -212,8 +212,11 @@ grammar Perl6::Grammar is HLL::Grammar {
# XXX TODO
}
else {
# Load setting. This also imports any meta-objects.
# Load setting and import any meta-objects.
$*SETTING := $*ST.load_setting(%*COMPILING<%?OPTIONS><setting> // 'CORE');
unless %*COMPILING<%?OPTIONS><setting> eq 'NULL' {
$/.CURSOR.import_EXPORTHOW($*SETTING);
}
}

# Create GLOBAL(ish).
Expand All @@ -237,6 +240,15 @@ grammar Perl6::Grammar is HLL::Grammar {
$*ST.pop_lexpad(); # UNIT_OUTER
}
}

method import_EXPORTHOW($UNIT) {
# See if we've exported any HOWs.
if pir::exists($UNIT, 'EXPORTHOW') {
for $UNIT<EXPORTHOW>.WHO {
%*HOW{$_.key} := $_.value;
}
}
}

rule statementlist {
| $
Expand Down Expand Up @@ -433,7 +445,12 @@ grammar Perl6::Grammar is HLL::Grammar {
{
$/.CURSOR.panic("arglist case of use not yet implemented");
}
|| { $longname && $*ST.load_module(~$longname); }
|| {
if $longname {
my $module := $*ST.load_module(~$longname, $*GLOBALish);
$/.CURSOR.import_EXPORTHOW($module);
}
}
]
]
<.ws>
Expand Down

0 comments on commit 5eddfaa

Please sign in to comment.