Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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.
  • Loading branch information...
commit 6f5ea2939eda8cca0adcc47070311c69289786ab 1 parent c05f281
@jnthn jnthn authored
Showing with 12 additions and 0 deletions.
  1. +12 −0 src/QAST/Operations.nqp
View
12 src/QAST/Operations.nqp
@@ -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');
Please sign in to comment.
Something went wrong with that request. Please try again.