mirror of
https://github.com/ZDoom/acc.git
synced 2025-01-31 03:10:34 +00:00
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
This commit is contained in:
parent
70fe03f7d4
commit
701c391c3f
1 changed files with 6 additions and 1 deletions
7
parse.c
7
parse.c
|
@ -2103,6 +2103,10 @@ static void ProcessScriptFunc(symbolNode_t *sym, boolean discardReturn)
|
||||||
int argCount;
|
int argCount;
|
||||||
|
|
||||||
MS_Message(MSG_DEBUG, "---- ProcessScriptFunc ----\n");
|
MS_Message(MSG_DEBUG, "---- ProcessScriptFunc ----\n");
|
||||||
|
if(sym->info.scriptFunc.predefined == YES && discardReturn == NO)
|
||||||
|
{
|
||||||
|
sym->info.scriptFunc.hasReturnValue = YES;
|
||||||
|
}
|
||||||
argCount = sym->info.scriptFunc.argCount;
|
argCount = sym->info.scriptFunc.argCount;
|
||||||
TK_NextTokenMustBe(TK_LPAREN, ERR_MISSING_LPAREN);
|
TK_NextTokenMustBe(TK_LPAREN, ERR_MISSING_LPAREN);
|
||||||
i = 0;
|
i = 0;
|
||||||
|
@ -3694,7 +3698,8 @@ static void ExprFactor(void)
|
||||||
ProcessInternFunc(sym);
|
ProcessInternFunc(sym);
|
||||||
break;
|
break;
|
||||||
case SY_SCRIPTFUNC:
|
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);
|
ERR_Error(ERR_EXPR_FUNC_NO_RET_VAL, YES);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue