mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-14 16:14:38 +00:00
fix %obj.field op assign.
This commit is contained in:
parent
acde0c3f0b
commit
085af8e762
2 changed files with 17 additions and 1 deletions
|
|
@ -1432,7 +1432,7 @@ U32 SlotAssignOpNode::compile(CodeStream& codeStream, U32 ip, TypeReq type)
|
||||||
codeStream.emit((subType == TypeReqFloat) ? OP_LOADFIELD_FLT : OP_LOADFIELD_UINT);
|
codeStream.emit((subType == TypeReqFloat) ? OP_LOADFIELD_FLT : OP_LOADFIELD_UINT);
|
||||||
codeStream.emit(operand);
|
codeStream.emit(operand);
|
||||||
codeStream.emit((subType == TypeReqFloat) ? OP_SAVEFIELD_FLT : OP_SAVEFIELD_UINT);
|
codeStream.emit((subType == TypeReqFloat) ? OP_SAVEFIELD_FLT : OP_SAVEFIELD_UINT);
|
||||||
if (subType == TypeReqNone)
|
if (type == TypeReqNone)
|
||||||
codeStream.emit(OP_POP_STK);
|
codeStream.emit(OP_POP_STK);
|
||||||
return codeStream.tell();
|
return codeStream.tell();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -512,6 +512,22 @@ TEST(Script, Basic_SimObject)
|
||||||
)");
|
)");
|
||||||
|
|
||||||
ASSERT_STREQ(fieldTest.getString(), "B");
|
ASSERT_STREQ(fieldTest.getString(), "B");
|
||||||
|
|
||||||
|
ConsoleValue fieldOpTest = RunScript(R"(
|
||||||
|
function a()
|
||||||
|
{
|
||||||
|
%obj = new SimObject();
|
||||||
|
%obj.field = 1;
|
||||||
|
%obj.field += 2;
|
||||||
|
|
||||||
|
%value = %obj.field;
|
||||||
|
%obj.delete();
|
||||||
|
return %value;
|
||||||
|
}
|
||||||
|
return a();
|
||||||
|
)");
|
||||||
|
|
||||||
|
ASSERT_EQ(fieldOpTest.getInt(), 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Script, Internal_Name)
|
TEST(Script, Internal_Name)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue