mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-27 12:00:53 +00:00
Issue #258 AS1/2 chained assignments
AS1/2 Detecting temporary registers assignment spaces
This commit is contained in:
@@ -42,7 +42,7 @@ public class DecrementActionItem extends ActionItem {
|
||||
|
||||
@Override
|
||||
public String toString(ConstantPool constants) {
|
||||
return object.toString(constants) + hilight("-1");
|
||||
return object.toString(constants) + hilight(" - 1");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -34,6 +34,9 @@ public class DefineLocalActionItem extends ActionItem implements SetTypeActionIt
|
||||
public List<GraphTargetItem> getAllSubItems() {
|
||||
List<GraphTargetItem> ret = new ArrayList<>();
|
||||
ret.add(name);
|
||||
if (value != null) {
|
||||
ret.add(value);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ public class IncrementActionItem extends ActionItem {
|
||||
|
||||
@Override
|
||||
public String toString(ConstantPool constants) {
|
||||
return object.toString(constants) + hilight("+1");
|
||||
return object.toString(constants) + hilight(" + 1");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -79,9 +79,9 @@ public class SetMemberActionItem extends ActionItem implements SetTypeActionItem
|
||||
public String toString(ConstantPool constants) {
|
||||
if (!((objectName instanceof DirectValueActionItem) && (((DirectValueActionItem) objectName).value instanceof String))) {
|
||||
//if(!(functionName instanceof GetVariableActionItem))
|
||||
return object.toString(constants) + "[" + stripQuotes(objectName, constants) + "]" + "=" + value.toString(constants);
|
||||
return object.toString(constants) + "[" + stripQuotes(objectName, constants) + "]" + " = " + value.toString(constants);
|
||||
}
|
||||
return object.toString(constants) + "." + stripQuotes(objectName, constants) + "=" + value.toString(constants);
|
||||
return object.toString(constants) + "." + stripQuotes(objectName, constants) + " = " + value.toString(constants);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -70,9 +70,9 @@ public class SetPropertyActionItem extends ActionItem implements SetTypeActionIt
|
||||
@Override
|
||||
public String toString(ConstantPool constants) {
|
||||
if (isEmptyString(target)) {
|
||||
return hilight(Action.propertyNames[propertyIndex] + "=") + value.toString(constants);
|
||||
return hilight(Action.propertyNames[propertyIndex] + " = ") + value.toString(constants);
|
||||
}
|
||||
return target.toString(constants) + hilight("." + Action.propertyNames[propertyIndex] + "=") + value.toString(constants);
|
||||
return target.toString(constants) + hilight("." + Action.propertyNames[propertyIndex] + " = ") + value.toString(constants);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -67,7 +67,7 @@ public class SetVariableActionItem extends ActionItem implements SetTypeActionIt
|
||||
@Override
|
||||
public String toString(ConstantPool constants) {
|
||||
if (name instanceof DirectValueActionItem || name instanceof GetVariableActionItem) {
|
||||
return stripQuotes(name, constants) + hilight("=") + value.toString(constants);
|
||||
return stripQuotes(name, constants) + hilight(" = ") + value.toString(constants);
|
||||
} else {
|
||||
return hilight("set(") + name.toString(constants) + hilight(",") + value.toString(constants) + hilight(")");
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ public class StoreRegisterActionItem extends ActionItem implements SetTypeAction
|
||||
|
||||
@Override
|
||||
public String toString(ConstantPool constants) {
|
||||
return (define ? hilight("var ") : "") + hilight(register.translate() + "=") + value.toString(constants);
|
||||
return (define ? hilight("var ") : "") + hilight(register.translate() + " = ") + value.toString(constants);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (C) 2013 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.action.model;
|
||||
|
||||
import com.jpexs.decompiler.graph.GraphSourceItemPos;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class TemporaryRegister extends GraphTargetItem {
|
||||
|
||||
public TemporaryRegister(GraphTargetItem value) {
|
||||
super(value.src, value.precedence);
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(List<Object> localData) {
|
||||
return value.toString(localData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasReturnValue() {
|
||||
return value.hasReturnValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getResult() {
|
||||
return value.getResult();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GraphTargetItem> getAllSubItems() {
|
||||
return value.getAllSubItems();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItemPos> getNeededSources() {
|
||||
return value.getNeededSources();
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphTargetItem getNotCoerced() {
|
||||
return value.getNotCoerced();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user