mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-05-29 18:34:42 +00:00
ecma script: number to string
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -71,7 +71,9 @@ public class EcmaScript {
|
||||
if (o.getClass() == Long.class) {
|
||||
return EcmaType.NUMBER;
|
||||
}
|
||||
|
||||
if (o.getClass() == Boolean.class) {
|
||||
return EcmaType.BOOLEAN;
|
||||
}
|
||||
if (o.getClass() == Null.class) {
|
||||
return EcmaType.NULL;
|
||||
}
|
||||
@@ -289,4 +291,18 @@ public class EcmaScript {
|
||||
posInt %= (1 << 32);
|
||||
return posInt;
|
||||
}
|
||||
|
||||
public static String toString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
|
||||
if (o instanceof Number) {
|
||||
// http://www.ecma-international.org/ecma-262/5.1/#sec-9.8.1
|
||||
Number n = (Number) o;
|
||||
return new EcmaFloatingDecimal(n.doubleValue()).toJavaFormatString();
|
||||
}
|
||||
|
||||
return o.toString();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user