Skip to content

Commit

Permalink
Add nqp:: ops for runtime variable lookup.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jnthn committed Oct 26, 2012
1 parent c05f281 commit 6f5ea29
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/QAST/Operations.nqp
Expand Up @@ -1597,6 +1597,18 @@ QAST::Operations.add_core_pirop_mapping('newtype', 'repr_type_object_for', 'PPs'
QAST::Operations.add_core_pirop_mapping('setwho', 'set_who', '0PP', :inlinable(1));
QAST::Operations.add_core_pirop_mapping('rebless', 'repr_change_type', '0PP', :inlinable(1));

# lexical related opcodes
QAST::Operations.add_core_pirop_mapping('getlex', 'find_lex', 'Ps');
QAST::Operations.add_core_pirop_mapping('getlex_i', 'find_lex', 'Is');
QAST::Operations.add_core_pirop_mapping('getlex_n', 'find_lex', 'Ns');
QAST::Operations.add_core_pirop_mapping('getlex_s', 'find_lex', 'Ss');
QAST::Operations.add_core_pirop_mapping('bindlex', 'store_lex', '1sP');
QAST::Operations.add_core_pirop_mapping('bindlex_i', 'store_lex', '1si');
QAST::Operations.add_core_pirop_mapping('bindlex_n', 'store_lex', '1sn');
QAST::Operations.add_core_pirop_mapping('bindlex_s', 'store_lex', '1ss');
QAST::Operations.add_core_pirop_mapping('getlexdyn', 'find_dynamic_lex', 'Ps');
QAST::Operations.add_core_pirop_mapping('bindlexdyn', 'store_dynamic_lex', '1sP');

# code object related opcodes
QAST::Operations.add_core_pirop_mapping('takeclosure', 'newclosure', 'PP');
QAST::Operations.add_core_pirop_mapping('getcodeobj', 'get_sub_code_object', 'PP');
Expand Down

0 comments on commit 6f5ea29

Please sign in to comment.