Better line start detection

Fixed debug info injection
This commit is contained in:
Jindra Petřík
2015-11-17 09:24:42 +01:00
parent 632e5156c8
commit 4a4e0e4898
547 changed files with 2058 additions and 1911 deletions

View File

@@ -18,6 +18,7 @@ package com.jpexs.decompiler.graph;
import com.jpexs.decompiler.flash.BaseLocalData;
import com.jpexs.decompiler.flash.FinalProcessLocalData;
import com.jpexs.decompiler.flash.abc.avm2.parser.script.Reference;
import com.jpexs.decompiler.flash.action.Action;
import com.jpexs.decompiler.flash.action.model.FunctionActionItem;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
@@ -858,7 +859,7 @@ public class Graph {
} else {
GraphTargetItem lastExpr = whi.expression.remove(whi.expression.size() - 1);
forFirstCommands.addAll(whi.expression);
list.set(i, new ForItem(whi.getSrc(), whi.loop, forFirstCommands, lastExpr, forFinalCommands, whi.commands));
list.set(i, new ForItem(whi.getSrc(), whi.getLineStartItem(), whi.loop, forFirstCommands, lastExpr, forFinalCommands, whi.commands));
}
}
}
@@ -972,10 +973,10 @@ public class Graph {
}
for (Loop l : loops) {
if (l.loopContinue == part) {
return (new ContinueItem(null, l.id));
return (new ContinueItem(null, code.get(part.start), l.id));
}
if (l.loopBreak == part) {
return (new BreakItem(null, l.id));
return (new BreakItem(null, code.get(part.start), l.id));
}
}
return null;
@@ -1298,7 +1299,7 @@ public class Graph {
}
if (isLoop) {
if (currentLoop.loopBreak != null) {
if (currentLoop != null && currentLoop.loopBreak != null) {
currentLoop.phase = 2;
markLevels(path, localData, currentLoop.loopBreak, allParts, loops, stopPart, level, visited, recursionLevel + 1);
}
@@ -1457,7 +1458,7 @@ public class Graph {
l.breakCandidatesLocked--;
}
if (isLoop) {
if (isLoop && currentLoop != null) {
GraphPart found;
Map<GraphPart, Integer> removed = new HashMap<>();
do {
@@ -1541,7 +1542,7 @@ public class Graph {
} else if (count.get(cand) > winnerCount) {
winnerCount = count.get(cand);
winner = cand;
} else if (count.get(cand) == winnerCount) {
} else if (count.get(cand) == winnerCount && winner != null) {
if (cand.path.length() < winner.path.length()) {
winner = cand;
}
@@ -1674,7 +1675,7 @@ public class Graph {
if (debugMode) {
System.err.println("Adding break");
}
ret.add(new BreakItem(null, el.id));
ret.add(new BreakItem(null, localData.lineStartInstruction, el.id));
return ret;
}
if (el.loopPreContinue == part) {
@@ -1684,7 +1685,7 @@ public class Graph {
if (debugMode) {
System.err.println("Adding precontinue");
}
ret.add(new ContinueItem(null, el.id));
ret.add(new ContinueItem(null, localData.lineStartInstruction, el.id));
return ret;
}
if (el.loopContinue == part) {
@@ -1694,7 +1695,7 @@ public class Graph {
if (debugMode) {
System.err.println("Adding continue");
}
ret.add(new ContinueItem(null, el.id));
ret.add(new ContinueItem(null, localData.lineStartInstruction, el.id));
return ret;
}
}
@@ -1709,7 +1710,7 @@ public class Graph {
return ret;
}
if ((part != null) && (code.size() <= part.start)) {
if (code.size() <= part.start) {
ret.add(new ScriptEndItem());
return ret;
}
@@ -1724,9 +1725,9 @@ public class Graph {
if (firstCode.size() > firstCodePos && (firstCode.get(firstCodePos) instanceof LabelItem)) {
labelName = ((LabelItem) firstCode.get(firstCodePos)).labelName;
} else {
firstCode.add(firstCodePos, new LabelItem(null, labelName));
firstCode.add(firstCodePos, new LabelItem(null, localData.lineStartInstruction, labelName));
}
ret.add(new GotoItem(null, labelName));
ret.add(new GotoItem(null, localData.lineStartInstruction, labelName));
return ret;
} else {
visited.add(part);
@@ -1740,7 +1741,7 @@ public class Graph {
//makeAllCommands(currentRet, stack);
stack = (TranslateStack) stack.clone();
stack.clear();
loopItem = new UniversalLoopItem(null, currentLoop);
loopItem = new UniversalLoopItem(null, localData.lineStartInstruction, currentLoop);
//loopItem.commands=printGraph(visited, localData, stack, allParts, parent, part, stopPart, loops);
currentRet.add(loopItem);
loopItem.commands = new ArrayList<>();
@@ -1798,7 +1799,7 @@ public class Graph {
swLoop.phase = 1;
loops.add(swLoop);
boolean first = false;
int pos = 0;
int pos;
Map<Integer, GraphTargetItem> caseExpressions = new HashMap<>();
Map<Integer, GraphTargetItem> caseExpressionLeftSides = new HashMap<>();
@@ -1870,7 +1871,7 @@ public class Graph {
if (caseExpressions.containsKey(pos)) {
caseValues.add(caseExpressions.get(pos));
} else {
caseValues.add(new IntegerValueItem(null, pos));
caseValues.add(new IntegerValueItem(null, localData.lineStartInstruction, pos));
}
pos++;
}
@@ -1939,7 +1940,7 @@ public class Graph {
defaultCommands.remove(defaultCommands.size() - 1);
}
}
SwitchItem sw = new SwitchItem(null, swLoop, switchedItem, caseValues, caseCommands, defaultCommands, valueMappings);
SwitchItem sw = new SwitchItem(null, localData.lineStartInstruction, swLoop, switchedItem, caseValues, caseCommands, defaultCommands, valueMappings);
currentRet.add(sw);
swLoop.phase = 2;
if (next != null) {
@@ -1997,7 +1998,7 @@ public class Graph {
List<GraphTargetItem> filteredOnFalse = filter(onFalse);
if (!isEmpty(filteredOnTrue) && !isEmpty(filteredOnFalse) && filteredOnTrue.size() == 1 && filteredOnFalse.size() == 1 && (filteredOnTrue.get(0) instanceof PushItem) && (filteredOnFalse.get(0) instanceof PushItem)) {
stack.push(new TernarOpItem(null, expr.invert(null), ((PushItem) filteredOnTrue.get(0)).value, ((PushItem) filteredOnFalse.get(0)).value));
stack.push(new TernarOpItem(null, localData.lineStartInstruction, expr.invert(null), ((PushItem) filteredOnTrue.get(0)).value, ((PushItem) filteredOnFalse.get(0)).value));
} else {
boolean isIf = true;
//If the ontrue is empty, switch ontrue and onfalse
@@ -2006,9 +2007,9 @@ public class Graph {
List<GraphTargetItem> tmp = onTrue;
onTrue = onFalse;
onFalse = tmp;
tmp = filteredOnTrue;
//tmp = filteredOnTrue;
filteredOnTrue = filteredOnFalse;
filteredOnFalse = tmp;
//filteredOnFalse = tmp;
}
if (!stack.isEmpty() && ((filteredOnTrue.size() == 1 && (filteredOnTrue.get(0) instanceof PopItem)) || ((filteredOnTrue.size() >= 2) && (filteredOnTrue.get(0) instanceof PopItem) && (filteredOnTrue.get(filteredOnTrue.size() - 1) instanceof PushItem)))) {
if (filteredOnTrue.size() > 1) {
@@ -2018,17 +2019,17 @@ public class Graph {
if (leftSide instanceof DuplicateItem) {
isIf = false;
stack.push(new OrItem(null, prevExpr, rightSide));
stack.push(new OrItem(null, localData.lineStartInstruction, prevExpr, rightSide));
} else if (leftSide.invert(null).getNotCoercedNoDup() instanceof DuplicateItem) {
isIf = false;
stack.push(new AndItem(null, prevExpr, rightSide));
stack.push(new AndItem(null, localData.lineStartInstruction, prevExpr, rightSide));
} else if (prevExpr instanceof FalseItem) {
isIf = false;
leftSide = leftSide.invert(null);
stack.push(new AndItem(null, leftSide, rightSide));
stack.push(new AndItem(null, localData.lineStartInstruction, leftSide, rightSide));
} else if (prevExpr instanceof TrueItem) {
isIf = false;
stack.push(new OrItem(null, leftSide, rightSide));
stack.push(new OrItem(null, localData.lineStartInstruction, leftSide, rightSide));
} else {
//:-(
}
@@ -2039,10 +2040,10 @@ public class Graph {
if (isIf) {
makeAllCommands(currentRet, stack);
IfItem b = new IfItem(null, expr.invert(null), onTrue, onFalse);
IfItem b = new IfItem(null, localData.lineStartInstruction, expr.invert(null), onTrue, onFalse);
currentRet.add(b);
if (processSubBlk(b, null)) {
stack.push(new PopItem(null));
stack.push(new PopItem(null, localData.lineStartInstruction));
}
}
}
@@ -2061,7 +2062,7 @@ public class Graph {
}
}
if (isLoop) {
if (isLoop && loopItem != null && currentLoop != null) {
LoopItem li = loopItem;
boolean loopTypeFound = false;
@@ -2124,7 +2125,7 @@ public class Graph {
if (expr instanceof LogicalOpItem) {
expr = ((LogicalOpItem) expr).invert(null);
} else {
expr = new NotItem(null, expr);
expr = new NotItem(null, expr.getLineStartItem(), expr);
}
}
exprList.add(expr);
@@ -2147,9 +2148,9 @@ public class Graph {
checkContinueAtTheEnd(finalComm, currentLoop);
}
if (!finalComm.isEmpty()) {
ret.add(index, li = new ForItem(expr.getSrc(), currentLoop, new ArrayList<>(), exprList.get(exprList.size() - 1), finalComm, commands));
ret.add(index, li = new ForItem(expr.getSrc(), expr.getLineStartItem(), currentLoop, new ArrayList<>(), exprList.get(exprList.size() - 1), finalComm, commands));
} else {
ret.add(index, li = new WhileItem(expr.getSrc(), currentLoop, exprList, commands));
ret.add(index, li = new WhileItem(expr.getSrc(), expr.getLineStartItem(), currentLoop, exprList, commands));
}
loopTypeFound = true;
@@ -2204,7 +2205,7 @@ public class Graph {
commands.addAll(bodyBranch);
exprList.add(expr);
checkContinueAtTheEnd(commands, currentLoop);
ret.add(index, li = new DoWhileItem(null, currentLoop, commands, exprList));
ret.add(index, li = new DoWhileItem(null, exprList.get(0).getLineStartItem(), currentLoop, commands, exprList));
}
loopTypeFound = true;
@@ -2247,7 +2248,7 @@ public class Graph {
expr = expr.invert(null);
}
exprList.add(expr);
ret.add(index, li = new DoWhileItem(null, currentLoop, loopItem.commands, exprList));
ret.add(index, li = new DoWhileItem(null, expr.getLineStartItem(), currentLoop, loopItem.commands, exprList));
}
}
}

View File

@@ -17,6 +17,7 @@
package com.jpexs.decompiler.graph;
import com.jpexs.decompiler.flash.BaseLocalData;
import com.jpexs.decompiler.flash.abc.avm2.parser.script.Reference;
import com.jpexs.decompiler.flash.action.Action;
import java.io.Serializable;
import java.util.ArrayList;

View File

@@ -38,7 +38,7 @@ public interface GraphSourceItemContainer {
public HashMap<Integer, String> getRegNames();
public void translateContainer(List<List<GraphTargetItem>> contents, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions);
public void translateContainer(List<List<GraphTargetItem>> contents, GraphSourceItem lineStartItem, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions);
public String getName();
}

View File

@@ -84,6 +84,12 @@ public abstract class GraphTargetItem implements Serializable, Cloneable {
private HighlightData srcData;
public GraphSourceItem lineStartItem;
public GraphSourceItem getLineStartItem() {
return lineStartItem;
}
public int getLine() {
if (src != null) {
return src.getLine();
@@ -110,16 +116,16 @@ public abstract class GraphTargetItem implements Serializable, Cloneable {
}
public GraphTargetItem() {
this(null, NOPRECEDENCE);
this(null, null, NOPRECEDENCE);
}
public GraphTargetItem(GraphSourceItem src, int precedence) {
this.src = src;
this.precedence = precedence;
public GraphTargetItem(GraphSourceItem src, GraphSourceItem lineStartItem, int precedence) {
this(src, lineStartItem, precedence, null);
}
public GraphTargetItem(GraphSourceItem src, int precedence, GraphTargetItem value) {
public GraphTargetItem(GraphSourceItem src, GraphSourceItem lineStartItem, int precedence, GraphTargetItem value) {
this.src = src;
this.lineStartItem = lineStartItem;
this.precedence = precedence;
this.value = value;
}
@@ -167,7 +173,7 @@ public abstract class GraphTargetItem implements Serializable, Cloneable {
throw new InterruptedException();
}
writer.startOffset(src, getPos(), srcData);
writer.startOffset(src, getLineStartItem(), getPos(), srcData);
appendTo(writer, localData);
if (needsSemicolon()) {
writer.appendNoHilight(";");
@@ -190,7 +196,7 @@ public abstract class GraphTargetItem implements Serializable, Cloneable {
throw new InterruptedException();
}
writer.startOffset(src, getPos(), srcData);
writer.startOffset(src, getLineStartItem(), getPos(), srcData);
appendTo(writer, localData);
writer.endOffset();
return writer;
@@ -240,7 +246,7 @@ public abstract class GraphTargetItem implements Serializable, Cloneable {
}
public GraphTextWriter toStringNoQuotes(GraphTextWriter writer, LocalData localData) throws InterruptedException {
writer.startOffset(src, getPos(), srcData);
writer.startOffset(src, getLineStartItem(), getPos(), srcData);
appendToNoQuotes(writer, localData);
writer.endOffset();
return writer;
@@ -267,7 +273,7 @@ public abstract class GraphTargetItem implements Serializable, Cloneable {
}
public GraphTextWriter toStringNL(GraphTextWriter writer, LocalData localData) throws InterruptedException {
writer.startOffset(src, getPos(), srcData);
writer.startOffset(src, getLineStartItem(), getPos(), srcData);
appendTo(writer, localData);
if (needsNewLine()) {
writer.newLine();
@@ -358,7 +364,7 @@ public abstract class GraphTargetItem implements Serializable, Cloneable {
}
public GraphTargetItem invert(GraphSourceItem src) {
return new NotItem(src, this);
return new NotItem(src, getLineStartItem(), this);
}
public GraphTextWriter appendBlock(GraphTargetItem prevLineItem, GraphTextWriter writer, LocalData localData, List<GraphTargetItem> commands) throws InterruptedException {

View File

@@ -29,7 +29,7 @@ public class MarkItem extends GraphTargetItem {
private final String mark;
public MarkItem(String mark) {
super(null, NOPRECEDENCE);
super(null, null, NOPRECEDENCE);
this.mark = mark;
}

View File

@@ -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;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
@@ -27,8 +28,8 @@ public class NotCompileTimeItem extends GraphTargetItem {
public GraphTargetItem object;
public NotCompileTimeItem(GraphSourceItem instruction, GraphTargetItem object) {
public NotCompileTimeItem(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem object) {
super(instruction, lineStartIns, NOPRECEDENCE);
this.object = object;
}

View File

@@ -41,7 +41,7 @@ public class TranslateStack extends Stack<GraphTargetItem> {
private PopItem getPop() {
if (pop == null) {
pop = new PopItem(null);
pop = new PopItem(null, null);//TODO: linestart?
}
return pop;

View File

@@ -38,7 +38,7 @@ public class TypeFunctionItem extends GraphTargetItem {
public String fullTypeName;
public TypeFunctionItem(String fullTypeName) {
super(null, NOPRECEDENCE);
super(null, null, NOPRECEDENCE);
this.fullTypeName = fullTypeName;
}
@@ -58,10 +58,7 @@ public class TypeFunctionItem extends GraphTargetItem {
return false;
}
final TypeFunctionItem other = (TypeFunctionItem) obj;
if (!Objects.equals(fullTypeName, other.fullTypeName)) {
return false;
}
return true;
return Objects.equals(fullTypeName, other.fullTypeName);
}
@Override

View File

@@ -51,7 +51,7 @@ public class TypeItem extends GraphTargetItem {
}
public TypeItem(DottedChain fullTypeName, List<GraphTargetItem> subtypes) {
super(null, NOPRECEDENCE);
super(null, null, NOPRECEDENCE);
this.fullTypeName = fullTypeName;
}
@@ -71,10 +71,7 @@ public class TypeItem extends GraphTargetItem {
return false;
}
final TypeItem other = (TypeItem) obj;
if (!Objects.equals(fullTypeName, other.fullTypeName)) {
return false;
}
return true;
return Objects.equals(fullTypeName, other.fullTypeName);
}
@Override

View File

@@ -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;
@@ -34,8 +35,8 @@ public class AndItem extends BinaryOpItem {
return ret;
}
public AndItem(GraphSourceItem src, GraphTargetItem leftSide, GraphTargetItem rightSide) {
public AndItem(GraphSourceItem src, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide) {
super(src, lineStartIns, PRECEDENCE_LOGICALAND, leftSide, rightSide, "&&");
this.leftSide = leftSide;
this.rightSide = rightSide;
}

View File

@@ -43,8 +43,8 @@ public abstract class BinaryOpItem extends GraphTargetItem implements BinaryOp {
return fp;
}
public BinaryOpItem(GraphSourceItem instruction, int precedence, GraphTargetItem leftSide, GraphTargetItem rightSide, String operator) {
super(instruction, precedence);
public BinaryOpItem(GraphSourceItem instruction, GraphSourceItem lineStartItem, int precedence, GraphTargetItem leftSide, GraphTargetItem rightSide, String operator) {
super(instruction, lineStartItem, precedence);
this.leftSide = leftSide;
this.rightSide = rightSide;
this.operator = operator;
@@ -147,10 +147,7 @@ public abstract class BinaryOpItem extends GraphTargetItem implements BinaryOp {
if (!Objects.equals(rightSide, other.rightSide)) {
return false;
}
if (!Objects.equals(operator, other.operator)) {
return false;
}
return true;
return (Objects.equals(operator, other.operator));
}
/*@Override

View File

@@ -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;
@@ -33,8 +34,8 @@ public class BlockItem extends GraphTargetItem {
List<GraphTargetItem> commands;
public BlockItem(GraphSourceItem src, List<GraphTargetItem> commands) {
public BlockItem(GraphSourceItem src, GraphSourceItem lineStartIns, List<GraphTargetItem> commands) {
super(src, lineStartIns, PRECEDENCE_PRIMARY);
this.commands = commands;
}

View File

@@ -36,8 +36,8 @@ public class BreakItem extends GraphTargetItem {
private boolean labelRequired;
public BreakItem(GraphSourceItem src, long loopId) {
super(src, NOPRECEDENCE);
public BreakItem(GraphSourceItem src, GraphSourceItem lineStartIns, long loopId) {
super(src, lineStartIns, NOPRECEDENCE);
this.loopId = loopId;
}

View File

@@ -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;
@@ -32,8 +33,8 @@ public class CommaExpressionItem extends GraphTargetItem {
public List<GraphTargetItem> commands;
public CommaExpressionItem(GraphSourceItem src, List<GraphTargetItem> commands) {
public CommaExpressionItem(GraphSourceItem src, GraphSourceItem lineStartIns, List<GraphTargetItem> commands) {
super(src, lineStartIns, PRECEDENCE_PRIMARY);
this.commands = commands;
}

View File

@@ -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.helpers.GraphTextWriter;
@@ -28,12 +29,12 @@ public class CommentItem extends GraphTargetItem {
private final String[] commentLines;
public CommentItem(String comment) {
public CommentItem(String comment) {
super(null, null, NOPRECEDENCE);
this.commentLines = new String[]{comment};
}
public CommentItem(String[] commentLines) {
public CommentItem(String[] commentLines) {
super(null, null, NOPRECEDENCE);
this.commentLines = commentLines;
}

View File

@@ -36,8 +36,8 @@ public class ContinueItem extends GraphTargetItem {
private boolean labelRequired;
public ContinueItem(GraphSourceItem src, long loopId) {
super(src, NOPRECEDENCE);
public ContinueItem(GraphSourceItem src, GraphSourceItem lineStartIns, long loopId) {
super(src, lineStartIns, NOPRECEDENCE);
this.loopId = loopId;
}

View File

@@ -52,8 +52,8 @@ public class DoWhileItem extends LoopItem implements Block {
return ret;
}
public DoWhileItem(GraphSourceItem src, Loop loop, List<GraphTargetItem> commands, List<GraphTargetItem> expression) {
super(src, loop);
public DoWhileItem(GraphSourceItem src, GraphSourceItem lineStartIns, Loop loop, List<GraphTargetItem> commands, List<GraphTargetItem> expression) {
super(src, lineStartIns, loop);
this.expression = expression;
this.commands = commands;
}

View File

@@ -33,8 +33,8 @@ import java.util.Set;
*/
public class DuplicateItem extends GraphTargetItem implements SimpleValue {
public DuplicateItem(GraphSourceItem src, GraphTargetItem value) {
super(src, value.getPrecedence(), value);
public DuplicateItem(GraphSourceItem src, GraphSourceItem lineStartIns, GraphTargetItem value) {
super(src, lineStartIns, value.getPrecedence(), value);
}
@Override

View File

@@ -32,8 +32,8 @@ import java.util.Set;
*/
public class FalseItem extends GraphTargetItem implements LogicalOpItem, SimpleValue {
public FalseItem(GraphSourceItem src) {
super(src, PRECEDENCE_PRIMARY);
public FalseItem(GraphSourceItem src, GraphSourceItem lineStartIns) {
super(src, lineStartIns, PRECEDENCE_PRIMARY);
}
@Override
@@ -58,7 +58,7 @@ public class FalseItem extends GraphTargetItem implements LogicalOpItem, SimpleV
@Override
public GraphTargetItem invert(GraphSourceItem neqSrc) {
return new TrueItem(null);
return new TrueItem(getSrc(), getLineStartItem());
}
@Override

View File

@@ -57,8 +57,8 @@ public class ForItem extends LoopItem implements Block {
return ret;
}
public ForItem(GraphSourceItem src, Loop loop, List<GraphTargetItem> firstCommands, GraphTargetItem expression, List<GraphTargetItem> finalCommands, List<GraphTargetItem> commands) {
super(src, loop);
public ForItem(GraphSourceItem src, GraphSourceItem lineStartIns, Loop loop, List<GraphTargetItem> firstCommands, GraphTargetItem expression, List<GraphTargetItem> finalCommands, List<GraphTargetItem> commands) {
super(src, lineStartIns, loop);
this.firstCommands = firstCommands;
this.expression = expression;
this.finalCommands = finalCommands;

View File

@@ -29,8 +29,8 @@ public class GotoItem extends GraphTargetItem {
public String labelName;
public GotoItem(GraphSourceItem src, String labelName) {
super(src, PRECEDENCE_PRIMARY);
public GotoItem(GraphSourceItem src, GraphSourceItem lineStartIns, String labelName) {
super(src, lineStartIns, PRECEDENCE_PRIMARY);
this.labelName = labelName;
}

View File

@@ -57,8 +57,8 @@ public class IfItem extends GraphTargetItem implements Block {
return ret;
}
public IfItem(GraphSourceItem src, GraphTargetItem expression, List<GraphTargetItem> onTrue, List<GraphTargetItem> onFalse) {
super(src, NOPRECEDENCE);
public IfItem(GraphSourceItem src, GraphSourceItem lineStartIns, GraphTargetItem expression, List<GraphTargetItem> onTrue, List<GraphTargetItem> onFalse) {
super(src, lineStartIns, NOPRECEDENCE);
this.expression = expression;
this.onTrue = onTrue;
this.onFalse = onFalse;

View File

@@ -30,8 +30,8 @@ public class IntegerValueItem extends GraphTargetItem implements IntegerValueTyp
private final int intValue;
public IntegerValueItem(GraphSourceItem src, int value) {
super(src, PRECEDENCE_PRIMARY);
public IntegerValueItem(GraphSourceItem src, GraphSourceItem lineStartIns, int value) {
super(src, lineStartIns, PRECEDENCE_PRIMARY);
this.intValue = value;
}

View File

@@ -29,8 +29,8 @@ public class LabelItem extends GraphTargetItem {
public String labelName;
public LabelItem(GraphSourceItem src, String labelName) {
super(src, PRECEDENCE_PRIMARY);
public LabelItem(GraphSourceItem src, GraphSourceItem lineStartIns, String labelName) {
super(src, lineStartIns, PRECEDENCE_PRIMARY);
this.labelName = labelName;
}

View File

@@ -24,8 +24,8 @@ public abstract class LoopItem extends GraphTargetItem {
public Loop loop;
public LoopItem(GraphSourceItem src, Loop loop) {
super(src, NOPRECEDENCE);
public LoopItem(GraphSourceItem src, GraphSourceItem lineStartItem, Loop loop) {
super(src, lineStartItem, NOPRECEDENCE);
this.loop = loop;
}
}

View File

@@ -33,8 +33,8 @@ import java.util.Set;
*/
public class NotItem extends UnaryOpItem implements LogicalOpItem, Inverted {
public NotItem(GraphSourceItem instruction, GraphTargetItem value) {
super(instruction, PRECEDENCE_UNARY, value, "!");
public NotItem(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem value) {
super(instruction, lineStartIns, PRECEDENCE_UNARY, value, "!");
}
@Override

View File

@@ -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;
@@ -26,8 +27,8 @@ import java.util.List;
public class OrItem extends BinaryOpItem {
public OrItem(GraphSourceItem src, GraphTargetItem leftSide, GraphTargetItem rightSide) {
public OrItem(GraphSourceItem src, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide) {
super(src, lineStartIns, PRECEDENCE_LOGICALOR, leftSide, rightSide, "||");
this.leftSide = leftSide;
this.rightSide = rightSide;
}

View File

@@ -30,8 +30,8 @@ import java.util.List;
*/
public class ParenthesisItem extends GraphTargetItem {
public ParenthesisItem(GraphSourceItem src, GraphTargetItem value) {
super(src, PRECEDENCE_PRIMARY, value);
public ParenthesisItem(GraphSourceItem src, GraphSourceItem lineStartIns, GraphTargetItem value) {
super(src, lineStartIns, PRECEDENCE_PRIMARY, value);
}
@Override

View File

@@ -28,8 +28,8 @@ import com.jpexs.decompiler.graph.TypeItem;
*/
public class PopItem extends GraphTargetItem {
public PopItem(GraphSourceItem src) {
super(src, PRECEDENCE_PRIMARY);
public PopItem(GraphSourceItem src, GraphSourceItem lineStartIns) {
super(src, lineStartIns, PRECEDENCE_PRIMARY);
}
@Override

View File

@@ -17,6 +17,7 @@
package com.jpexs.decompiler.graph.model;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import com.jpexs.decompiler.graph.GraphSourceItem;
import com.jpexs.decompiler.graph.GraphTargetItem;
/**
@@ -26,7 +27,7 @@ import com.jpexs.decompiler.graph.GraphTargetItem;
public class PushItem extends GraphTargetItem {
public PushItem(GraphTargetItem value) {
super(value.getSrc(), value.getPrecedence(), value);
super(value.getSrc(), value.getLineStartItem(), value.getPrecedence(), value);
}
@Override

View File

@@ -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.helpers.GraphTextWriter;
@@ -26,7 +27,7 @@ import com.jpexs.decompiler.graph.TypeItem;
public class ScriptEndItem extends GraphTargetItem implements ExitItem {
public ScriptEndItem() {
public ScriptEndItem() {
super(null, null, NOPRECEDENCE);
}
@Override

View File

@@ -54,8 +54,8 @@ public class SwitchItem extends LoopItem implements Block {
return ret;
}
public SwitchItem(GraphSourceItem instruction, Loop loop, GraphTargetItem switchedObject, List<GraphTargetItem> caseValues, List<List<GraphTargetItem>> caseCommands, List<GraphTargetItem> defaultCommands, List<Integer> valuesMapping) {
super(instruction, loop);
public SwitchItem(GraphSourceItem instruction, GraphSourceItem lineStartIns, Loop loop, GraphTargetItem switchedObject, List<GraphTargetItem> caseValues, List<List<GraphTargetItem>> caseCommands, List<GraphTargetItem> defaultCommands, List<Integer> valuesMapping) {
super(instruction, lineStartIns, loop);
this.switchedObject = switchedObject;
this.caseValues = caseValues;
this.caseCommands = caseCommands;

View File

@@ -32,8 +32,8 @@ public class TernarOpItem extends GraphTargetItem {
public GraphTargetItem onFalse;
public TernarOpItem(GraphSourceItem src, GraphTargetItem expression, GraphTargetItem onTrue, GraphTargetItem onFalse) {
super(src, PRECEDENCE_CONDITIONAL);
public TernarOpItem(GraphSourceItem src, GraphSourceItem lineStartIns, GraphTargetItem expression, GraphTargetItem onTrue, GraphTargetItem onFalse) {
super(src, lineStartIns, PRECEDENCE_CONDITIONAL);
this.expression = expression;
this.onTrue = onTrue;
this.onFalse = onFalse;

View File

@@ -33,8 +33,8 @@ import java.util.Set;
*/
public class TrueItem extends GraphTargetItem implements LogicalOpItem, SimpleValue {
public TrueItem(GraphSourceItem src) {
super(src, PRECEDENCE_PRIMARY);
public TrueItem(GraphSourceItem src, GraphSourceItem lineStartIns) {
super(src, lineStartIns, PRECEDENCE_PRIMARY);
}
@Override
@@ -59,7 +59,7 @@ public class TrueItem extends GraphTargetItem implements LogicalOpItem, SimpleVa
@Override
public GraphTargetItem invert(GraphSourceItem neqSrc) {
return new FalseItem(null);
return new FalseItem(getSrc(), getLineStartItem());
}
@Override

View File

@@ -27,8 +27,8 @@ public abstract class UnaryOpItem extends GraphTargetItem implements UnaryOp {
public String operator;
public UnaryOpItem(GraphSourceItem instruction, int precedence, GraphTargetItem value, String operator) {
super(instruction, precedence, value);
public UnaryOpItem(GraphSourceItem instruction, GraphSourceItem lineStartItem, int precedence, GraphTargetItem value, String operator) {
super(instruction, lineStartItem, precedence, value);
this.operator = operator;
}

View File

@@ -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.abc.avm2.model.AVM2Item;
@@ -26,7 +27,7 @@ import com.jpexs.decompiler.graph.GraphTargetItem;
public class UnboundedTypeItem extends AVM2Item {
public UnboundedTypeItem() {
public UnboundedTypeItem() {
super(null, null, NOPRECEDENCE);
}
@Override

View File

@@ -37,8 +37,8 @@ public class UniversalLoopItem extends LoopItem implements Block {
private boolean labelUsed;
public UniversalLoopItem(GraphSourceItem src, Loop loop) {
super(src, loop);
public UniversalLoopItem(GraphSourceItem src, GraphSourceItem lineStartIns, Loop loop) {
super(src, lineStartIns, loop);
}
@Override

View File

@@ -47,8 +47,8 @@ public class WhileItem extends LoopItem implements Block {
return ret;
}
public WhileItem(GraphSourceItem src, Loop loop, List<GraphTargetItem> expression, List<GraphTargetItem> commands) {
super(src, loop);
public WhileItem(GraphSourceItem src, GraphSourceItem lineStartIns, Loop loop, List<GraphTargetItem> expression, List<GraphTargetItem> commands) {
super(src, lineStartIns, loop);
this.expression = expression;
this.commands = commands;
}