Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
If we do dynamic compilation of code code, be sure to sink it at that…
… point. Also tag it sunk so we don't re-do the work later. Doesn't fix the immediate problem, sadly - just spotted it was missing.
  • Loading branch information
jnthn committed Feb 18, 2012
1 parent bbfd717 commit 7ddf5ab
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Perl6/Sinker.pm
Expand Up @@ -8,8 +8,9 @@ class Perl6::Sinker {

# Called when we encounter a block in the tree.
method visit_block($block) {
if pir::defined($block[1]) {
if !$block<sunk> && pir::defined($block[1]) {
$block[1] := self.visit_children($block[1]);
$block<sunk> := 1;
}
$block;
}
Expand Down
4 changes: 4 additions & 0 deletions src/Perl6/World.pm
@@ -1,5 +1,6 @@
use NQPHLL;
use Perl6::ModuleLoader;
use Perl6::Sinker;

# Binder constants.
# XXX Want constant syntax in NQP really.
Expand Down Expand Up @@ -977,6 +978,9 @@ class Perl6::World is HLL::World {
# We need to do this for BEGIN but also for things that get called in
# the compilation process, like user defined traits.
method compile_in_context($past, $code_type, $slp_type) {
# Sink the part of the tree we've been given.
$past := Perl6::Sinker.sink($past);

# Ensure that we have the appropriate op libs loaded and correct
# HLL.
my $wrapper := PAST::Block.new(PAST::Stmts.new(), $past);
Expand Down

0 comments on commit 7ddf5ab

Please sign in to comment.