Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add nqp::getstaticcode.
Abstracts away turning a closure to its original static code ref.
  • Loading branch information
jnthn committed Mar 9, 2013
1 parent 9927e00 commit a95354d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/QAST/Operations.nqp
Expand Up @@ -1903,6 +1903,17 @@ QAST::Operations.add_core_op('markcodestub', -> $qastcomp, $op {
$ops.result($code);
$ops
});
QAST::Operations.add_core_op('getstaticcode', -> $qastcomp, $op {
if +@($op) != 1 {
nqp::die('getcodecuid requires one operand');
}
$qastcomp.as_post(QAST::Op.new(
:op('callmethod'), :name('get_static_code'),
QAST::Op.new(
:op('callmethod'), :name('get_lexinfo'),
$op[0]
)))
});

# serialization context related opcodes
QAST::Operations.add_core_pirop_mapping('sha1', 'nqp_sha1', 'Ss');
Expand Down

0 comments on commit a95354d

Please sign in to comment.