mirror of
https://github.com/ZDoom/qzdoom.git
synced 2025-05-30 16:40:58 +00:00
- fixed initialization of local variables with other local variables.
- fixed several occurenced where vectors were treated as floats. NOTE: The entire codegen.cpp file needs to be carefully reviewed for bad use of the REGT_ constants, there's probably more places where using them has broken some type checks. - fixed: committed test version of zscript.txt instead of changed actor.txt by accident. Initialization and assignment for strings is working with this commit.
This commit is contained in:
parent
4dc97a6ed0
commit
853c6f6684
3 changed files with 16 additions and 10 deletions
|
@ -676,7 +676,7 @@ FxExpression *FxBoolCast::Resolve(FCompileContext &ctx)
|
|||
delete this;
|
||||
return x;
|
||||
}
|
||||
else if (basex->ValueType->GetRegType() == REGT_INT || basex->ValueType->GetRegType() == REGT_FLOAT || basex->ValueType->GetRegType() == REGT_POINTER)
|
||||
else if ((basex->ValueType->GetRegType() == REGT_INT || basex->ValueType->GetRegType() == REGT_FLOAT || basex->ValueType->GetRegType() == REGT_POINTER) && !basex->IsVector())
|
||||
{
|
||||
if (basex->isConstant())
|
||||
{
|
||||
|
@ -797,7 +797,7 @@ FxExpression *FxIntCast::Resolve(FCompileContext &ctx)
|
|||
return x;
|
||||
}
|
||||
}
|
||||
else if (basex->ValueType->GetRegType() == REGT_FLOAT)
|
||||
else if (basex->ValueType->GetRegType() == REGT_FLOAT && !basex->IsVector())
|
||||
{
|
||||
if (basex->isConstant())
|
||||
{
|
||||
|
@ -875,7 +875,7 @@ FxExpression *FxFloatCast::Resolve(FCompileContext &ctx)
|
|||
CHECKRESOLVED();
|
||||
SAFE_RESOLVE(basex, ctx);
|
||||
|
||||
if (basex->ValueType->GetRegType() == REGT_FLOAT)
|
||||
if (basex->ValueType->GetRegType() == REGT_FLOAT && !basex->IsVector())
|
||||
{
|
||||
FxExpression *x = basex;
|
||||
basex = NULL;
|
||||
|
@ -1095,11 +1095,11 @@ ExpEmit FxStringCast::Emit(VMFunctionBuilder *build)
|
|||
|
||||
from.Free(build);
|
||||
ExpEmit to(build, REGT_STRING);
|
||||
if (ValueType == TypeName)
|
||||
if (basex->ValueType == TypeName)
|
||||
{
|
||||
build->Emit(OP_CAST, to.RegNum, from.RegNum, CAST_N2S);
|
||||
}
|
||||
else if (ValueType == TypeSound)
|
||||
else if (basex->ValueType == TypeSound)
|
||||
{
|
||||
build->Emit(OP_CAST, to.RegNum, from.RegNum, CAST_So2S);
|
||||
}
|
||||
|
@ -1325,7 +1325,7 @@ FxExpression *FxTypeCast::Resolve(FCompileContext &ctx)
|
|||
{
|
||||
goto basereturn;
|
||||
}
|
||||
else if (ValueType->GetRegType() == REGT_FLOAT)
|
||||
else if (ValueType->GetRegType() == REGT_FLOAT && !IsVector())
|
||||
{
|
||||
FxExpression *x = new FxFloatCast(basex);
|
||||
x = x->Resolve(ctx);
|
||||
|
@ -4867,6 +4867,7 @@ ExpEmit FxLocalVariable::Emit(VMFunctionBuilder *build)
|
|||
}
|
||||
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
|
@ -7671,11 +7672,17 @@ ExpEmit FxLocalVariableDeclaration::Emit(VMFunctionBuilder *build)
|
|||
}
|
||||
emitval.Free(build);
|
||||
}
|
||||
else
|
||||
else if (Init->ExprType != EFX_LocalVariable)
|
||||
{
|
||||
// take over the register that got allocated while emitting the Init expression.
|
||||
RegNum = emitval.RegNum;
|
||||
}
|
||||
else
|
||||
{
|
||||
ExpEmit out(build, emitval.RegType, emitval.RegCount);
|
||||
build->Emit(ValueType->GetMoveOp(), out.RegNum, emitval.RegNum);
|
||||
RegNum = out.RegNum;
|
||||
}
|
||||
}
|
||||
return ExpEmit();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue