diff --git a/ISBPL.java b/ISBPL.java index 2eda61f..88dfb4e 100644 --- a/ISBPL.java +++ b/ISBPL.java @@ -1126,6 +1126,14 @@ public class ISBPL { for(Class c : interfaces) { type.superTypes.add(toISBPL(c).type); } + for (Class subclass : clazz.getDeclaredClasses()) { + addFunction(type, subclass.getSimpleName(), stack -> { + if(debug) + ISBPL.gErrorStream.println("Java GetSubclass: " + subclass.getName()); + stack.pop(); + stack.push(toISBPL(subclass)); + }); + } if (clazz.isEnum()) { for (Object o : clazz.getEnumConstants()) { addFunction(type, o.toString(), stack -> { @@ -1342,6 +1350,11 @@ public class ISBPL { if(expectedType == byte.class) return (byte) o.toLong(); } + if(expectedType == Runnable.class) { + return (Runnable) () -> { + ((ISBPLCallable) o.object).call(new ISBPLStack<>()); + }; + } if(!expectedType.isAssignableFrom(o.object.getClass())) typeError(o.type.name, expectedType.getName()); return o.object;