mirror of
https://github.com/ZDoom/qzdoom.git
synced 2025-01-18 23:21:41 +00:00
Remove lax from FCompileContext
- It's always set to true these days, so let's get rid of it.
This commit is contained in:
parent
09c902ce55
commit
4f528e3832
5 changed files with 15 additions and 28 deletions
|
@ -293,7 +293,7 @@ static void FinishThingdef()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FCompileContext ctx(tcall->ActorClass, true);
|
FCompileContext ctx(tcall->ActorClass);
|
||||||
for (j = 0; j < tcall->Parameters.Size(); ++j)
|
for (j = 0; j < tcall->Parameters.Size(); ++j)
|
||||||
{
|
{
|
||||||
tcall->Parameters[j]->Resolve(ctx);
|
tcall->Parameters[j]->Resolve(ctx);
|
||||||
|
@ -358,7 +358,7 @@ static void FinishThingdef()
|
||||||
sfunc = dmg->GetFunction();
|
sfunc = dmg->GetFunction();
|
||||||
if (sfunc == NULL)
|
if (sfunc == NULL)
|
||||||
{
|
{
|
||||||
FCompileContext ctx(ti, true);
|
FCompileContext ctx(ti);
|
||||||
dmg->Resolve(ctx);
|
dmg->Resolve(ctx);
|
||||||
VMFunctionBuilder buildit;
|
VMFunctionBuilder buildit;
|
||||||
buildit.Registers[REGT_POINTER].Get(1); // The self pointer
|
buildit.Registers[REGT_POINTER].Get(1); // The self pointer
|
||||||
|
|
|
@ -76,9 +76,7 @@ FxExpression *ParseExpression (FScanner &sc, PClassActor *cls)
|
||||||
{
|
{
|
||||||
FxExpression *data = ParseExpressionM (sc, cls);
|
FxExpression *data = ParseExpressionM (sc, cls);
|
||||||
|
|
||||||
FCompileContext ctx;
|
FCompileContext ctx(cls);
|
||||||
ctx.cls = cls;
|
|
||||||
ctx.lax = true;
|
|
||||||
data = data->Resolve(ctx);
|
data = data->Resolve(ctx);
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
|
|
|
@ -61,12 +61,10 @@ extern PSymbolTable GlobalSymbols;
|
||||||
struct FCompileContext
|
struct FCompileContext
|
||||||
{
|
{
|
||||||
PClassActor *cls;
|
PClassActor *cls;
|
||||||
bool lax;
|
|
||||||
|
|
||||||
FCompileContext(PClassActor *_cls = NULL, bool _lax = false)
|
FCompileContext(PClassActor *_cls = NULL)
|
||||||
{
|
{
|
||||||
cls = _cls;
|
cls = _cls;
|
||||||
lax = _lax;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PSymbol *FindInClass(FName identifier)
|
PSymbol *FindInClass(FName identifier)
|
||||||
|
|
|
@ -750,7 +750,7 @@ FxExpression *FxUnaryNotBitwise::Resolve(FCompileContext& ctx)
|
||||||
CHECKRESOLVED();
|
CHECKRESOLVED();
|
||||||
SAFE_RESOLVE(Operand, ctx);
|
SAFE_RESOLVE(Operand, ctx);
|
||||||
|
|
||||||
if (Operand->ValueType == VAL_Float && ctx.lax)
|
if (Operand->ValueType == VAL_Float /* lax */)
|
||||||
{
|
{
|
||||||
// DECORATE allows floats here so cast them to int.
|
// DECORATE allows floats here so cast them to int.
|
||||||
Operand = new FxIntCast(Operand);
|
Operand = new FxIntCast(Operand);
|
||||||
|
@ -1501,7 +1501,7 @@ FxExpression *FxBinaryInt::Resolve(FCompileContext& ctx)
|
||||||
CHECKRESOLVED();
|
CHECKRESOLVED();
|
||||||
if (!ResolveLR(ctx, false)) return NULL;
|
if (!ResolveLR(ctx, false)) return NULL;
|
||||||
|
|
||||||
if (ctx.lax && ValueType == VAL_Float)
|
if (ValueType == VAL_Float /* lax */)
|
||||||
{
|
{
|
||||||
// For DECORATE which allows floats here.
|
// For DECORATE which allows floats here.
|
||||||
if (left->ValueType != VAL_Int)
|
if (left->ValueType != VAL_Int)
|
||||||
|
@ -2711,7 +2711,7 @@ FxExpression *FxArrayElement::Resolve(FCompileContext &ctx)
|
||||||
SAFE_RESOLVE(Array,ctx);
|
SAFE_RESOLVE(Array,ctx);
|
||||||
SAFE_RESOLVE(index,ctx);
|
SAFE_RESOLVE(index,ctx);
|
||||||
|
|
||||||
if (index->ValueType == VAL_Float && ctx.lax)
|
if (index->ValueType == VAL_Float /* lax */)
|
||||||
{
|
{
|
||||||
// DECORATE allows floats here so cast them to int.
|
// DECORATE allows floats here so cast them to int.
|
||||||
index = new FxIntCast(index);
|
index = new FxIntCast(index);
|
||||||
|
@ -2932,7 +2932,7 @@ FxExpression *FxActionSpecialCall::Resolve(FCompileContext& ctx)
|
||||||
}
|
}
|
||||||
else if ((*ArgList)[i]->ValueType != VAL_Int)
|
else if ((*ArgList)[i]->ValueType != VAL_Int)
|
||||||
{
|
{
|
||||||
if (ctx.lax && ((*ArgList)[i]->ValueType == VAL_Float))
|
if ((*ArgList)[i]->ValueType == VAL_Float /* lax */)
|
||||||
{
|
{
|
||||||
(*ArgList)[i] = new FxIntCast((*ArgList)[i]);
|
(*ArgList)[i] = new FxIntCast((*ArgList)[i]);
|
||||||
}
|
}
|
||||||
|
@ -3163,12 +3163,7 @@ FxExpression *FxClassTypeCast::Resolve(FCompileContext &ctx)
|
||||||
cls = PClass::FindClass(clsname);
|
cls = PClass::FindClass(clsname);
|
||||||
if (cls == NULL)
|
if (cls == NULL)
|
||||||
{
|
{
|
||||||
if (!ctx.lax)
|
/* lax */
|
||||||
{
|
|
||||||
ScriptPosition.Message(MSG_ERROR,"Unknown class name '%s'", clsname.GetChars());
|
|
||||||
delete this;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
// Since this happens in released WADs it must pass without a terminal error... :(
|
// Since this happens in released WADs it must pass without a terminal error... :(
|
||||||
ScriptPosition.Message(MSG_WARNING,
|
ScriptPosition.Message(MSG_WARNING,
|
||||||
"Unknown class name '%s'",
|
"Unknown class name '%s'",
|
||||||
|
@ -3341,12 +3336,8 @@ FxExpression *FxMultiNameState::Resolve(FCompileContext &ctx)
|
||||||
destination = scope->FindState(names.Size()-1, &names[1], false);
|
destination = scope->FindState(names.Size()-1, &names[1], false);
|
||||||
if (destination == NULL)
|
if (destination == NULL)
|
||||||
{
|
{
|
||||||
ScriptPosition.Message(ctx.lax? MSG_WARNING:MSG_ERROR, "Unknown state jump destination");
|
ScriptPosition.Message(MSG_WARNING, "Unknown state jump destination");
|
||||||
if (!ctx.lax)
|
/* lax */
|
||||||
{
|
|
||||||
delete this;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -208,7 +208,7 @@ static void ParseConstant (FScanner &sc, PSymbolTable *symt, PClassActor *cls)
|
||||||
FxExpression *expr = ParseExpression (sc, cls);
|
FxExpression *expr = ParseExpression (sc, cls);
|
||||||
sc.MustGetToken(';');
|
sc.MustGetToken(';');
|
||||||
|
|
||||||
FCompileContext ctx(cls, true);
|
FCompileContext ctx(cls);
|
||||||
expr = expr->Resolve(ctx);
|
expr = expr->Resolve(ctx);
|
||||||
if (!expr->isConstant())
|
if (!expr->isConstant())
|
||||||
{
|
{
|
||||||
|
@ -266,7 +266,7 @@ static void ParseEnum (FScanner &sc, PSymbolTable *symt, PClassActor *cls)
|
||||||
if (sc.CheckToken('='))
|
if (sc.CheckToken('='))
|
||||||
{
|
{
|
||||||
FxExpression *expr = ParseExpression (sc, cls);
|
FxExpression *expr = ParseExpression (sc, cls);
|
||||||
FCompileContext ctx(cls, true);
|
FCompileContext ctx(cls);
|
||||||
expr = expr->Resolve(ctx);
|
expr = expr->Resolve(ctx);
|
||||||
if (!expr->isConstant())
|
if (!expr->isConstant())
|
||||||
{
|
{
|
||||||
|
@ -355,7 +355,7 @@ static void ParseNativeVariable (FScanner &sc, PSymbolTable *symt, PClassActor *
|
||||||
if (sc.CheckToken('['))
|
if (sc.CheckToken('['))
|
||||||
{
|
{
|
||||||
FxExpression *expr = ParseExpression (sc, cls);
|
FxExpression *expr = ParseExpression (sc, cls);
|
||||||
FCompileContext ctx(cls, true);
|
FCompileContext ctx(cls);
|
||||||
expr = expr->Resolve(ctx);
|
expr = expr->Resolve(ctx);
|
||||||
if (!expr->isConstant())
|
if (!expr->isConstant())
|
||||||
{
|
{
|
||||||
|
@ -428,7 +428,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);
|
||||||
FCompileContext ctx(cls, true);
|
FCompileContext ctx(cls);
|
||||||
int maxelems;
|
int maxelems;
|
||||||
expr = expr->Resolve(ctx);
|
expr = expr->Resolve(ctx);
|
||||||
if (!expr->isConstant())
|
if (!expr->isConstant())
|
||||||
|
|
Loading…
Reference in a new issue