Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Implement nqp::getmessage.
  • Loading branch information
jnthn committed Feb 27, 2013
1 parent f20d4c2 commit 81e35e7
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 @@ -1276,6 +1276,7 @@ QAST::OperationsJAST.map_classlib_core_op('die_s', $TYPE_OPS, 'die_s', [$RT_STR]
QAST::OperationsJAST.map_classlib_core_op('die', $TYPE_OPS, 'die_s', [$RT_STR], $RT_STR, :tc);
QAST::OperationsJAST.map_classlib_core_op('exception', $TYPE_OPS, 'exception', [], $RT_OBJ, :tc);
QAST::OperationsJAST.map_classlib_core_op('getextype', $TYPE_OPS, 'getextype', [$RT_OBJ], $RT_INT, :tc);
QAST::OperationsJAST.map_classlib_core_op('getmessage', $TYPE_OPS, 'getmessage', [$RT_OBJ], $RT_STR, :tc);
my %handler_names := nqp::hash(
'CATCH', $EX_CAT_CATCH,
'CONTROL', $EX_CAT_CONTROL,
Expand Down
6 changes: 6 additions & 0 deletions src/org/perl6/nqp/runtime/Ops.java
Expand Up @@ -2771,6 +2771,12 @@ public static long getextype(SixModelObject obj, ThreadContext tc) {
else
throw new RuntimeException("getextype needs an object with VMException representation");
}
public static String getmessage(SixModelObject obj, ThreadContext tc) {
if (obj instanceof VMExceptionInstance)
return ((VMExceptionInstance)obj).message;
else
throw new RuntimeException("getmessage needs an object with VMException representation");
}

/* HLL configuration and compiler related options. */
public static SixModelObject sethllconfig(String language, SixModelObject configHash, ThreadContext tc) {
Expand Down

0 comments on commit 81e35e7

Please sign in to comment.