File tree Expand file tree Collapse file tree 1 file changed +36
-2
lines changed Expand file tree Collapse file tree 1 file changed +36
-2
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,34 @@ class QAST::Compiler is HLL::Compiler {
45
45
method cur_n () { $ ! cur_n }
46
46
}
47
47
48
+ # Holds information about the QAST::Block we're currently compiling.
49
+ my class BlockInfo {
50
+ has $ ! outer ;
51
+
52
+ method new ($ outer ? ) {
53
+ my $ obj := nqp ::create(self );
54
+ $ obj . BUILD($ outer );
55
+ $ obj
56
+ }
57
+
58
+ method BUILD ($ outer ) {
59
+ $ ! outer := $ outer ;
60
+ }
61
+
62
+ method outer () {
63
+ $ ! outer
64
+ }
65
+
66
+ method add_param ($ var ) {
67
+ }
68
+
69
+ method add_lexical ($ var ) {
70
+ }
71
+
72
+ method add_local ($ var ) {
73
+ }
74
+ }
75
+
48
76
our $ serno ;
49
77
INIT {
50
78
$ serno := 10 ;
@@ -66,11 +94,17 @@ class QAST::Compiler is HLL::Compiler {
66
94
proto method as_post (* @ args , * % _ ) { * }
67
95
68
96
multi method as_post (QAST ::Block $ node ) {
69
- # Block gets completely fresh registers.
97
+ # Block gets completely fresh registers, and fresh BlockInfo .
70
98
my $ * REGALLOC := RegAlloc. new ();
99
+ my $ outer := try $ * BLOCK ;
100
+ my $ block := BlockInfo. new ($ outer );
71
101
72
102
# First need to compile all of the statements.
73
- my $ stmts := self . compile_all_the_stmts($ node . list);
103
+ my $ stmts ;
104
+ {
105
+ my $ * BLOCK := $ block ;
106
+ $ stmts := self . compile_all_the_stmts($ node . list);
107
+ }
74
108
75
109
# XXX Generate parameter handling code.
76
110
my $ params := self . post_new(' Ops' );
You can’t perform that action at this time.
0 commit comments