File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -143,6 +143,7 @@ class QAST::Compiler is HLL::Compiler {
143
143
# Block gets completely fresh registers, and fresh BlockInfo.
144
144
my $ * REGALLOC := RegAlloc. new ();
145
145
my $ * BLOCKRA := $ * REGALLOC ;
146
+ my $ * BINDVAL := 0 ;
146
147
my $ outer := try $ * BLOCK ;
147
148
my $ block := BlockInfo. new ($ outer );
148
149
Original file line number Diff line number Diff line change @@ -176,6 +176,23 @@ for <if unless> -> $op_name {
176
176
});
177
177
}
178
178
179
+ # Binding
180
+ QAST ::Operations. add_core_op(' bind' , -> $ qastcomp , $ op {
181
+ # Sanity checks.
182
+ my @ children := $ op . list;
183
+ if + @ children != 2 {
184
+ pir::die(" A 'bind' op must have exactly two children" );
185
+ }
186
+ unless nqp ::istype(@ children [0 ], QAST ::Var) {
187
+ pir::die(" First child of a 'bind' op must be a QAST::Var" );
188
+ }
189
+
190
+ # Set the QAST of the think we're to bind, then delegate to
191
+ # the compilation of the QAST::Var to handle the rest.
192
+ my $ * BINDVAL := @ children [1 ];
193
+ $ qastcomp . as_post(@ children [0 ])
194
+ });
195
+
179
196
# Straight mappings to Parrot opcodes.
180
197
QAST ::Operations. add_core_pirop_mapping(' add_i' , ' add' , ' Iii' );
181
198
QAST ::Operations. add_core_pirop_mapping(' neg_i' , ' neg' , ' Ii' );
You can’t perform that action at this time.
0 commit comments