Skip to content

Commit 6e9d603

Browse files
committed
Making the occurrence of arrays in error messages more V8-compatible.
1 parent 117cad9 commit 6e9d603

File tree

1 file changed

+3
-2
lines changed
  • graal-js/src/com.oracle.truffle.js/src/com/oracle/truffle/js/runtime

1 file changed

+3
-2
lines changed

graal-js/src/com.oracle.truffle.js/src/com/oracle/truffle/js/runtime/JSRuntime.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,6 +1006,7 @@ public static String objectToConsoleString(DynamicObject obj, String name, int d
10061006
@TruffleBoundary
10071007
public static String objectToConsoleString(DynamicObject obj, String name, int depth, String[] internalKeys, Object[] internalValues, boolean allowSideEffects) {
10081008
assert JSDynamicObject.isJSDynamicObject(obj) && !JSFunction.isJSFunction(obj) && !JSProxy.isJSProxy(obj);
1009+
boolean v8CompatMode = JSObject.getJSContext(obj).isOptionV8CompatibilityMode();
10091010
StringBuilder sb = new StringBuilder();
10101011

10111012
if (name != null) {
@@ -1036,7 +1037,7 @@ public static String objectToConsoleString(DynamicObject obj, String name, int d
10361037
}
10371038
sb.append('(').append(length).append(')');
10381039
return sb.toString();
1039-
} else if (topLevel && length >= 2) {
1040+
} else if (topLevel && length >= 2 && !v8CompatMode) {
10401041
sb.append('(').append(length).append(')');
10411042
}
10421043
}
@@ -1055,7 +1056,7 @@ public static String objectToConsoleString(DynamicObject obj, String name, int d
10551056
continue;
10561057
}
10571058
if (propertyCount > 0) {
1058-
sb.append(", ");
1059+
sb.append(v8CompatMode ? "," : ", ");
10591060
if (propertyCount >= JSConfig.MaxConsolePrintProperties) {
10601061
sb.append("...");
10611062
break;

0 commit comments

Comments
 (0)