mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-27 05:00:54 +00:00
AS3 - Compound assignments detection
This commit is contained in:
@@ -41,8 +41,10 @@ import com.jpexs.decompiler.graph.model.FalseItem;
|
||||
import com.jpexs.decompiler.graph.model.LocalData;
|
||||
import com.jpexs.decompiler.graph.model.NotItem;
|
||||
import com.jpexs.decompiler.graph.model.TrueItem;
|
||||
import com.jpexs.helpers.Reference;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@@ -372,7 +374,16 @@ public abstract class GraphTargetItem implements Serializable, Cloneable {
|
||||
}
|
||||
|
||||
public boolean hasSideEffect() {
|
||||
return false;
|
||||
Reference<Boolean> ref = new Reference<>(false);
|
||||
visitRecursively(new AbstractGraphTargetVisitor() {
|
||||
@Override
|
||||
public void visit(GraphTargetItem item) {
|
||||
if (item.hasSideEffect()) {
|
||||
ref.setVal(Boolean.TRUE);
|
||||
}
|
||||
}
|
||||
});
|
||||
return ref.getVal();
|
||||
}
|
||||
|
||||
public boolean isVariableComputed() {
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.␍ */
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.graph.model;
|
||||
|
||||
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
@@ -118,4 +119,10 @@ public class DuplicateItem extends GraphTargetItem implements SimpleValue {
|
||||
public boolean isSimpleValue() {
|
||||
return ((value instanceof SimpleValue) && ((SimpleValue) value).isSimpleValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasSideEffect() {
|
||||
return value.hasSideEffect();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user