JIO subclasses, java.lang.Runnable integration
This commit is contained in:
parent
ff2561043a
commit
1421317515
1 changed files with 13 additions and 0 deletions
13
ISBPL.java
13
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;
|
||||
|
|
Loading…
Add table
Reference in a new issue