mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-28 18:10:43 +00:00
tests fix
This commit is contained in:
@@ -18,21 +18,31 @@ package com.jpexs.decompiler.graph;
|
||||
|
||||
/**
|
||||
* Dialect - high level language type.
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public abstract class GraphTargetDialect {
|
||||
|
||||
/**
|
||||
* Identifier of the dialect.
|
||||
*
|
||||
* @return Name
|
||||
*/
|
||||
public abstract String getName();
|
||||
|
||||
|
||||
/**
|
||||
* Conversion of ECMA value (that's used in simplifications)
|
||||
* back to GraphTarget item.
|
||||
* Conversion of ECMA value (that's used in simplifications) back to
|
||||
* GraphTarget item.
|
||||
*
|
||||
* @param value Ecma value
|
||||
* @return GraphTarget item
|
||||
*/
|
||||
public abstract GraphTargetItem valToItem(Object value);
|
||||
|
||||
/**
|
||||
* Checks whether this dialect allows multi level breaks
|
||||
*
|
||||
* @return True when allows
|
||||
*/
|
||||
public abstract boolean doesAllowMultilevelBreaks();
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public class BreakItem extends GraphTargetItem {
|
||||
* Is placed at end of the script (or function)
|
||||
*/
|
||||
public boolean isScriptEnd = false;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
@@ -64,18 +64,24 @@ public class BreakItem extends GraphTargetItem {
|
||||
|
||||
@Override
|
||||
public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) {
|
||||
if (isScriptEnd) {
|
||||
writer.append("return");
|
||||
return writer;
|
||||
}
|
||||
writer.append("break");
|
||||
if (writer instanceof NulWriter) {
|
||||
NulWriter nulWriter = (NulWriter) writer;
|
||||
labelRequired = loopId != nulWriter.getLoop();
|
||||
if (labelRequired) {
|
||||
if (!dialect.doesAllowMultilevelBreaks() && isScriptEnd) {
|
||||
writer.append("return");
|
||||
return writer;
|
||||
}
|
||||
nulWriter.setLoopUsed(loopId);
|
||||
}
|
||||
}
|
||||
if (labelRequired) {
|
||||
if (!dialect.doesAllowMultilevelBreaks() && isScriptEnd) {
|
||||
writer.append("return");
|
||||
return writer;
|
||||
}
|
||||
}
|
||||
writer.append("break");
|
||||
if (labelRequired) {
|
||||
writer.append(" loop").append(loopId);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user