mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-04 03:15:08 +00:00
Changed: AS1/2 P-code double Push values have suffix ".0" to properly distinguish them
Changed: AS1/2 P-code float Push values have suffix "f" to properly distinguish them
This commit is contained in:
@@ -129,14 +129,10 @@ public class DirectValueActionItem extends ActionItem implements SimpleValue {
|
||||
@Override
|
||||
public String toStringNoQuotes(LocalData localData) {
|
||||
if (value instanceof Double) {
|
||||
if (Double.compare((double) (Double) value, 0) == 0) {
|
||||
return "0";
|
||||
}
|
||||
return EcmaScript.toString(value);
|
||||
}
|
||||
if (value instanceof Float) {
|
||||
if (Float.compare((float) (Float) value, 0) == 0) {
|
||||
return "0";
|
||||
}
|
||||
return EcmaScript.toString(value);
|
||||
}
|
||||
if (value instanceof String) {
|
||||
return (String) value;
|
||||
@@ -155,14 +151,10 @@ public class DirectValueActionItem extends ActionItem implements SimpleValue {
|
||||
@Override
|
||||
public GraphTextWriter appendToNoQuotes(GraphTextWriter writer, LocalData localData) {
|
||||
if (value instanceof Double) {
|
||||
if (Double.compare((double) (Double) value, 0) == 0) {
|
||||
return writer.append("0");
|
||||
}
|
||||
return writer.append(EcmaScript.toString(value));
|
||||
}
|
||||
if (value instanceof Float) {
|
||||
if (Float.compare((float) (Float) value, 0) == 0) {
|
||||
return writer.append("0");
|
||||
}
|
||||
return writer.append(EcmaScript.toString(value));
|
||||
}
|
||||
if (value instanceof String) {
|
||||
return writer.append((String) value);
|
||||
@@ -193,17 +185,6 @@ public class DirectValueActionItem extends ActionItem implements SimpleValue {
|
||||
|
||||
@Override
|
||||
public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) {
|
||||
if (value instanceof Double) {
|
||||
if (Double.compare((double) (Double) value, 0) == 0) {
|
||||
return writer.append("0");
|
||||
}
|
||||
}
|
||||
if (value instanceof Float) {
|
||||
if (Float.compare((float) (Float) value, 0) == 0) {
|
||||
return writer.append("0");
|
||||
}
|
||||
}
|
||||
|
||||
if (value instanceof String) {
|
||||
return writer.append("\"").append(Helper.escapeActionScriptString((String) value)).append("\"");
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public abstract class BitwiseBinaryOpActionItem extends BinaryOpItem implements
|
||||
@Override
|
||||
protected void operandToString(GraphTargetItem operand, GraphTextWriter writer, LocalData localData) throws InterruptedException {
|
||||
if ((operand instanceof DirectValueActionItem)
|
||||
&& ((((DirectValueActionItem) operand).value instanceof Long) || (((DirectValueActionItem) operand).value instanceof Double))) {
|
||||
&& ((((DirectValueActionItem) operand).value instanceof Long) || (((DirectValueActionItem) operand).value instanceof Double) || (((DirectValueActionItem) operand).value instanceof Float))) {
|
||||
long val = operand.getAsLong();
|
||||
if (val > 9) {
|
||||
String valHex = Long.toHexString(val).toUpperCase();
|
||||
|
||||
@@ -127,6 +127,11 @@ public class ASMParsedSymbol {
|
||||
* Type: Comma
|
||||
*/
|
||||
public static final int TYPE_COMMA = 18;
|
||||
|
||||
/**
|
||||
* Type: Double
|
||||
*/
|
||||
public static final int TYPE_DOUBLE = 19;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -179,9 +179,12 @@ public class ActionPush extends Action {
|
||||
o = (double) l;
|
||||
}
|
||||
}
|
||||
if (o instanceof Double || o instanceof Float) {
|
||||
if (o instanceof Float) {
|
||||
sos.writeUI8(1);
|
||||
sos.writeFLOAT((Float) o);
|
||||
} else if (o instanceof Double) {
|
||||
sos.writeUI8(6);
|
||||
sos.writeDOUBLE(((Number) o).doubleValue());
|
||||
sos.writeDOUBLE((Double) o);
|
||||
} else if (o instanceof Long || o instanceof Integer || o instanceof Short || o instanceof Byte) {
|
||||
sos.writeUI8(7);
|
||||
sos.writeSI32(((Number) o).longValue());
|
||||
@@ -231,7 +234,9 @@ public class ActionPush extends Action {
|
||||
o = (double) l;
|
||||
}
|
||||
}
|
||||
if (o instanceof Double || o instanceof Float) {
|
||||
if (o instanceof Float) {
|
||||
res += 5;
|
||||
} else if (o instanceof Double) {
|
||||
res += 9;
|
||||
} else if (o instanceof Long || o instanceof Integer || o instanceof Short || o instanceof Byte) {
|
||||
res += 5;
|
||||
@@ -330,6 +335,7 @@ public class ActionPush extends Action {
|
||||
}
|
||||
break;
|
||||
case ASMParsedSymbol.TYPE_FLOAT:
|
||||
case ASMParsedSymbol.TYPE_DOUBLE:
|
||||
case ASMParsedSymbol.TYPE_NULL:
|
||||
case ASMParsedSymbol.TYPE_UNDEFINED:
|
||||
case ASMParsedSymbol.TYPE_REGISTER:
|
||||
@@ -438,7 +444,14 @@ public class ActionPush extends Action {
|
||||
} else if (value instanceof RegisterNumber) {
|
||||
ret = ((RegisterNumber) value).toStringNoName();
|
||||
} else if ((value instanceof Float) || (value instanceof Double)) {
|
||||
ret = EcmaScript.toString(value);
|
||||
String fdString = EcmaScript.toString(value);
|
||||
if (value instanceof Double && fdString.matches("^[0-9]+$")) {
|
||||
fdString += ".0";
|
||||
}
|
||||
if (value instanceof Float) {
|
||||
fdString += "f";
|
||||
}
|
||||
ret = fdString;
|
||||
} else {
|
||||
ret = value.toString();
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user