Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix handling of eval "use Foo" when Foo has INIT blocks
  • Loading branch information
sorear committed Oct 25, 2011
1 parent 2664568 commit 4494faa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/Kernel.cs
Expand Up @@ -677,7 +677,7 @@ public sealed class RuntimeUnit : IFreeze {
if (prepared) return;
prepared = true;

foreach (RuntimeUnit d in depended_units)
foreach (RuntimeUnit d in Kernel.containerRootUnit.depended_units)
d.PrepareEval(); // would loop without above assignment

if (type == null) {
Expand All @@ -697,7 +697,7 @@ public sealed class RuntimeUnit : IFreeze {
Kernel.FirePhasers(this, Kernel.PHASER_UNIT_INIT, false);
Kernel.FirePhasers(this, Kernel.PHASER_INIT, false);

if (!is_mainish && bottom == null)
if (!is_mainish && bottom == null && filename != "(eval)")
RunMainline();
}

Expand Down
6 changes: 4 additions & 2 deletions lib/Test.pm6
Expand Up @@ -77,8 +77,10 @@ class Builder {
}
}

$GLOBAL::TEST-BUILDER = Builder.bless(*);
$GLOBAL::TEST-BUILDER.reset;
INIT {
$GLOBAL::TEST-BUILDER = Builder.bless(*);
$GLOBAL::TEST-BUILDER.reset;
}

sub cmp_ok(\$a, $fn, \$b, $tag?) is export { ok($fn($a, $b), $tag); }
sub ok(\$bool, $tag?) is export { $*TEST-BUILDER.ok(?$bool, $tag) }
Expand Down

0 comments on commit 4494faa

Please sign in to comment.