Merge branch 'v6'

Conflicts:
	libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ABC.java
	libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScriptLexer.java
	libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/SymbolType.java
	libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/InstanceInfo.java
	libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/Trait.java
	libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/Action.java
	libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionGraph.java
	libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionListReader.java
	libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/script/ActionSourceGenerator.java
	libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/script/SymbolType.java
	libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf6/ActionEnumerate2.java
	libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/GraphSourceItem.java
	libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/GraphTargetItem.java
	libsrc/ffdec_lib/src/com/jpexs/helpers/Helper.java
	libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript2Test.java
	src/com/jpexs/decompiler/flash/gui/Main.java
	src/com/jpexs/decompiler/flash/gui/abc/UsageFrame.java
This commit is contained in:
Jindra Petřík
2015-07-03 19:06:09 +02:00
150 changed files with 8061 additions and 6047 deletions
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library 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
* 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;
@@ -20,6 +21,7 @@ import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import com.jpexs.decompiler.graph.CompilationException;
import com.jpexs.decompiler.graph.GraphSourceItem;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.SimpleValue;
import com.jpexs.decompiler.graph.SourceGenerator;
import com.jpexs.decompiler.graph.TypeItem;
import java.util.List;
@@ -29,7 +31,7 @@ import java.util.Set;
*
* @author JPEXS
*/
public class DuplicateItem extends GraphTargetItem {
public class DuplicateItem extends GraphTargetItem implements SimpleValue {
public DuplicateItem(GraphSourceItem src, GraphTargetItem value) {
super(src, value.getPrecedence());
@@ -43,7 +45,12 @@ public class DuplicateItem extends GraphTargetItem {
@Override
public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException {
return value.toString(writer, localData);
if ((value instanceof SimpleValue) && (((SimpleValue) value).isSimpleValue())) {
return value.appendTo(writer, localData);
}
writer.append("§§dup(");
value.appendTo(writer, localData);
return writer.append(")");
}
@Override
@@ -89,4 +96,14 @@ public class DuplicateItem extends GraphTargetItem {
public GraphTargetItem returnType() {
return TypeItem.UNBOUNDED;
}
/*@Override
public GraphTargetItem invert(GraphSourceItem src) {
return //new DuplicateItem(src, value instanceof NotItem ? (value.value) : new NotItem(src, value));
}*/
@Override
public boolean isSimpleValue() {
return ((value instanceof SimpleValue) && ((SimpleValue) value).isSimpleValue());
}
}
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library 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
* 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;
/**
@@ -0,0 +1,78 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. */
package com.jpexs.decompiler.graph.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import com.jpexs.decompiler.graph.CompilationException;
import com.jpexs.decompiler.graph.GraphSourceItem;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.SimpleValue;
import com.jpexs.decompiler.graph.SourceGenerator;
import com.jpexs.decompiler.graph.TypeItem;
import java.util.List;
/**
*
* @author JPEXS
*/
public class FalseItem extends GraphTargetItem implements LogicalOpItem, SimpleValue {
public FalseItem(GraphSourceItem src) {
super(src, PRECEDENCE_PRIMARY);
}
@Override
public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) {
return writer.append("false");
}
@Override
public boolean hasReturnValue() {
return true;
}
@Override
public GraphTargetItem returnType() {
return TypeItem.BOOLEAN;
}
@Override
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return generator.generate(localData, this);
}
@Override
public GraphTargetItem invert(GraphSourceItem neqSrc) {
return new TrueItem(null);
}
@Override
public boolean isSimpleValue() {
return true;
}
@Override
public boolean isCompileTime() {
return true;
}
@Override
public Object getResult() {
return Boolean.FALSE;
}
}
@@ -0,0 +1,59 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
*/
package com.jpexs.decompiler.graph.model;
import com.jpexs.decompiler.flash.ecma.Null;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import com.jpexs.decompiler.graph.GraphSourceItem;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TypeItem;
/**
*
* @author JPEXS
*/
public class GotoItem extends GraphTargetItem {
public String labelName;
public GotoItem(GraphSourceItem src, String labelName) {
super(src, PRECEDENCE_PRIMARY);
this.labelName = labelName;
}
@Override
public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException {
writer.append("§§goto(" + labelName + ")");
return writer;
}
@Override
public boolean hasReturnValue() {
return false;
}
@Override
public GraphTargetItem returnType() {
return TypeItem.UNBOUNDED;
}
@Override
public Object getResult() {
return null;
}
}
@@ -75,11 +75,7 @@ public class IfItem extends GraphTargetItem implements Block {
expr = ((NotItem) expr).getOriginal();
}
} else {
if (expr instanceof LogicalOpItem) {
expr = ((LogicalOpItem) expr).invert();
} else {
expr = new NotItem(null, expr);
}
expr = expr.invert(null);
ifBranch = onFalse;
elseBranch = onTrue;
}
@@ -112,7 +108,10 @@ public class IfItem extends GraphTargetItem implements Block {
}
for (GraphTargetItem ti : elseBranch) {
if (!ti.isEmpty()) {
ti.toStringSemicoloned(writer, localData).newLine();
ti.toStringSemicoloned(writer, localData);
if (!elseIf) {
writer.newLine();
}
}
}
if (!elseIf) {
@@ -0,0 +1,69 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
*/
package com.jpexs.decompiler.graph.model;
import com.jpexs.decompiler.flash.ecma.Null;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import com.jpexs.decompiler.graph.GraphSourceItem;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TypeItem;
/**
*
* @author JPEXS
*/
public class LabelItem extends GraphTargetItem {
public String labelName;
public LabelItem(GraphSourceItem src, String labelName) {
super(src, PRECEDENCE_PRIMARY);
this.labelName = labelName;
}
@Override
public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException {
writer.append(labelName + ":");
return writer;
}
@Override
public boolean needsNewLine() {
return false;
}
@Override
public boolean needsSemicolon() {
return false;
}
@Override
public boolean hasReturnValue() {
return false;
}
@Override
public GraphTargetItem returnType() {
return TypeItem.UNBOUNDED;
}
@Override
public Object getResult() {
return null;
}
}
@@ -12,9 +12,11 @@
* 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.graph.GraphSourceItem;
import com.jpexs.decompiler.graph.GraphTargetItem;
/**
@@ -23,5 +25,5 @@ import com.jpexs.decompiler.graph.GraphTargetItem;
*/
public interface LogicalOpItem {
public GraphTargetItem invert();
public GraphTargetItem invert(GraphSourceItem src);
}
@@ -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;
@@ -57,11 +58,6 @@ public class NotItem extends UnaryOpItem implements LogicalOpItem, Inverted {
return value.isCompileTime(dependencies);
}
@Override
public GraphTargetItem invert() {
return value;
}
public GraphTargetItem getOriginal() {
return value;
}
@@ -80,4 +76,10 @@ public class NotItem extends UnaryOpItem implements LogicalOpItem, Inverted {
public GraphTargetItem returnType() {
return TypeItem.BOOLEAN;
}
@Override
public GraphTargetItem invert(GraphSourceItem src) {
return value;
}
}
@@ -0,0 +1,57 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
*/
package com.jpexs.decompiler.graph.model;
import com.jpexs.decompiler.flash.ecma.Null;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import com.jpexs.decompiler.graph.GraphSourceItem;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TypeItem;
/**
*
* @author JPEXS
*/
public class PopItem extends GraphTargetItem {
public PopItem(GraphSourceItem src) {
super(src, PRECEDENCE_PRIMARY);
}
@Override
public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException {
//Logger.getLogger(PopItem.class.getName()).log(Level.WARNING, "Pop item left in the source code");
writer.append("§§pop()");
return writer;
}
@Override
public boolean hasReturnValue() {
return true;
}
@Override
public GraphTargetItem returnType() {
return TypeItem.UNBOUNDED;
}
@Override
public Object getResult() {
return new Null();
}
}
@@ -0,0 +1,67 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
*/
package com.jpexs.decompiler.graph.model;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import com.jpexs.decompiler.graph.GraphTargetItem;
/**
*
* @author JPEXS
*/
public class PushItem extends GraphTargetItem {
public PushItem(GraphTargetItem val) {
super(val.src, val.getPrecedence());
this.value = val;
}
@Override
public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException {
//Logger.getLogger(PushItem.class.getName()).log(Level.WARNING, "Push item left in the source code");
writer.append("§§push(");
value.appendTo(writer, localData);
writer.append(")");
return writer;
}
@Override
public boolean hasReturnValue() {
return true;
}
@Override
public GraphTargetItem returnType() {
return value.returnType();
}
@Override
public GraphTargetItem getNotCoerced() {
return value.getNotCoerced();
}
@Override
public GraphTargetItem getThroughDuplicate() {
return value.getThroughDuplicate();
}
@Override
public GraphTargetItem getThroughRegister() {
return value.getThroughRegister();
}
}
@@ -1,30 +1,36 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library 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
* 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;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import com.jpexs.decompiler.graph.CompilationException;
import com.jpexs.decompiler.graph.GraphSourceItem;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.SimpleValue;
import com.jpexs.decompiler.graph.SourceGenerator;
import com.jpexs.decompiler.graph.TypeItem;
import java.util.List;
/**
*
* @author JPEXS
*/
public class TrueItem extends GraphTargetItem {
public class TrueItem extends GraphTargetItem implements LogicalOpItem, SimpleValue {
public TrueItem(GraphSourceItem src) {
super(src, PRECEDENCE_PRIMARY);
@@ -44,4 +50,30 @@ public class TrueItem extends GraphTargetItem {
public GraphTargetItem returnType() {
return TypeItem.BOOLEAN;
}
@Override
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return generator.generate(localData, this);
}
@Override
public GraphTargetItem invert(GraphSourceItem neqSrc) {
return new FalseItem(null);
}
@Override
public boolean isSimpleValue() {
return true;
}
@Override
public boolean isCompileTime() {
return true;
}
@Override
public Object getResult() {
return Boolean.TRUE;
}
}
@@ -25,8 +25,6 @@ import java.util.Set;
public abstract class UnaryOpItem extends GraphTargetItem implements UnaryOp {
public GraphTargetItem value;
public String operator;
public UnaryOpItem(GraphSourceItem instruction, int precedence, GraphTargetItem value, String operator) {