add def native
This commit is contained in:
parent
645a78bead
commit
95da50a02a
2 changed files with 14 additions and 0 deletions
|
@ -15,6 +15,10 @@ import java.util.function.Supplier;
|
|||
*/
|
||||
|
||||
public class ISBPL {
|
||||
// TODO: fully implement JIO
|
||||
// public static final boolean ENABLE_JINTEROP = true;
|
||||
|
||||
|
||||
static boolean debug = false;
|
||||
public ISBPLDebugger.IPC debuggerIPC = new ISBPLDebugger.IPC();
|
||||
ArrayList<ISBPLType> types = new ArrayList<>();
|
||||
|
@ -846,6 +850,15 @@ public class ISBPL {
|
|||
}
|
||||
};
|
||||
break;
|
||||
case "def":
|
||||
func = (stack) -> {
|
||||
ISBPLObject str = stack.pop();
|
||||
ISBPLObject callable = stack.pop();
|
||||
String s = toJavaString(str);
|
||||
callable.checkType(getType("func"));
|
||||
addFunction(s, (ISBPLCallable) callable.object);
|
||||
};
|
||||
break;
|
||||
default:
|
||||
func = natives.get(name);
|
||||
break;
|
||||
|
|
|
@ -64,6 +64,7 @@ native %
|
|||
native ^
|
||||
|
||||
native fcall
|
||||
native def
|
||||
|
||||
func ++ { 1 + }
|
||||
func -- { 1 - }
|
||||
|
|
Loading…
Reference in a new issue