mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-27 02:10:44 +00:00
More documentation.
This commit is contained in:
@@ -41,6 +41,13 @@ public class AndItem extends BinaryOpItem implements CompoundableBinaryOp {
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param src Source
|
||||
* @param lineStartIns Line start instruction
|
||||
* @param leftSide Left side
|
||||
* @param rightSide Right side
|
||||
*/
|
||||
public AndItem(GraphSourceItem src, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide) {
|
||||
super(src, lineStartIns, PRECEDENCE_LOGICALAND, leftSide, rightSide, "&&", "Boolean", "Boolean");
|
||||
this.leftSide = leftSide;
|
||||
|
||||
@@ -27,19 +27,51 @@ import java.util.List;
|
||||
*/
|
||||
public interface BinaryOp {
|
||||
|
||||
/**
|
||||
* Gets left side.
|
||||
* @return Left side
|
||||
*/
|
||||
public GraphTargetItem getLeftSide();
|
||||
|
||||
/**
|
||||
* Gets right side.
|
||||
* @return Right side
|
||||
*/
|
||||
public GraphTargetItem getRightSide();
|
||||
|
||||
/**
|
||||
* Sets left side.
|
||||
* @param value Left side
|
||||
*/
|
||||
public void setLeftSide(GraphTargetItem value);
|
||||
|
||||
/**
|
||||
* Sets right side.
|
||||
* @param value Right side
|
||||
*/
|
||||
public void setRightSide(GraphTargetItem value);
|
||||
|
||||
/**
|
||||
* Gets precedence.
|
||||
* @return Precedence
|
||||
*/
|
||||
public int getPrecedence();
|
||||
|
||||
/**
|
||||
* Gets all sub items.
|
||||
* @return All sub items
|
||||
*/
|
||||
public List<GraphTargetItem> getAllSubItems();
|
||||
|
||||
/**
|
||||
* Gets operator.
|
||||
* @return Operator
|
||||
*/
|
||||
public String getOperator();
|
||||
|
||||
/**
|
||||
* Gets operator instruction.
|
||||
* @return Operator instruction
|
||||
*/
|
||||
public List<GraphSourceItem> getOperatorInstruction();
|
||||
}
|
||||
|
||||
@@ -34,13 +34,29 @@ import java.util.Set;
|
||||
*/
|
||||
public abstract class BinaryOpItem extends GraphTargetItem implements BinaryOp {
|
||||
|
||||
/**
|
||||
* Left side of the operation
|
||||
*/
|
||||
public GraphTargetItem leftSide;
|
||||
|
||||
/**
|
||||
* Right side of the operation
|
||||
*/
|
||||
public GraphTargetItem rightSide;
|
||||
|
||||
/**
|
||||
* Operator
|
||||
*/
|
||||
protected final String operator;
|
||||
|
||||
/**
|
||||
* Coerce left side to this type
|
||||
*/
|
||||
protected String coerceLeft;
|
||||
|
||||
/**
|
||||
* Coerce right side to this type
|
||||
*/
|
||||
protected String coerceRight;
|
||||
|
||||
@Override
|
||||
@@ -52,6 +68,18 @@ public abstract class BinaryOpItem extends GraphTargetItem implements BinaryOp {
|
||||
return fp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param instruction Instruction
|
||||
* @param lineStartItem Line start item
|
||||
* @param precedence Precedence
|
||||
* @param leftSide Left side
|
||||
* @param rightSide Right side
|
||||
* @param operator Operator
|
||||
* @param coerceLeft Coerce left
|
||||
* @param coerceRight Coerce right
|
||||
*/
|
||||
public BinaryOpItem(GraphSourceItem instruction, GraphSourceItem lineStartItem, int precedence, GraphTargetItem leftSide, GraphTargetItem rightSide, String operator, String coerceLeft, String coerceRight) {
|
||||
super(instruction, lineStartItem, precedence);
|
||||
this.leftSide = leftSide;
|
||||
@@ -95,6 +123,14 @@ public abstract class BinaryOpItem extends GraphTargetItem implements BinaryOp {
|
||||
return writer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts operand to string
|
||||
*
|
||||
* @param operand Operand
|
||||
* @param writer Writer
|
||||
* @param localData Local data
|
||||
* @throws InterruptedException On interrupt
|
||||
*/
|
||||
protected void operandToString(GraphTargetItem operand, GraphTextWriter writer, LocalData localData) throws InterruptedException {
|
||||
operand.toString(writer, localData, "");
|
||||
}
|
||||
@@ -143,6 +179,12 @@ public abstract class BinaryOpItem extends GraphTargetItem implements BinaryOp {
|
||||
return hash;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets left most item
|
||||
*
|
||||
* @param item Item
|
||||
* @return Left most item
|
||||
*/
|
||||
public GraphTargetItem getLeftMostItem(GraphTargetItem item) {
|
||||
GraphTargetItem ret = item;
|
||||
if (ret instanceof BinaryOpItem) {
|
||||
@@ -151,6 +193,11 @@ public abstract class BinaryOpItem extends GraphTargetItem implements BinaryOp {
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets left most item
|
||||
*
|
||||
* @return Left most item
|
||||
*/
|
||||
public GraphTargetItem getLeftMostItem() {
|
||||
GraphTargetItem ret = leftSide;
|
||||
if (ret instanceof BinaryOpItem) {
|
||||
|
||||
@@ -34,8 +34,18 @@ import java.util.List;
|
||||
*/
|
||||
public class BlockItem extends GraphTargetItem {
|
||||
|
||||
/**
|
||||
* Commands
|
||||
*/
|
||||
List<GraphTargetItem> commands;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param src Source
|
||||
* @param lineStartIns Line start instruction
|
||||
* @param commands Commands
|
||||
*/
|
||||
public BlockItem(GraphSourceItem src, GraphSourceItem lineStartIns, List<GraphTargetItem> commands) {
|
||||
super(src, lineStartIns, PRECEDENCE_PRIMARY);
|
||||
this.commands = commands;
|
||||
|
||||
@@ -33,10 +33,23 @@ import java.util.List;
|
||||
*/
|
||||
public class BreakItem extends GraphTargetItem {
|
||||
|
||||
/**
|
||||
* Loop id
|
||||
*/
|
||||
public long loopId;
|
||||
|
||||
/**
|
||||
* Label required
|
||||
*/
|
||||
private boolean labelRequired;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param src Source item
|
||||
* @param lineStartIns Line start instruction
|
||||
* @param loopId Loop id
|
||||
*/
|
||||
public BreakItem(GraphSourceItem src, GraphSourceItem lineStartIns, long loopId) {
|
||||
super(src, lineStartIns, NOPRECEDENCE);
|
||||
this.loopId = loopId;
|
||||
|
||||
@@ -25,7 +25,18 @@ import java.util.List;
|
||||
*/
|
||||
public interface Callable {
|
||||
|
||||
/**
|
||||
* Call a method with a name and arguments.
|
||||
* @param methodName Method name
|
||||
* @param args Arguments
|
||||
* @return Result of the method call
|
||||
*/
|
||||
public Object call(String methodName, List<Object> args);
|
||||
|
||||
/**
|
||||
* Call with arguments.
|
||||
* @param args Arguments
|
||||
* @return Result of the call
|
||||
*/
|
||||
public Object call(List<Object> args);
|
||||
}
|
||||
|
||||
@@ -33,8 +33,18 @@ import java.util.List;
|
||||
*/
|
||||
public class CommaExpressionItem extends GraphTargetItem {
|
||||
|
||||
/**
|
||||
* Commands
|
||||
*/
|
||||
public List<GraphTargetItem> commands;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param src Source
|
||||
* @param lineStartIns Line start instruction
|
||||
* @param commands Commands
|
||||
*/
|
||||
public CommaExpressionItem(GraphSourceItem src, GraphSourceItem lineStartIns, List<GraphTargetItem> commands) {
|
||||
super(src, lineStartIns, PRECEDENCE_COMMA);
|
||||
this.commands = commands;
|
||||
|
||||
@@ -27,13 +27,24 @@ import com.jpexs.decompiler.graph.TypeItem;
|
||||
*/
|
||||
public class CommentItem extends GraphTargetItem {
|
||||
|
||||
/**
|
||||
* Comment lines.
|
||||
*/
|
||||
private final String[] commentLines;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param comment Comment
|
||||
*/
|
||||
public CommentItem(String comment) {
|
||||
super(null, null, NOPRECEDENCE);
|
||||
this.commentLines = new String[]{comment};
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param commentLines Comment lines
|
||||
*/
|
||||
public CommentItem(String[] commentLines) {
|
||||
super(null, null, NOPRECEDENCE);
|
||||
this.commentLines = commentLines;
|
||||
@@ -54,6 +65,10 @@ public class CommentItem extends GraphTargetItem {
|
||||
return writer.append(" */");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets comment lines.
|
||||
* @return Comment lines
|
||||
*/
|
||||
public String[] getCommentLines() {
|
||||
return commentLines;
|
||||
}
|
||||
|
||||
@@ -33,10 +33,23 @@ import java.util.List;
|
||||
*/
|
||||
public class ContinueItem extends GraphTargetItem {
|
||||
|
||||
/**
|
||||
* Loop id
|
||||
*/
|
||||
public long loopId;
|
||||
|
||||
/**
|
||||
* Label required
|
||||
*/
|
||||
private boolean labelRequired;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param src Source item
|
||||
* @param lineStartIns Line start instruction
|
||||
* @param loopId Loop id
|
||||
*/
|
||||
public ContinueItem(GraphSourceItem src, GraphSourceItem lineStartIns, long loopId) {
|
||||
super(src, lineStartIns, NOPRECEDENCE);
|
||||
this.loopId = loopId;
|
||||
|
||||
@@ -38,10 +38,19 @@ import java.util.List;
|
||||
*/
|
||||
public class DoWhileItem extends LoopItem implements Block {
|
||||
|
||||
/**
|
||||
* Commands
|
||||
*/
|
||||
public List<GraphTargetItem> commands;
|
||||
|
||||
/**
|
||||
* Expression
|
||||
*/
|
||||
public List<GraphTargetItem> expression;
|
||||
|
||||
/**
|
||||
* Label used
|
||||
*/
|
||||
private boolean labelUsed;
|
||||
|
||||
@Override
|
||||
@@ -78,6 +87,15 @@ public class DoWhileItem extends LoopItem implements Block {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param src Source
|
||||
* @param lineStartIns Line start instruction
|
||||
* @param loop Loop
|
||||
* @param commands Commands
|
||||
* @param expression Expression
|
||||
*/
|
||||
public DoWhileItem(GraphSourceItem src, GraphSourceItem lineStartIns, Loop loop, List<GraphTargetItem> commands, List<GraphTargetItem> expression) {
|
||||
super(src, lineStartIns, loop);
|
||||
this.expression = expression;
|
||||
|
||||
@@ -34,6 +34,12 @@ import java.util.Set;
|
||||
*/
|
||||
public class DuplicateItem extends GraphTargetItem implements SimpleValue {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param src Source
|
||||
* @param lineStartIns Line start item
|
||||
* @param value Value
|
||||
*/
|
||||
public DuplicateItem(GraphSourceItem src, GraphSourceItem lineStartIns, GraphTargetItem value) {
|
||||
super(src, lineStartIns, value.getPrecedence(), value);
|
||||
}
|
||||
|
||||
@@ -34,6 +34,11 @@ import java.util.Set;
|
||||
*/
|
||||
public class FalseItem extends GraphTargetItem implements LogicalOpItem, SimpleValue {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param src Source
|
||||
* @param lineStartIns Line start instruction
|
||||
*/
|
||||
public FalseItem(GraphSourceItem src, GraphSourceItem lineStartIns) {
|
||||
super(src, lineStartIns, PRECEDENCE_PRIMARY);
|
||||
}
|
||||
|
||||
@@ -38,14 +38,29 @@ import java.util.List;
|
||||
*/
|
||||
public class ForItem extends LoopItem implements Block {
|
||||
|
||||
/**
|
||||
* First commands
|
||||
*/
|
||||
public List<GraphTargetItem> firstCommands;
|
||||
|
||||
/**
|
||||
* Expression
|
||||
*/
|
||||
public GraphTargetItem expression;
|
||||
|
||||
/**
|
||||
* Final commands
|
||||
*/
|
||||
public List<GraphTargetItem> finalCommands;
|
||||
|
||||
/**
|
||||
* Commands
|
||||
*/
|
||||
public List<GraphTargetItem> commands;
|
||||
|
||||
/**
|
||||
* Label used
|
||||
*/
|
||||
private boolean labelUsed;
|
||||
|
||||
@Override
|
||||
@@ -82,6 +97,17 @@ public class ForItem extends LoopItem implements Block {
|
||||
visitor.visit(expression);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param src Source
|
||||
* @param lineStartIns Line start instruction
|
||||
* @param loop Loop
|
||||
* @param firstCommands First commands
|
||||
* @param expression Expression
|
||||
* @param finalCommands Final commands
|
||||
* @param commands Commands
|
||||
*/
|
||||
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;
|
||||
|
||||
@@ -32,10 +32,23 @@ import java.util.List;
|
||||
*/
|
||||
public class GotoItem extends GraphTargetItem implements Block {
|
||||
|
||||
/**
|
||||
* Label name
|
||||
*/
|
||||
public String labelName;
|
||||
|
||||
/**
|
||||
* Target commands
|
||||
*/
|
||||
public List<GraphTargetItem> targetCommands = null;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param src Source
|
||||
* @param lineStartIns Line start instruction
|
||||
* @param labelName Label name
|
||||
*/
|
||||
public GotoItem(GraphSourceItem src, GraphSourceItem lineStartIns, String labelName) {
|
||||
super(src, lineStartIns, PRECEDENCE_PRIMARY);
|
||||
this.labelName = labelName;
|
||||
|
||||
@@ -38,14 +38,34 @@ import java.util.Set;
|
||||
*/
|
||||
public class IfItem extends GraphTargetItem implements Block {
|
||||
|
||||
/**
|
||||
* Expression
|
||||
*/
|
||||
public GraphTargetItem expression;
|
||||
|
||||
/**
|
||||
* On true
|
||||
*/
|
||||
public List<GraphTargetItem> onTrue;
|
||||
|
||||
/**
|
||||
* On false
|
||||
*/
|
||||
public List<GraphTargetItem> onFalse;
|
||||
|
||||
/**
|
||||
* Decision part
|
||||
*/
|
||||
public GraphPart decisionPart;
|
||||
|
||||
/**
|
||||
* On true part
|
||||
*/
|
||||
public GraphPart onTruePart;
|
||||
|
||||
/**
|
||||
* On false part
|
||||
*/
|
||||
public GraphPart onFalsePart;
|
||||
|
||||
@Override
|
||||
@@ -87,6 +107,15 @@ public class IfItem extends GraphTargetItem implements Block {
|
||||
visitor.visit(expression);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param src Source
|
||||
* @param lineStartIns Line start instruction
|
||||
* @param expression Expression
|
||||
* @param onTrue On true
|
||||
* @param onFalse On false
|
||||
*/
|
||||
public IfItem(GraphSourceItem src, GraphSourceItem lineStartIns, GraphTargetItem expression, List<GraphTargetItem> onTrue, List<GraphTargetItem> onFalse) {
|
||||
super(src, lineStartIns, NOPRECEDENCE);
|
||||
this.expression = expression;
|
||||
|
||||
@@ -29,8 +29,17 @@ import java.util.Set;
|
||||
*/
|
||||
public class IntegerValueItem extends GraphTargetItem implements IntegerValueTypeItem {
|
||||
|
||||
/**
|
||||
* Integer value
|
||||
*/
|
||||
private final int intValue;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param src Source
|
||||
* @param lineStartIns Line start instruction
|
||||
* @param value Value
|
||||
*/
|
||||
public IntegerValueItem(GraphSourceItem src, GraphSourceItem lineStartIns, int value) {
|
||||
super(src, lineStartIns, PRECEDENCE_PRIMARY);
|
||||
this.intValue = value;
|
||||
|
||||
@@ -23,5 +23,9 @@ package com.jpexs.decompiler.graph.model;
|
||||
*/
|
||||
public interface IntegerValueTypeItem {
|
||||
|
||||
/**
|
||||
* Gets the integer value of this item.
|
||||
* @return Integer value
|
||||
*/
|
||||
public int intValue();
|
||||
}
|
||||
|
||||
@@ -28,8 +28,17 @@ import com.jpexs.decompiler.graph.TypeItem;
|
||||
*/
|
||||
public class LabelItem extends GraphTargetItem {
|
||||
|
||||
/**
|
||||
* Label name.
|
||||
*/
|
||||
public String labelName;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param src Source
|
||||
* @param lineStartIns Line start instruction
|
||||
* @param labelName Label name
|
||||
*/
|
||||
public LabelItem(GraphSourceItem src, GraphSourceItem lineStartIns, String labelName) {
|
||||
super(src, lineStartIns, PRECEDENCE_PRIMARY);
|
||||
this.labelName = labelName;
|
||||
|
||||
@@ -34,30 +34,73 @@ import java.util.Set;
|
||||
*/
|
||||
public class LocalData {
|
||||
|
||||
/**
|
||||
* Empty local data
|
||||
*/
|
||||
public static LocalData empty = new LocalData();
|
||||
|
||||
/**
|
||||
* Constant pool
|
||||
*/
|
||||
public ConstantPool constants;
|
||||
|
||||
/**
|
||||
* AVM2 constant pool
|
||||
*/
|
||||
public AVM2ConstantPool constantsAvm2;
|
||||
|
||||
/**
|
||||
* ABC indexing
|
||||
*/
|
||||
public AbcIndexing abcIndex;
|
||||
|
||||
/**
|
||||
* Call stack
|
||||
*/
|
||||
public List<MethodBody> callStack;
|
||||
|
||||
/**
|
||||
* Local register names
|
||||
*/
|
||||
public HashMap<Integer, String> localRegNames;
|
||||
|
||||
/**
|
||||
* Fully qualified names
|
||||
*/
|
||||
public List<DottedChain> fullyQualifiedNames;
|
||||
|
||||
/**
|
||||
* Seen methods
|
||||
*/
|
||||
public Set<Integer> seenMethods = new HashSet<>();
|
||||
|
||||
/**
|
||||
* ABC
|
||||
*/
|
||||
public ABC abc;
|
||||
|
||||
/**
|
||||
* Creates a new local data
|
||||
*
|
||||
* @param constants Constant pool
|
||||
* @return Local data
|
||||
*/
|
||||
public static LocalData create(ConstantPool constants) {
|
||||
LocalData localData = new LocalData();
|
||||
localData.constants = constants;
|
||||
return localData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new local data
|
||||
* @param callStack Call stack
|
||||
* @param abcIndex ABC indexing
|
||||
* @param abc ABC
|
||||
* @param localRegNames Local register names
|
||||
* @param fullyQualifiedNames Fully qualified names
|
||||
* @param seenMethods Seen methods
|
||||
* @return Local data
|
||||
*/
|
||||
public static LocalData create(List<MethodBody> callStack, AbcIndexing abcIndex, ABC abc, HashMap<Integer, String> localRegNames, List<DottedChain> fullyQualifiedNames, Set<Integer> seenMethods) {
|
||||
LocalData localData = new LocalData();
|
||||
localData.abc = abc;
|
||||
|
||||
@@ -26,5 +26,11 @@ import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
*/
|
||||
public interface LogicalOpItem {
|
||||
|
||||
/**
|
||||
* Inverts the logical operation.
|
||||
*
|
||||
* @param src Source item
|
||||
* @return Inverted target item
|
||||
*/
|
||||
public GraphTargetItem invert(GraphSourceItem src);
|
||||
}
|
||||
|
||||
@@ -28,14 +28,32 @@ import java.util.List;
|
||||
*/
|
||||
public abstract class LoopItem extends GraphTargetItem {
|
||||
|
||||
/**
|
||||
* Loop
|
||||
*/
|
||||
public Loop loop;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param src Source item
|
||||
* @param lineStartItem Line start item
|
||||
* @param loop Loop
|
||||
*/
|
||||
public LoopItem(GraphSourceItem src, GraphSourceItem lineStartItem, Loop loop) {
|
||||
super(src, lineStartItem, NOPRECEDENCE);
|
||||
this.loop = loop;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if loop has base body.
|
||||
* @return True if loop has base body
|
||||
*/
|
||||
public abstract boolean hasBaseBody();
|
||||
|
||||
/**
|
||||
* Gets base body commands.
|
||||
* @return List of base body commands
|
||||
*/
|
||||
public abstract List<GraphTargetItem> getBaseBodyCommands();
|
||||
}
|
||||
|
||||
@@ -36,6 +36,12 @@ import java.util.Set;
|
||||
*/
|
||||
public class NotItem extends UnaryOpItem implements LogicalOpItem, Inverted {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param instruction Instruction
|
||||
* @param lineStartIns Line start instruction
|
||||
* @param value Value
|
||||
*/
|
||||
public NotItem(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem value) {
|
||||
super(instruction, lineStartIns, PRECEDENCE_UNARY, value, "!", "Boolean");
|
||||
}
|
||||
@@ -65,6 +71,10 @@ public class NotItem extends UnaryOpItem implements LogicalOpItem, Inverted {
|
||||
return value.isCompileTime(dependencies);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the original value.
|
||||
* @return Original value
|
||||
*/
|
||||
public GraphTargetItem getOriginal() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -33,6 +33,13 @@ import java.util.List;
|
||||
*/
|
||||
public class OrItem extends BinaryOpItem implements CompoundableBinaryOp {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param src Source
|
||||
* @param lineStartIns Line start instruction
|
||||
* @param leftSide Left side
|
||||
* @param rightSide Right side
|
||||
*/
|
||||
public OrItem(GraphSourceItem src, GraphSourceItem lineStartIns, GraphTargetItem leftSide, GraphTargetItem rightSide) {
|
||||
super(src, lineStartIns, PRECEDENCE_LOGICALOR, leftSide, rightSide, "||", "Boolean", "Boolean");
|
||||
this.leftSide = leftSide;
|
||||
|
||||
@@ -31,6 +31,12 @@ import java.util.List;
|
||||
*/
|
||||
public class ParenthesisItem extends GraphTargetItem {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param src Source
|
||||
* @param lineStartIns Line start instruction
|
||||
* @param value Value
|
||||
*/
|
||||
public ParenthesisItem(GraphSourceItem src, GraphSourceItem lineStartIns, GraphTargetItem value) {
|
||||
super(src, lineStartIns, PRECEDENCE_PRIMARY, value);
|
||||
}
|
||||
|
||||
@@ -33,6 +33,11 @@ import java.util.List;
|
||||
*/
|
||||
public class PopItem extends GraphTargetItem {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param src Source
|
||||
* @param lineStartIns Line start instruction
|
||||
*/
|
||||
public PopItem(GraphSourceItem src, GraphSourceItem lineStartIns) {
|
||||
super(src, lineStartIns, PRECEDENCE_PRIMARY);
|
||||
}
|
||||
|
||||
@@ -33,6 +33,10 @@ import java.util.Objects;
|
||||
*/
|
||||
public class PushItem extends GraphTargetItem {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param value Value to push
|
||||
*/
|
||||
public PushItem(GraphTargetItem value) {
|
||||
super(value.getSrc(), value.getLineStartItem(), value.getPrecedence(), value);
|
||||
}
|
||||
|
||||
@@ -27,6 +27,9 @@ import com.jpexs.decompiler.graph.TypeItem;
|
||||
*/
|
||||
public class ScriptEndItem extends GraphTargetItem implements ExitItem {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public ScriptEndItem() {
|
||||
super(null, null, NOPRECEDENCE);
|
||||
}
|
||||
|
||||
@@ -38,14 +38,29 @@ import java.util.List;
|
||||
*/
|
||||
public class SwitchItem extends LoopItem implements Block {
|
||||
|
||||
/**
|
||||
* Switched object
|
||||
*/
|
||||
public GraphTargetItem switchedObject;
|
||||
|
||||
/**
|
||||
* Case values
|
||||
*/
|
||||
public List<GraphTargetItem> caseValues;
|
||||
|
||||
/**
|
||||
* Case commands
|
||||
*/
|
||||
public List<List<GraphTargetItem>> caseCommands;
|
||||
|
||||
/**
|
||||
* Values mapping
|
||||
*/
|
||||
public List<Integer> valuesMapping;
|
||||
|
||||
/**
|
||||
* Label used
|
||||
*/
|
||||
private boolean labelUsed;
|
||||
|
||||
@Override
|
||||
@@ -70,6 +85,16 @@ public class SwitchItem extends LoopItem implements Block {
|
||||
visitor.visitAll(caseValues);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param instruction Instruction
|
||||
* @param lineStartIns Line start instruction
|
||||
* @param loop Loop
|
||||
* @param switchedObject Switched object
|
||||
* @param caseValues Case values
|
||||
* @param caseCommands Case commands
|
||||
* @param valuesMapping Values mapping
|
||||
*/
|
||||
public SwitchItem(GraphSourceItem instruction, GraphSourceItem lineStartIns, Loop loop, GraphTargetItem switchedObject, List<GraphTargetItem> caseValues, List<List<GraphTargetItem>> caseCommands, List<Integer> valuesMapping) {
|
||||
super(instruction, lineStartIns, loop);
|
||||
this.switchedObject = switchedObject;
|
||||
|
||||
@@ -34,12 +34,30 @@ import java.util.Objects;
|
||||
*/
|
||||
public class TernarOpItem extends GraphTargetItem {
|
||||
|
||||
/**
|
||||
* Expression
|
||||
*/
|
||||
public GraphTargetItem expression;
|
||||
|
||||
/**
|
||||
* On true
|
||||
*/
|
||||
public GraphTargetItem onTrue;
|
||||
|
||||
/**
|
||||
* On false
|
||||
*/
|
||||
public GraphTargetItem onFalse;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param src Source
|
||||
* @param lineStartIns Line start instruction
|
||||
* @param expression Expression
|
||||
* @param onTrue On true
|
||||
* @param onFalse On false
|
||||
*/
|
||||
public TernarOpItem(GraphSourceItem src, GraphSourceItem lineStartIns, GraphTargetItem expression, GraphTargetItem onTrue, GraphTargetItem onFalse) {
|
||||
super(src, lineStartIns, PRECEDENCE_CONDITIONAL);
|
||||
this.expression = expression;
|
||||
|
||||
@@ -34,6 +34,11 @@ import java.util.Set;
|
||||
*/
|
||||
public class TrueItem extends GraphTargetItem implements LogicalOpItem, SimpleValue {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param src Source
|
||||
* @param lineStartIns Line start instruction
|
||||
*/
|
||||
public TrueItem(GraphSourceItem src, GraphSourceItem lineStartIns) {
|
||||
super(src, lineStartIns, PRECEDENCE_PRIMARY);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,15 @@ import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
*/
|
||||
public interface UnaryOp {
|
||||
|
||||
/**
|
||||
* Gets value
|
||||
* @return Value
|
||||
*/
|
||||
public GraphTargetItem getValue();
|
||||
|
||||
/**
|
||||
* Gets precedence
|
||||
* @return Precedence
|
||||
*/
|
||||
public int getPrecedence();
|
||||
}
|
||||
|
||||
@@ -31,10 +31,26 @@ import java.util.Set;
|
||||
*/
|
||||
public abstract class UnaryOpItem extends GraphTargetItem implements UnaryOp {
|
||||
|
||||
/**
|
||||
* Operator
|
||||
*/
|
||||
public String operator;
|
||||
|
||||
/**
|
||||
* Coerce value to this type
|
||||
*/
|
||||
protected String coerce;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param instruction Instruction
|
||||
* @param lineStartItem Line start item
|
||||
* @param precedence Precedence
|
||||
* @param value Value
|
||||
* @param operator Operator
|
||||
* @param coerce Coerce
|
||||
*/
|
||||
public UnaryOpItem(GraphSourceItem instruction, GraphSourceItem lineStartItem, int precedence, GraphTargetItem value, String operator, String coerce) {
|
||||
super(instruction, lineStartItem, precedence, value);
|
||||
this.operator = operator;
|
||||
@@ -148,6 +164,14 @@ public abstract class UnaryOpItem extends GraphTargetItem implements UnaryOp {
|
||||
return hash;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts operand to string.
|
||||
*
|
||||
* @param operand Operand
|
||||
* @param writer Writer
|
||||
* @param localData Local data
|
||||
* @throws InterruptedException On interrupt
|
||||
*/
|
||||
protected void operandToString(GraphTargetItem operand, GraphTextWriter writer, LocalData localData) throws InterruptedException {
|
||||
operand.toString(writer, localData, "");
|
||||
}
|
||||
|
||||
@@ -27,6 +27,9 @@ import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
*/
|
||||
public class UnboundedTypeItem extends AVM2Item {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public UnboundedTypeItem() {
|
||||
super(null, null, NOPRECEDENCE);
|
||||
}
|
||||
|
||||
@@ -30,12 +30,23 @@ import java.util.List;
|
||||
*/
|
||||
public class UniversalLoopItem extends WhileItem implements Block {
|
||||
|
||||
/**
|
||||
* True expression.
|
||||
*/
|
||||
static final List<GraphTargetItem> TRUE_EXPRESSION = new ArrayList<>();
|
||||
|
||||
static {
|
||||
TRUE_EXPRESSION.add(new TrueItem(null, null));
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param src Source
|
||||
* @param lineStartIns Line start instruction
|
||||
* @param loop Loop
|
||||
* @param commands Commands
|
||||
*/
|
||||
public UniversalLoopItem(GraphSourceItem src, GraphSourceItem lineStartIns, Loop loop, List<GraphTargetItem> commands) {
|
||||
super(src, lineStartIns, loop, TRUE_EXPRESSION, commands);
|
||||
}
|
||||
|
||||
@@ -38,10 +38,19 @@ import java.util.List;
|
||||
*/
|
||||
public class WhileItem extends LoopItem implements Block {
|
||||
|
||||
/**
|
||||
* Expression
|
||||
*/
|
||||
public List<GraphTargetItem> expression;
|
||||
|
||||
/**
|
||||
* Commands
|
||||
*/
|
||||
public List<GraphTargetItem> commands;
|
||||
|
||||
/**
|
||||
* Label used
|
||||
*/
|
||||
private boolean labelUsed;
|
||||
|
||||
@Override
|
||||
@@ -73,6 +82,15 @@ public class WhileItem extends LoopItem implements Block {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param src Source
|
||||
* @param lineStartIns Line start instruction
|
||||
* @param loop Loop
|
||||
* @param expression Expression
|
||||
* @param commands Commands
|
||||
*/
|
||||
public WhileItem(GraphSourceItem src, GraphSourceItem lineStartIns, Loop loop, List<GraphTargetItem> expression, List<GraphTargetItem> commands) {
|
||||
super(src, lineStartIns, loop);
|
||||
this.expression = expression;
|
||||
|
||||
Reference in New Issue
Block a user