Merge branch 'zscript' into gz-zscript

This commit is contained in:
Christoph Oelckers 2016-11-15 15:35:35 +01:00
commit b0a0056097
2 changed files with 11 additions and 9 deletions

View File

@ -1847,8 +1847,8 @@ FxExpression *FxUnaryNotBoolean::Resolve(FCompileContext& ctx)
ExpEmit FxUnaryNotBoolean::Emit(VMFunctionBuilder *build)
{
assert(Operand->ValueType == ValueType);
assert(ValueType == TypeBool);
assert(Operand->ValueType == TypeBool);
assert(ValueType == TypeBool || IsInteger()); // this may have been changed by an int cast.
ExpEmit from = Operand->Emit(build);
assert(!from.Konst);
// boolean not is the same as XOR-ing the lowest bit
@ -8069,11 +8069,10 @@ FxExpression *FxClassTypeCast::Resolve(FCompileContext &ctx)
{
if (!cls->IsDescendantOf(desttype))
{
ScriptPosition.Message(MSG_ERROR, "class '%s' is not compatible with '%s'", clsname.GetChars(), desttype->TypeName.GetChars());
delete this;
return nullptr;
ScriptPosition.Message(MSG_OPTERROR, "class '%s' is not compatible with '%s'", clsname.GetChars(), desttype->TypeName.GetChars());
cls = nullptr;
}
ScriptPosition.Message(MSG_DEBUGLOG, "resolving '%s' as class name", clsname.GetChars());
else ScriptPosition.Message(MSG_DEBUGLOG, "resolving '%s' as class name", clsname.GetChars());
}
}
FxExpression *x = new FxConstant(cls, to, ScriptPosition);

View File

@ -477,9 +477,12 @@ static FxExpression *ParseExpression0 (FScanner &sc, PClassActor *cls)
exp = new FxRuntimeStateIndex(ParseExpressionM(sc, cls));
}
// The parsed expression is of type 'statelabel', but we want a real state here so we must convert it.
if (!exp->isConstant())
{
FArgumentList args;
args.Push(exp);
exp = new FxFunctionCall(NAME_ResolveState, NAME_None, args, sc);
}
sc.MustGetToken(')');
return exp;
}