Skip to content

Commit 1071230

Browse files
committed
Update LII methods for LangNativeFunctions
1 parent 253815a commit 1071230

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/main/java/at/jddev0/lang/LangInterpreter.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3947,6 +3947,12 @@ public void setVar(final int SCOPE_ID, String varName, LangExternalFunctionObjec
39473947
public void setVar(final int SCOPE_ID, String varName, LangExternalFunctionObject function, boolean ignoreFinal) {
39483948
setVar(SCOPE_ID, varName, new DataObject().setFunctionPointer(new FunctionPointerObject(varName, function)), ignoreFinal);
39493949
}
3950+
public void setVar(final int SCOPE_ID, String varName, LangNativeFunction function) {
3951+
setVar(SCOPE_ID, varName, function, false);
3952+
}
3953+
public void setVar(final int SCOPE_ID, String varName, LangNativeFunction function, boolean ignoreFinal) {
3954+
setVar(SCOPE_ID, varName, new DataObject().setFunctionPointer(new FunctionPointerObject(varName, function)), ignoreFinal);
3955+
}
39503956
public void setVar(final int SCOPE_ID, String varName, InterpretingError error) {
39513957
setVar(SCOPE_ID, varName, error, false);
39523958
}
@@ -3983,15 +3989,15 @@ public InterpretingError getAndClearErrnoErrorObject(final int SCOPE_ID) {
39833989
}
39843990

39853991
/**
3986-
* Creates an function which is accessible globally in the Interpreter (= in all SCOPE_IDs)<br>
3992+
* Creates a function which is accessible globally in the Interpreter (= in all SCOPE_IDs)<br>
39873993
* If function already exists, it will be overridden<br>
39883994
* Function can be accessed with "func.[funcName]"/"fn.[funcName]" or with "linker.[funcName]"/"ln.[funcName]" and can't be removed nor changed by the Lang file
39893995
*/
3990-
public void addNativeFunction(String funcName, LangNativeFunction function) {
3996+
public void addPredefinedFunction(String funcName, LangNativeFunction function) {
39913997
interpreter.funcs.put(funcName, function);
39923998
}
39933999
/**
3994-
* Creates an function which is accessible globally in the Interpreter (= in all SCOPE_IDs)<br>
4000+
* Creates a function which is accessible globally in the Interpreter (= in all SCOPE_IDs)<br>
39954001
* If function already exists, it will be overridden<br>
39964002
* Function can be accessed with "func.[funcName]"/"fn.[funcName]" or with "linker.[funcName]"/"ln.[funcName]" and can't be removed nor changed by the Lang file
39974003
*
@@ -4068,7 +4074,7 @@ public void interpretAST(final int SCOPE_ID, AbstractSyntaxTree ast) throws Stop
40684074
getAndResetReturnValue(); //Reset returned value else the interpreter would stop immediately
40694075
interpreter.interpretAST(ast, SCOPE_ID);
40704076
}
4071-
public DataObject inerpretNode(final int SCOPE_ID, Node node) throws StoppedException {
4077+
public DataObject interpretNode(final int SCOPE_ID, Node node) throws StoppedException {
40724078
return interpreter.interpretNode(null, node, SCOPE_ID);
40734079
}
40744080
public DataObject interpretFunctionCallNode(final int SCOPE_ID, FunctionCallNode node) throws StoppedException {

0 commit comments

Comments
 (0)