Skip to content

Commit 6f5ea29

Browse files
committed
Add nqp:: ops for runtime variable lookup.
If you're building a QAST tree up, QAST::Var is just fine. But for lookups where we don't know what we want until runtime, or to write in NQP code, these are useful.
1 parent c05f281 commit 6f5ea29

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/QAST/Operations.nqp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1597,6 +1597,18 @@ QAST::Operations.add_core_pirop_mapping('newtype', 'repr_type_object_for', 'PPs'
15971597
QAST::Operations.add_core_pirop_mapping('setwho', 'set_who', '0PP', :inlinable(1));
15981598
QAST::Operations.add_core_pirop_mapping('rebless', 'repr_change_type', '0PP', :inlinable(1));
15991599

1600+
# lexical related opcodes
1601+
QAST::Operations.add_core_pirop_mapping('getlex', 'find_lex', 'Ps');
1602+
QAST::Operations.add_core_pirop_mapping('getlex_i', 'find_lex', 'Is');
1603+
QAST::Operations.add_core_pirop_mapping('getlex_n', 'find_lex', 'Ns');
1604+
QAST::Operations.add_core_pirop_mapping('getlex_s', 'find_lex', 'Ss');
1605+
QAST::Operations.add_core_pirop_mapping('bindlex', 'store_lex', '1sP');
1606+
QAST::Operations.add_core_pirop_mapping('bindlex_i', 'store_lex', '1si');
1607+
QAST::Operations.add_core_pirop_mapping('bindlex_n', 'store_lex', '1sn');
1608+
QAST::Operations.add_core_pirop_mapping('bindlex_s', 'store_lex', '1ss');
1609+
QAST::Operations.add_core_pirop_mapping('getlexdyn', 'find_dynamic_lex', 'Ps');
1610+
QAST::Operations.add_core_pirop_mapping('bindlexdyn', 'store_dynamic_lex', '1sP');
1611+
16001612
# code object related opcodes
16011613
QAST::Operations.add_core_pirop_mapping('takeclosure', 'newclosure', 'PP');
16021614
QAST::Operations.add_core_pirop_mapping('getcodeobj', 'get_sub_code_object', 'PP');

0 commit comments

Comments
 (0)