manuallyPushCall method
Directly invoke a ValFunction by manually pushing it onto the call stack. This might be useful, for example, in invoking handlers that have somehow been registered with the host app via intrinsics.
Implementation
void manuallyPushCall(ValFunction func, Value resultStorage,
[List<Value>? arguments]) {
var context = stack.last;
int argCount = func.function.parameters.length;
for (var i = 0; i < argCount; i++) {
if (arguments != null && i < arguments.length) {
final val = context.valueInContext(arguments[i]);
context.pushParamArgument(val);
} else {
context.pushParamArgument(null);
}
}
Context nextContext =
context.nextCallContext(func.function, argCount, false, null);
nextContext.resultStorage = resultStorage;
stack.add(nextContext);
}