mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-12-01 08:31:14 +00:00
- reinstated abort-on-error for any problem that gets reported during DECORATE code generation.
- fixed: DECORATE allowed a silent conversion from names to integers. In old versions the name was converted to 0, since the scripting branch to the name index. Reverted to the old behavior but added a warning message.
This commit is contained in:
parent
1703842a94
commit
cf21bb1524
3 changed files with 37 additions and 16 deletions
|
@ -431,11 +431,11 @@ void LoadActors ()
|
||||||
FScanner sc(lump);
|
FScanner sc(lump);
|
||||||
ParseDecorate (sc);
|
ParseDecorate (sc);
|
||||||
}
|
}
|
||||||
|
FinishThingdef();
|
||||||
if (FScriptPosition::ErrorCounter > 0)
|
if (FScriptPosition::ErrorCounter > 0)
|
||||||
{
|
{
|
||||||
I_Error("%d errors while parsing DECORATE scripts", FScriptPosition::ErrorCounter);
|
I_Error("%d errors while parsing DECORATE scripts", FScriptPosition::ErrorCounter);
|
||||||
}
|
}
|
||||||
FinishThingdef();
|
|
||||||
timer.Unclock();
|
timer.Unclock();
|
||||||
if (!batchrun) Printf("DECORATE parsing took %.2f ms\n", timer.TimeMS());
|
if (!batchrun) Printf("DECORATE parsing took %.2f ms\n", timer.TimeMS());
|
||||||
// Base time: ~52 ms
|
// Base time: ~52 ms
|
||||||
|
|
|
@ -208,7 +208,7 @@ public:
|
||||||
virtual bool isConstant() const;
|
virtual bool isConstant() const;
|
||||||
virtual void RequestAddress();
|
virtual void RequestAddress();
|
||||||
virtual VMFunction *GetDirectFunction();
|
virtual VMFunction *GetDirectFunction();
|
||||||
bool IsNumeric() const { return ValueType->GetRegType() == REGT_INT || ValueType->GetRegType() == REGT_FLOAT; }
|
bool IsNumeric() const { return ValueType != TypeName && (ValueType->GetRegType() == REGT_INT || ValueType->GetRegType() == REGT_FLOAT); }
|
||||||
bool IsPointer() const { return ValueType->GetRegType() == REGT_POINTER; }
|
bool IsPointer() const { return ValueType->GetRegType() == REGT_POINTER; }
|
||||||
|
|
||||||
virtual ExpEmit Emit(VMFunctionBuilder *build);
|
virtual ExpEmit Emit(VMFunctionBuilder *build);
|
||||||
|
|
|
@ -357,12 +357,24 @@ FxExpression *FxIntCast::Resolve(FCompileContext &ctx)
|
||||||
SAFE_RESOLVE(basex, ctx);
|
SAFE_RESOLVE(basex, ctx);
|
||||||
|
|
||||||
if (basex->ValueType->GetRegType() == REGT_INT)
|
if (basex->ValueType->GetRegType() == REGT_INT)
|
||||||
|
{
|
||||||
|
if (basex->ValueType != TypeName)
|
||||||
{
|
{
|
||||||
FxExpression *x = basex;
|
FxExpression *x = basex;
|
||||||
basex = NULL;
|
basex = NULL;
|
||||||
delete this;
|
delete this;
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Ugh. This should abort, but too many mods fell into this logic hole somewhere, so this seroious error needs to be reduced to a warning. :(
|
||||||
|
if (!basex->isConstant()) ScriptPosition.Message(MSG_WARNING, "Numeric type expected, got a name");
|
||||||
|
else ScriptPosition.Message(MSG_WARNING, "Numeric type expected, got \"%s\"", static_cast<FxConstant*>(basex)->GetValue().GetName().GetChars());
|
||||||
|
FxExpression * x = new FxConstant(0, ScriptPosition);
|
||||||
|
delete this;
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (basex->ValueType->GetRegType() == REGT_FLOAT)
|
else if (basex->ValueType->GetRegType() == REGT_FLOAT)
|
||||||
{
|
{
|
||||||
if (basex->isConstant())
|
if (basex->isConstant())
|
||||||
|
@ -374,12 +386,9 @@ FxExpression *FxIntCast::Resolve(FCompileContext &ctx)
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
ScriptPosition.Message(MSG_ERROR, "Numeric type expected");
|
ScriptPosition.Message(MSG_ERROR, "Numeric type expected");
|
||||||
delete this;
|
delete this;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -442,6 +451,8 @@ FxExpression *FxFloatCast::Resolve(FCompileContext &ctx)
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
else if (basex->ValueType->GetRegType() == REGT_INT)
|
else if (basex->ValueType->GetRegType() == REGT_INT)
|
||||||
|
{
|
||||||
|
if (basex->ValueType != TypeName)
|
||||||
{
|
{
|
||||||
if (basex->isConstant())
|
if (basex->isConstant())
|
||||||
{
|
{
|
||||||
|
@ -453,6 +464,16 @@ FxExpression *FxFloatCast::Resolve(FCompileContext &ctx)
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
// Ugh. This should abort, but too many mods fell into this logic hole somewhere, so this seroious error needs to be reduced to a warning. :(
|
||||||
|
if (!basex->isConstant()) ScriptPosition.Message(MSG_WARNING, "Numeric type expected, got a name");
|
||||||
|
else ScriptPosition.Message(MSG_WARNING, "Numeric type expected, got \"%s\"", static_cast<FxConstant*>(basex)->GetValue().GetName().GetChars());
|
||||||
|
FxExpression *x = new FxConstant(0.0, ScriptPosition);
|
||||||
|
delete this;
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
ScriptPosition.Message(MSG_ERROR, "Numeric type expected");
|
ScriptPosition.Message(MSG_ERROR, "Numeric type expected");
|
||||||
delete this;
|
delete this;
|
||||||
|
|
Loading…
Reference in a new issue