@Override public Value execute(final Interpreter interpreter) { if (!KoLmafia.permitsContinue()) { interpreter.setState(Interpreter.STATE_EXIT); return null; } interpreter.traceIndent(); if (interpreter.isTracing()) { interpreter.trace("Invoke: " + this); interpreter.trace("Function name: " + this.name); } // Get the function name Value funcValue = this.name.execute(interpreter); if (interpreter.isTracing()) { interpreter.trace("[" + interpreter.getState() + "] <- " + funcValue); } if (funcValue == null) { interpreter.traceUnindent(); return null; } interpreter.setLineAndFile(this.fileName, this.lineNumber); String func = funcValue.toString(); Function function = this.scope.findFunction(func, this.params); if (function == null) { throw interpreter.undefinedFunctionException(func, this.params); } if (!Parser.validCoercion(this.type, function.getType(), "return")) { throw interpreter.runtimeException( "Calling \"" + func + "\", which returns " + function.getType() + " but " + this.type + " expected"); } this.target = function; // Invoke it. Value result = super.execute(interpreter); interpreter.traceUnindent(); return result; }