Created
June 20, 2013 11:38
-
-
Save mlschroe/5822045 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/NQP/Actions.pm b/src/NQP/Actions.pm | |
index 2607093..a364536 100644 | |
--- a/src/NQP/Actions.pm | |
+++ b/src/NQP/Actions.pm | |
@@ -700,6 +700,9 @@ class NQP::Actions is HLL::Actions { | |
} | |
my $block := $past; | |
+ | |
+ @BLOCK[0][0].push(PAST::Op.new( :pirop('capture_lex__vP'), PAST::Val.new( :value($past)))); | |
+ | |
if $<deflongname> { | |
my $name := ~$<sigil>[0] ~ $<deflongname>[0].ast; | |
$past.name($name); | |
@@ -825,6 +828,8 @@ class NQP::Actions is HLL::Actions { | |
} | |
} | |
+ @BLOCK[0][0].push(PAST::Op.new( :pirop('capture_lex__vP'), PAST::Val.new( :value($past)))); | |
+ | |
# Always need an invocant. | |
unless $past<signature_has_invocant> { | |
$past[0].unshift(PAST::Var.new( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/compilers/pct/src/PAST/Compiler.pir b/compilers/pct/src/PAST/Compiler.pir | |
index a5649e3..9d4c68a 100644 | |
--- a/compilers/pct/src/PAST/Compiler.pir | |
+++ b/compilers/pct/src/PAST/Compiler.pir | |
@@ -1073,15 +1073,6 @@ Return the POST representation of a C<PAST::Block>. | |
islexical = node.'lexical'() | |
unless islexical goto outer_done | |
bpost.'outer'(outerpost) | |
- | |
- ## add block setup code (cpost) to outer block if needed | |
- if null outerpost goto outer_done | |
- .local pmc cpost | |
- $P0 = get_hll_global ['POST'], 'Ops' | |
- cpost = $P0.'new'( 'result'=>blockreg ) | |
- cpost.'push_pirop'(blockref) | |
- cpost.'push_pirop'('capture_lex', blockreg) | |
- outerpost.'unshift'(cpost) | |
outer_done: | |
## merge the node's symtable with the master | |
@@ -1221,6 +1212,7 @@ Return the POST representation of a C<PAST::Block>. | |
unless islexical goto block_done | |
$I0 = node.'closure'() | |
if $I0 goto block_closure | |
+ # Warning: not thread safe. maybe use blocktype closure instead | |
bpost.'push_pirop'('capture_lex', blockreg) | |
goto block_done | |
@@ -1241,9 +1233,6 @@ Return the POST representation of a C<PAST::Block>. | |
$P0 = get_hll_global ['POST'], 'Ops' | |
bpost = $P0.'new'(bpost, 'node'=>node, 'result'=>result) | |
bpost.'push_pirop'(blockref) | |
- unless islexical goto block_immediate_capture_skip | |
- bpost.'push_pirop'('capture_lex', blockreg) | |
- block_immediate_capture_skip: | |
bpost.'push_pirop'('call', blockreg, arglist :flat, 'result'=>result) | |
block_done: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/Perl6/Actions.pm b/src/Perl6/Actions.pm | |
index f932b2e..55f7769 100644 | |
--- a/src/Perl6/Actions.pm | |
+++ b/src/Perl6/Actions.pm | |
@@ -1431,6 +1431,7 @@ class Perl6::Actions is HLL::Actions { | |
# install it in the lexpad. | |
my $outer := $*ST.cur_lexpad(); | |
$outer[0].push(PAST::Stmt.new($block)); | |
+ $outer[0].push(PAST::Op.new( :pirop('capture_lex__vP'), PAST::Val.new( :value($block)))); | |
# Install &?ROUTINE. | |
$*ST.install_lexical_symbol($block, '&?ROUTINE', $code); | |
@@ -1652,6 +1653,7 @@ class Perl6::Actions is HLL::Actions { | |
# Install PAST block so that it gets capture_lex'd correctly. | |
my $outer := $*ST.cur_lexpad(); | |
$outer[0].push($past); | |
+ $outer[0].push(PAST::Op.new( :pirop('capture_lex__vP'), PAST::Val.new( :value($past)))); | |
# Apply traits. | |
for $<trait> { | |
@@ -1857,6 +1859,7 @@ class Perl6::Actions is HLL::Actions { | |
# Install PAST block so that it gets capture_lex'd correctly. | |
my $outer := $*ST.cur_lexpad(); | |
$outer[0].push($past); | |
+ $outer[0].push(PAST::Op.new( :pirop('capture_lex__vP'), PAST::Val.new( :value($past)))); | |
# Apply traits. | |
if $traits { | |
@@ -4088,7 +4091,9 @@ class Perl6::Actions is HLL::Actions { | |
my $code := $*ST.create_code_object($block, 'Method', $sig); | |
# Block should go in current lexpad, in correct lexical context. | |
- ($*ST.cur_lexpad())[0].push($block); | |
+ my $outer := $*ST.cur_lexpad(); | |
+ $outer[0].push($block); | |
+ $outer[0].push(PAST::Op.new( :pirop('capture_lex__vP'), PAST::Val.new( :value($block)))); | |
# Dispatch trait. XXX Should really be Bool::True, not Int here... | |
my $true := ($*ST.add_constant('Int', 'int', 1))<compile_time_value>; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment