From 701c391c3f9d939f34541fc1fb960be1e4a7dfba Mon Sep 17 00:00:00 2001 From: rhinoduck Date: Mon, 31 Mar 2014 18:28:31 +0200 Subject: [PATCH] Fix for function return value speculation - a speculated function is now marked as returning a value if it is called as such at any point before its definition - no unwarranted errors about missing return values are raised for speculated functions anymore --- parse.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/parse.c b/parse.c index ae49ab6..b05e0d2 100644 --- a/parse.c +++ b/parse.c @@ -2103,6 +2103,10 @@ static void ProcessScriptFunc(symbolNode_t *sym, boolean discardReturn) int argCount; MS_Message(MSG_DEBUG, "---- ProcessScriptFunc ----\n"); + if(sym->info.scriptFunc.predefined == YES && discardReturn == NO) + { + sym->info.scriptFunc.hasReturnValue = YES; + } argCount = sym->info.scriptFunc.argCount; TK_NextTokenMustBe(TK_LPAREN, ERR_MISSING_LPAREN); i = 0; @@ -3694,7 +3698,8 @@ static void ExprFactor(void) ProcessInternFunc(sym); break; case SY_SCRIPTFUNC: - if(sym->info.scriptFunc.hasReturnValue == NO) + if(sym->info.scriptFunc.predefined == NO + && sym->info.scriptFunc.hasReturnValue == NO) { ERR_Error(ERR_EXPR_FUNC_NO_RET_VAL, YES); }