diff --git a/src/thingdef/thingdef.cpp b/src/thingdef/thingdef.cpp index ef0be1d23..3868c3fca 100644 --- a/src/thingdef/thingdef.cpp +++ b/src/thingdef/thingdef.cpp @@ -293,7 +293,7 @@ static void FinishThingdef() } else { - FCompileContext ctx(tcall->ActorClass, true); + FCompileContext ctx(tcall->ActorClass); for (j = 0; j < tcall->Parameters.Size(); ++j) { tcall->Parameters[j]->Resolve(ctx); @@ -358,7 +358,7 @@ static void FinishThingdef() sfunc = dmg->GetFunction(); if (sfunc == NULL) { - FCompileContext ctx(ti, true); + FCompileContext ctx(ti); dmg->Resolve(ctx); VMFunctionBuilder buildit; buildit.Registers[REGT_POINTER].Get(1); // The self pointer diff --git a/src/thingdef/thingdef_exp.cpp b/src/thingdef/thingdef_exp.cpp index a74d1b626..eba794ef6 100644 --- a/src/thingdef/thingdef_exp.cpp +++ b/src/thingdef/thingdef_exp.cpp @@ -76,9 +76,7 @@ FxExpression *ParseExpression (FScanner &sc, PClassActor *cls) { FxExpression *data = ParseExpressionM (sc, cls); - FCompileContext ctx; - ctx.cls = cls; - ctx.lax = true; + FCompileContext ctx(cls); data = data->Resolve(ctx); return data; diff --git a/src/thingdef/thingdef_exp.h b/src/thingdef/thingdef_exp.h index 9097e1ffc..e6a6d4941 100644 --- a/src/thingdef/thingdef_exp.h +++ b/src/thingdef/thingdef_exp.h @@ -61,12 +61,10 @@ extern PSymbolTable GlobalSymbols; struct FCompileContext { PClassActor *cls; - bool lax; - FCompileContext(PClassActor *_cls = NULL, bool _lax = false) + FCompileContext(PClassActor *_cls = NULL) { cls = _cls; - lax = _lax; } PSymbol *FindInClass(FName identifier) diff --git a/src/thingdef/thingdef_expression.cpp b/src/thingdef/thingdef_expression.cpp index c7e8f9ef7..f28a3bb8b 100644 --- a/src/thingdef/thingdef_expression.cpp +++ b/src/thingdef/thingdef_expression.cpp @@ -750,7 +750,7 @@ FxExpression *FxUnaryNotBitwise::Resolve(FCompileContext& ctx) CHECKRESOLVED(); 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. Operand = new FxIntCast(Operand); @@ -1501,7 +1501,7 @@ FxExpression *FxBinaryInt::Resolve(FCompileContext& ctx) CHECKRESOLVED(); if (!ResolveLR(ctx, false)) return NULL; - if (ctx.lax && ValueType == VAL_Float) + if (ValueType == VAL_Float /* lax */) { // For DECORATE which allows floats here. if (left->ValueType != VAL_Int) @@ -2711,7 +2711,7 @@ FxExpression *FxArrayElement::Resolve(FCompileContext &ctx) SAFE_RESOLVE(Array,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. index = new FxIntCast(index); @@ -2932,7 +2932,7 @@ FxExpression *FxActionSpecialCall::Resolve(FCompileContext& ctx) } 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]); } @@ -3163,12 +3163,7 @@ FxExpression *FxClassTypeCast::Resolve(FCompileContext &ctx) cls = PClass::FindClass(clsname); if (cls == NULL) { - if (!ctx.lax) - { - ScriptPosition.Message(MSG_ERROR,"Unknown class name '%s'", clsname.GetChars()); - delete this; - return NULL; - } + /* lax */ // Since this happens in released WADs it must pass without a terminal error... :( ScriptPosition.Message(MSG_WARNING, "Unknown class name '%s'", @@ -3341,12 +3336,8 @@ FxExpression *FxMultiNameState::Resolve(FCompileContext &ctx) destination = scope->FindState(names.Size()-1, &names[1], false); if (destination == NULL) { - ScriptPosition.Message(ctx.lax? MSG_WARNING:MSG_ERROR, "Unknown state jump destination"); - if (!ctx.lax) - { - delete this; - return NULL; - } + ScriptPosition.Message(MSG_WARNING, "Unknown state jump destination"); + /* lax */ return this; } } diff --git a/src/thingdef/thingdef_parse.cpp b/src/thingdef/thingdef_parse.cpp index 0ac87bb35..e4923094e 100644 --- a/src/thingdef/thingdef_parse.cpp +++ b/src/thingdef/thingdef_parse.cpp @@ -208,7 +208,7 @@ static void ParseConstant (FScanner &sc, PSymbolTable *symt, PClassActor *cls) FxExpression *expr = ParseExpression (sc, cls); sc.MustGetToken(';'); - FCompileContext ctx(cls, true); + FCompileContext ctx(cls); expr = expr->Resolve(ctx); if (!expr->isConstant()) { @@ -266,7 +266,7 @@ static void ParseEnum (FScanner &sc, PSymbolTable *symt, PClassActor *cls) if (sc.CheckToken('=')) { FxExpression *expr = ParseExpression (sc, cls); - FCompileContext ctx(cls, true); + FCompileContext ctx(cls); expr = expr->Resolve(ctx); if (!expr->isConstant()) { @@ -355,7 +355,7 @@ static void ParseNativeVariable (FScanner &sc, PSymbolTable *symt, PClassActor * if (sc.CheckToken('[')) { FxExpression *expr = ParseExpression (sc, cls); - FCompileContext ctx(cls, true); + FCompileContext ctx(cls); expr = expr->Resolve(ctx); if (!expr->isConstant()) { @@ -428,7 +428,7 @@ static void ParseUserVariable (FScanner &sc, PSymbolTable *symt, PClassActor *cl if (sc.CheckToken('[')) { FxExpression *expr = ParseExpression(sc, cls); - FCompileContext ctx(cls, true); + FCompileContext ctx(cls); int maxelems; expr = expr->Resolve(ctx); if (!expr->isConstant())