Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Implement nqp::getcodecuid.
  • Loading branch information
jnthn committed Feb 27, 2013
1 parent dcdf4a1 commit 85bea4b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/QAST/JASTCompiler.nqp
Expand Up @@ -1806,6 +1806,7 @@ QAST::OperationsJAST.map_classlib_core_op('getcodeobj', $TYPE_OPS, 'getcodeobj',
QAST::OperationsJAST.map_classlib_core_op('setcodeobj', $TYPE_OPS, 'setcodeobj', [$RT_OBJ, $RT_OBJ], $RT_OBJ, :tc);
QAST::OperationsJAST.map_classlib_core_op('getcodename', $TYPE_OPS, 'getcodename', [$RT_OBJ], $RT_STR, :tc);
QAST::OperationsJAST.map_classlib_core_op('setcodename', $TYPE_OPS, 'setcodename', [$RT_OBJ, $RT_STR], $RT_OBJ, :tc);
QAST::OperationsJAST.map_classlib_core_op('getcodecuid', $TYPE_OPS, 'getcodecuid', [$RT_OBJ], $RT_STR, :tc);
QAST::OperationsJAST.add_core_op('setstaticlex', -> $qastcomp, $op {
if +@($op) != 3 {
nqp::die('setstaticlex requires three operands');
Expand Down
6 changes: 6 additions & 0 deletions src/org/perl6/nqp/runtime/Ops.java
Expand Up @@ -2615,6 +2615,12 @@ public static SixModelObject setcodename(SixModelObject code, String name, Threa
throw new RuntimeException("setcodename can only be used with a CodeRef");
}
}
public static String getcodecuid(SixModelObject code, ThreadContext tc) {
if (code instanceof CodeRef)
return ((CodeRef)code).staticInfo.uniqueId;
else
throw new RuntimeException("getcodename can only be used with a CodeRef");
}
public static SixModelObject forceouterctx(SixModelObject code, SixModelObject ctx, ThreadContext tc) {
if (!(code instanceof CodeRef))
throw new RuntimeException("forceouterctx first operand must be a CodeRef");
Expand Down

0 comments on commit 85bea4b

Please sign in to comment.