Navigation Menu

Skip to content

Commit

Permalink
Unify EXPORTHOW handling, avoid some code duplication, make nested se…
Browse files Browse the repository at this point in the history
…ttings work.
  • Loading branch information
jnthn committed Sep 8, 2011
1 parent 842c4f7 commit 7360e33
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions src/Perl6/Grammar.pm
Expand Up @@ -396,25 +396,17 @@ grammar Perl6::Grammar is HLL::Grammar {
$*UNIT_OUTER := $*ST.push_lexpad($/);
$*UNIT := $*ST.push_lexpad($/);

# If we already have a specified outer context, then we'll mostly
# just steal stuff from it.
if pir::defined(%*COMPILING<%?OPTIONS><outer_ctx>) {
# Locate its EXPORTHOW, if any, and import from it.
$/.CURSOR.unitstart();
#try {
my $EXPORTHOW := $*ST.find_symbol(['EXPORTHOW']);
for $EXPORTHOW.WHO {
%*HOW{$_.key} := $_.value;
}
#}
}
else {
# Load setting and import any meta-objects.
# If we already have a specified outer context, then that's
# our setting. Otherwise, load one.
unless pir::defined(%*COMPILING<%?OPTIONS><outer_ctx>) {
$*SETTING := $*ST.load_setting(%*COMPILING<%?OPTIONS><setting> // 'CORE');
unless %*COMPILING<%?OPTIONS><setting> eq 'NULL' {
$/.CURSOR.import_EXPORTHOW($*SETTING);
}
$/.CURSOR.unitstart();
try {
my $EXPORTHOW := $*ST.find_symbol(['EXPORTHOW']);
for $EXPORTHOW.WHO {
%*HOW{$_.key} := $_.value;
}
$/.CURSOR.unitstart();
}

# Create GLOBAL(ish).
Expand Down

0 comments on commit 7360e33

Please sign in to comment.