mirror of
https://github.com/ZDoom/acc.git
synced 2025-03-13 03:42:17 +00:00
- Assign the fileDepth of a constant earlier to avoid uninitialized value when evaluating constant.
This commit is contained in:
parent
7a07de833a
commit
918a247c0d
1 changed files with 6 additions and 5 deletions
11
parse.c
11
parse.c
|
@ -1190,11 +1190,6 @@ static void OuterDefine(boolean force)
|
|||
force ? "(forced) " : "");
|
||||
TK_NextTokenMustBe(TK_IDENTIFIER, ERR_INVALID_IDENTIFIER);
|
||||
sym = SY_InsertGlobalUnique(tk_String, SY_CONSTANT);
|
||||
TK_NextToken();
|
||||
value = EvalConstExpression();
|
||||
MS_Message(MSG_DEBUG, "Constant value: %d\n", value);
|
||||
sym->info.constant.value = value;
|
||||
sym->info.constant.strValue = pa_ConstExprIsString ? strdup(STR_Get(value)) : NULL;
|
||||
// Defines inside an import are deleted when the import is popped.
|
||||
if(ImportMode != IMPORT_Importing || force)
|
||||
{
|
||||
|
@ -1204,6 +1199,12 @@ static void OuterDefine(boolean force)
|
|||
{
|
||||
sym->info.constant.fileDepth = TK_GetDepth();
|
||||
}
|
||||
|
||||
TK_NextToken();
|
||||
value = EvalConstExpression();
|
||||
MS_Message(MSG_DEBUG, "Constant value: %d\n", value);
|
||||
sym->info.constant.value = value;
|
||||
sym->info.constant.strValue = pa_ConstExprIsString ? strdup(STR_Get(value)) : NULL;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
Loading…
Reference in a new issue