Skip to content

Commit 2ebb21b

Browse files
committed
Ensure code in BEGIN blocks can see the correct view of GLOBAL.
1 parent 056f183 commit 2ebb21b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/NQP/World.pm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,10 @@ class NQP::World is HLL::World {
470470

471471
# Compile and run it.
472472
my $code := self.create_code($wrapper, 'BEGIN block', 0);
473+
my $old_global := pir::get_hll_global__PPs(nqp::list(), 'GLOBAL');
474+
pir::set_hll_global__vPsP(nqp::list(), 'GLOBAL', $*GLOBALish);
473475
$code();
476+
pir::set_hll_global__vPsP(nqp::list(), 'GLOBAL', $old_global);
474477
}
475478

476479
# Sets NQP language defaults on a block for compilation.

0 commit comments

Comments
 (0)