Added all compound assignment operators to DECORATE
This commit is contained in:
parent
90cc79a902
commit
e79c0225ed
3 changed files with 117 additions and 3 deletions
|
|
@ -1077,10 +1077,11 @@ FxExpression *FxAssign::Resolve(FCompileContext &ctx)
|
|||
{
|
||||
CHECKRESOLVED();
|
||||
SAFE_RESOLVE(Base, ctx);
|
||||
SAFE_RESOLVE(Right, ctx);
|
||||
|
||||
ValueType = Base->ValueType;
|
||||
|
||||
SAFE_RESOLVE(Right, ctx);
|
||||
|
||||
if (!Base->IsNumeric() || !Right->IsNumeric())
|
||||
{
|
||||
ScriptPosition.Message(MSG_ERROR, "Numeric type expected");
|
||||
|
|
@ -1120,8 +1121,10 @@ ExpEmit FxAssign::Emit(VMFunctionBuilder *build)
|
|||
assert(ValueType->GetRegType() == Right->ValueType->GetRegType());
|
||||
|
||||
ExpEmit pointer = Base->Emit(build);
|
||||
ExpEmit result = Right->Emit(build);
|
||||
Address = pointer;
|
||||
|
||||
ExpEmit result = Right->Emit(build);
|
||||
|
||||
if (result.Konst)
|
||||
{
|
||||
ExpEmit temp(build, result.RegType);
|
||||
|
|
@ -1142,6 +1145,39 @@ ExpEmit FxAssign::Emit(VMFunctionBuilder *build)
|
|||
return result;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// FxAssignSelf
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
FxAssignSelf::FxAssignSelf(const FScriptPosition &pos)
|
||||
: FxExpression(pos)
|
||||
{
|
||||
Assignment = nullptr;
|
||||
}
|
||||
|
||||
FxExpression *FxAssignSelf::Resolve(FCompileContext &ctx)
|
||||
{
|
||||
CHECKRESOLVED();
|
||||
|
||||
// This should never happen if FxAssignSelf is used correctly
|
||||
assert(Assignment != nullptr);
|
||||
|
||||
ValueType = Assignment->ValueType;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
ExpEmit FxAssignSelf::Emit(VMFunctionBuilder *build)
|
||||
{
|
||||
assert(ValueType = Assignment->ValueType);
|
||||
ExpEmit pointer = Assignment->Address; // FxAssign should have already emitted it
|
||||
ExpEmit out(build, ValueType->GetRegType());
|
||||
build->Emit(ValueType->GetLoadOp(), out.RegNum, pointer.RegNum, build->GetConstantInt(0));
|
||||
return out;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue