Skip to content

Commit

Permalink
MHs for handling exceptions via ExceptionHandlerX
Browse files Browse the repository at this point in the history
  • Loading branch information
qmx committed Jul 6, 2012
1 parent f6be8c0 commit 65af920
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main/java/org/dynjs/runtime/RT.java
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,14 @@ public static void throwException(Object o) {
}

public static void trycatchfinally(MethodHandles.Lookup caller, Object self, DynThreadContext context, Object _try, Object _catch, Object _finally) throws NoSuchMethodException, IllegalAccessException {
final MethodHandle catchHandle = Binder.from(void.class, Object.class, Throwable.class)
.convert(void.class, Function.class, Object.class)
.collect(1, Object[].class)
.insert(1, self)
.insert(2, context)
.convert(Object.class, Function.class, Object.class, DynThreadContext.class, Object[].class)
.invokeVirtual(caller, "call")
.bindTo(_catch);
}

public static String typeof(Object obj) {
Expand Down

0 comments on commit 65af920

Please sign in to comment.