mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-28 06:53:58 +00:00
- fixed: Resolving non-constant DECORATE expressions must be delayed until everything has been parsed.
If done as before, forward-declared classes cannot be found, and the immediate resolving is only needed for constant expressions, so explicitly enabling it in the 4 places where it is needed ensures that those unresolvable expressions remain intact until the final processing pass righr before the code generator is started.
This commit is contained in:
parent
5261acce1d
commit
ff70cf1ee7
4 changed files with 12 additions and 9 deletions
|
@ -72,12 +72,15 @@ static FxExpression *ParseExpressionB (FScanner &sc, PClassActor *cls);
|
||||||
static FxExpression *ParseExpressionA (FScanner &sc, PClassActor *cls);
|
static FxExpression *ParseExpressionA (FScanner &sc, PClassActor *cls);
|
||||||
static FxExpression *ParseExpression0 (FScanner &sc, PClassActor *cls);
|
static FxExpression *ParseExpression0 (FScanner &sc, PClassActor *cls);
|
||||||
|
|
||||||
FxExpression *ParseExpression (FScanner &sc, PClassActor *cls)
|
FxExpression *ParseExpression (FScanner &sc, PClassActor *cls, bool mustresolve)
|
||||||
{
|
{
|
||||||
FxExpression *data = ParseExpressionM (sc, cls);
|
FxExpression *data = ParseExpressionM (sc, cls);
|
||||||
|
|
||||||
|
if (mustresolve)
|
||||||
|
{
|
||||||
FCompileContext ctx(cls);
|
FCompileContext ctx(cls);
|
||||||
data = data->Resolve(ctx);
|
data = data->Resolve(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
|
@ -984,7 +984,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
FxExpression *ParseExpression (FScanner &sc, PClassActor *cls);
|
FxExpression *ParseExpression (FScanner &sc, PClassActor *cls, bool mustresolve = false);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -3564,9 +3564,9 @@ FxExpression *FxClassTypeCast::Resolve(FCompileContext &ctx)
|
||||||
delete this;
|
delete this;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
ScriptPosition.Message(MSG_DEBUG, "resolving '%s' as class name", clsname.GetChars());
|
ScriptPosition.Message(MSG_DEBUG, "resolving '%s' as class name", clsname.GetChars());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
FxExpression *x = new FxConstant(cls, ScriptPosition);
|
FxExpression *x = new FxConstant(cls, ScriptPosition);
|
||||||
delete this;
|
delete this;
|
||||||
return x;
|
return x;
|
||||||
|
|
|
@ -79,7 +79,7 @@ FxExpression *ParseParameter(FScanner &sc, PClassActor *cls, PType *type, bool c
|
||||||
}
|
}
|
||||||
else if (type == TypeSInt32 || type == TypeFloat64)
|
else if (type == TypeSInt32 || type == TypeFloat64)
|
||||||
{
|
{
|
||||||
x = ParseExpression (sc, cls);
|
x = ParseExpression (sc, cls, constant);
|
||||||
if (constant && !x->isConstant())
|
if (constant && !x->isConstant())
|
||||||
{
|
{
|
||||||
sc.ScriptMessage("Default parameter must be constant.");
|
sc.ScriptMessage("Default parameter must be constant.");
|
||||||
|
@ -190,7 +190,7 @@ static void ParseConstant (FScanner &sc, PSymbolTable *symt, PClassActor *cls)
|
||||||
sc.MustGetToken(TK_Identifier);
|
sc.MustGetToken(TK_Identifier);
|
||||||
FName symname = sc.String;
|
FName symname = sc.String;
|
||||||
sc.MustGetToken('=');
|
sc.MustGetToken('=');
|
||||||
FxExpression *expr = ParseExpression (sc, cls);
|
FxExpression *expr = ParseExpression (sc, cls, true);
|
||||||
sc.MustGetToken(';');
|
sc.MustGetToken(';');
|
||||||
|
|
||||||
if (!expr->isConstant())
|
if (!expr->isConstant())
|
||||||
|
@ -248,7 +248,7 @@ static void ParseEnum (FScanner &sc, PSymbolTable *symt, PClassActor *cls)
|
||||||
FName symname = sc.String;
|
FName symname = sc.String;
|
||||||
if (sc.CheckToken('='))
|
if (sc.CheckToken('='))
|
||||||
{
|
{
|
||||||
FxExpression *expr = ParseExpression (sc, cls);
|
FxExpression *expr = ParseExpression (sc, cls, true);
|
||||||
if (!expr->isConstant())
|
if (!expr->isConstant())
|
||||||
{
|
{
|
||||||
sc.ScriptMessage("'%s' must be constant", symname.GetChars());
|
sc.ScriptMessage("'%s' must be constant", symname.GetChars());
|
||||||
|
@ -536,7 +536,7 @@ static void ParseUserVariable (FScanner &sc, PSymbolTable *symt, PClassActor *cl
|
||||||
|
|
||||||
if (sc.CheckToken('['))
|
if (sc.CheckToken('['))
|
||||||
{
|
{
|
||||||
FxExpression *expr = ParseExpression(sc, cls);
|
FxExpression *expr = ParseExpression(sc, cls, true);
|
||||||
if (!expr->isConstant())
|
if (!expr->isConstant())
|
||||||
{
|
{
|
||||||
sc.ScriptMessage("Array size must be a constant");
|
sc.ScriptMessage("Array size must be a constant");
|
||||||
|
|
Loading…
Reference in a new issue