Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Move the mop up and check code to World
  • Loading branch information
lizmat committed Apr 28, 2015
1 parent fa2e089 commit 20f5f6d
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 30 deletions.
31 changes: 1 addition & 30 deletions src/Perl6/Grammar.nqp
Expand Up @@ -1079,36 +1079,7 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
<.explain_mystery>
<.cry_sorrows>

{
# Emit any worries.
if @*WORRIES {
nqp::printfh(nqp::getstderr(), $*W.group_exception().gist());
}

# Install POD-related variables.
$*POD_PAST := $*W.add_constant(
'Array', 'type_new', :nocache, |$*POD_BLOCKS
);
$*W.install_lexical_symbol(
$*UNIT, '$=pod', $*POD_PAST.compile_time_value
);

# Tag UNIT with a magical lexical. Also if we're compiling CORE,
# give it such a tag too.
if %*COMPILING<%?OPTIONS><setting> eq 'NULL' {
my $marker := $*W.pkg_create_mo($/, %*HOW<package>, :name('!CORE_MARKER'));
$marker.HOW.compose($marker);
$*W.install_lexical_symbol($*UNIT, '!CORE_MARKER', $marker);
}
else {
my $marker := $*W.pkg_create_mo($/, %*HOW<package>, :name('!UNIT_MARKER'));
$marker.HOW.compose($marker);
$*W.install_lexical_symbol($*UNIT, '!UNIT_MARKER', $marker);
}
}

# CHECK time.
{ $*W.CHECK(); }
{ $*W.mop_up_and_check($/) }
}

method import_EXPORTHOW($/, $UNIT) {
Expand Down
32 changes: 32 additions & 0 deletions src/Perl6/World.nqp
Expand Up @@ -355,6 +355,38 @@ class Perl6::World is HLL::World {
}
}

method mop_up_and_check($/) {

# Emit any worries.
if @*WORRIES {
nqp::printfh(nqp::getstderr(), self.group_exception().gist());
}

# Install POD-related variables.
$*POD_PAST := self.add_constant(
'Array', 'type_new', :nocache, |$*POD_BLOCKS
);
self.install_lexical_symbol(
$*UNIT, '$=pod', $*POD_PAST.compile_time_value
);

# Tag UNIT with a magical lexical. Also if we're compiling CORE,
# give it such a tag too.
if %*COMPILING<%?OPTIONS><setting> eq 'NULL' {
my $marker := self.pkg_create_mo($/, %*HOW<package>, :name('!CORE_MARKER'));
$marker.HOW.compose($marker);
self.install_lexical_symbol($*UNIT, '!CORE_MARKER', $marker);
}
else {
my $marker := self.pkg_create_mo($/, %*HOW<package>, :name('!UNIT_MARKER'));
$marker.HOW.compose($marker);
self.install_lexical_symbol($*UNIT, '!UNIT_MARKER', $marker);
}

# CHECK time.
self.CHECK();
}

# Creates a new lexical scope and puts it on top of the stack.
method push_lexpad($/) {
# Create pad, link to outer, annotate with creating statement, and add to stack.
Expand Down

0 comments on commit 20f5f6d

Please sign in to comment.