Compound assignments inside expressions

This commit is contained in:
Jindra Petřík
2021-03-12 22:12:39 +01:00
parent 8fa321cfd3
commit 570b0f976a
5 changed files with 18 additions and 10 deletions
@@ -125,8 +125,8 @@ public abstract class SetLocalTypeIns extends InstructionDefinition implements S
}
SetLocalAVM2Item result = new SetLocalAVM2Item(ins, localData.lineStartInstruction, regId, value);
if (value.getNotCoercedNoDup() instanceof CompoundableBinaryOp) {
CompoundableBinaryOp binaryOp = (CompoundableBinaryOp) value.getNotCoercedNoDup();
if (value.getNotCoerced() instanceof CompoundableBinaryOp) {
CompoundableBinaryOp binaryOp = (CompoundableBinaryOp) value.getNotCoerced();
if (binaryOp.getLeftSide() instanceof LocalRegAVM2Item) {
LocalRegAVM2Item loc = (LocalRegAVM2Item) binaryOp.getLeftSide();
if (loc.regIndex == regId) {
@@ -376,9 +376,9 @@ public class SetPropertyIns extends InstructionDefinition implements SetTypeIns
}
}
if (value.getNotCoercedNoDup() instanceof CompoundableBinaryOp) {
if (value.getNotCoerced() instanceof CompoundableBinaryOp) {
if (!obj.hasSideEffect() && !multiname.hasSideEffect()) {
CompoundableBinaryOp binaryOp = (CompoundableBinaryOp) value.getNotCoercedNoDup();
CompoundableBinaryOp binaryOp = (CompoundableBinaryOp) value.getNotCoerced();
if (binaryOp.getLeftSide() instanceof GetPropertyAVM2Item) {
GetPropertyAVM2Item propItem = (GetPropertyAVM2Item) binaryOp.getLeftSide();
if (Objects.equals(obj, propItem.object.getThroughDuplicate()) && Objects.equals(multiname, propItem.propertyName)) {
@@ -144,9 +144,9 @@ public class SetSlotIns extends InstructionDefinition implements SetTypeIns {
SetSlotAVM2Item result = new SetSlotAVM2Item(ins, localData.lineStartInstruction, obj, objnoreg, slotIndex, slotname, value);
if (value.getNotCoercedNoDup() instanceof CompoundableBinaryOp) {
if (value.getNotCoerced() instanceof CompoundableBinaryOp) {
if (!obj.hasSideEffect()) {
CompoundableBinaryOp binaryOp = (CompoundableBinaryOp) value.getNotCoercedNoDup();
CompoundableBinaryOp binaryOp = (CompoundableBinaryOp) value.getNotCoerced();
if (binaryOp.getLeftSide() instanceof GetSlotAVM2Item) {
GetSlotAVM2Item getSlot = (GetSlotAVM2Item) binaryOp.getLeftSide();
if (Objects.equals(obj, getSlot.scope.getThroughDuplicate()) && slotIndex == getSlot.slotIndex) {