Skip to content

Commit 086cb6f

Browse files
committed
Implement some missing exception related ops.
1 parent c8bbb9a commit 086cb6f

File tree

1 file changed

+32
-0
lines changed
  • src/vm/jvm/runtime/org/perl6/nqp/runtime

1 file changed

+32
-0
lines changed

src/vm/jvm/runtime/org/perl6/nqp/runtime/Ops.java

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3175,6 +3175,14 @@ public static long getextype(SixModelObject obj, ThreadContext tc) {
31753175
else
31763176
throw ExceptionHandling.dieInternal(tc, "getextype needs an object with VMException representation");
31773177
}
3178+
public static long setextype(SixModelObject obj, long category, ThreadContext tc) {
3179+
if (obj instanceof VMExceptionInstance) {
3180+
((VMExceptionInstance)obj).category = category;
3181+
return category;
3182+
}
3183+
else
3184+
throw ExceptionHandling.dieInternal(tc, "setextype needs an object with VMException representation");
3185+
}
31783186
public static String getmessage(SixModelObject obj, ThreadContext tc) {
31793187
if (obj instanceof VMExceptionInstance) {
31803188
String msg = ((VMExceptionInstance)obj).message;
@@ -3184,12 +3192,36 @@ public static String getmessage(SixModelObject obj, ThreadContext tc) {
31843192
throw ExceptionHandling.dieInternal(tc, "getmessage needs an object with VMException representation");
31853193
}
31863194
}
3195+
public static String setmessage(SixModelObject obj, String msg, ThreadContext tc) {
3196+
if (obj instanceof VMExceptionInstance) {
3197+
((VMExceptionInstance)obj).message = msg;
3198+
return msg;
3199+
}
3200+
else {
3201+
throw ExceptionHandling.dieInternal(tc, "setmessage needs an object with VMException representation");
3202+
}
3203+
}
31873204
public static SixModelObject getpayload(SixModelObject obj, ThreadContext tc) {
31883205
if (obj instanceof VMExceptionInstance)
31893206
return ((VMExceptionInstance)obj).payload;
31903207
else
31913208
throw ExceptionHandling.dieInternal(tc, "getpayload needs an object with VMException representation");
31923209
}
3210+
public static SixModelObject setpayload(SixModelObject obj, SixModelObject payload, ThreadContext tc) {
3211+
if (obj instanceof VMExceptionInstance) {
3212+
((VMExceptionInstance)obj).payload = payload;
3213+
return payload;
3214+
}
3215+
else {
3216+
throw ExceptionHandling.dieInternal(tc, "setpayload needs an object with VMException representation");
3217+
}
3218+
}
3219+
public static SixModelObject newexception(ThreadContext tc) {
3220+
SixModelObject exType = tc.curFrame.codeRef.staticInfo.compUnit.hllConfig.exceptionType;
3221+
SixModelObject exObj = (VMExceptionInstance)exType.st.REPR.allocate(tc, exType.st);
3222+
exObj.initialize(tc);
3223+
return exObj;
3224+
}
31933225
public static SixModelObject backtracestrings(SixModelObject obj, ThreadContext tc) {
31943226
if (obj instanceof VMExceptionInstance) {
31953227
SixModelObject Array = tc.curFrame.codeRef.staticInfo.compUnit.hllConfig.listType;

0 commit comments

Comments
 (0)