Source/JavaScriptCore/inspector/InjectedScriptSource.js

@@function toStringDescription(obj)
4444{
4545 if (obj === 0 && 1 / obj < 0)
4646 return "-0";
 47 if (typeof obj === "bigint")
 48 return toString(obj) + "n";
4749
4850 return toString(obj);
4951}

@@function isUInt32(obj)
5557 return "" + (obj >>> 0) === obj;
5658}
5759
58 function isSymbol(obj)
 60function isSymbol(value)
5961{
60  return typeof obj === "symbol";
 62 return typeof value === "symbol";
 63}
 64
 65function isBigInt(value)
 66{
 67 return typeof value === "bigint";
6168}
6269
6370function isEmptyObject(object)

@@let InjectedScript = class InjectedScript
427434 if (isPrimitiveValue(object))
428435 result.value = object;
429436 else
430  result.description = toString(object);
 437 result.description = toStringDescription(object);
431438 return result;
432439 }
433440

@@let RemoteObject = class RemoteObject
816823 if (this.type === "undefined" && InjectedScriptHost.isHTMLAllCollection(object))
817824 this.type = "object";
818825
819  if (isPrimitiveValue(object) || object === null || forceValueType) {
 826 if (isPrimitiveValue(object) || isBigInt(object) || object === null || forceValueType) {
820827 // We don't send undefined values over JSON.
821828 if (this.type !== "undefined")
822829 this.value = object;

@@let RemoteObject = class RemoteObject
828835 // Provide user-friendly number values.
829836 if (this.type === "number")
830837 this.description = toStringDescription(object);
 838
 839 // BigInt is not JSON serializable.
 840 if (this.type === "bigint") {
 841 delete this.value;
 842 this.description = toStringDescription(object);
 843 }
 844
831845 return;
832846 }
833847

@@let RemoteObject = class RemoteObject
895909 if (value === null)
896910 return "null";
897911
898  if (isPrimitiveValue(value) || isSymbol(value))
 912 if (isPrimitiveValue(value) || isBigInt(value) || isSymbol(value))
899913 return null;
900914
901915 if (InjectedScriptHost.isHTMLAllCollection(value))

@@let RemoteObject = class RemoteObject
919933 if (isPrimitiveValue(value))
920934 return null;
921935
 936 if (isBigInt(value))
 937 return null;
 938
922939 if (isSymbol(value))
923940 return toString(value);
924941

@@let RemoteObject = class RemoteObject
11371154
11381155 // Primitive.
11391156 const maxLength = 100;
1140  if (isPrimitiveValue(value)) {
 1157 if (isPrimitiveValue(value) || isBigInt(value)) {
11411158 if (type === "string" && value.length > maxLength) {
11421159 value = this._abbreviateString(value, maxLength, true);
11431160 preview.lossless = false;

@@let RemoteObject = class RemoteObject
12551272 return false;
12561273
12571274 // Primitive.
1258  if (isPrimitiveValue(object) || isSymbol(object))
 1275 if (isPrimitiveValue(object) || isBigInt(object) || isSymbol(object))
12591276 return true;
12601277
12611278 // Null.

Source/JavaScriptCore/inspector/protocol/Runtime.json

1313 "type": "object",
1414 "description": "Mirror object referencing original JavaScript object.",
1515 "properties": [
16  { "name": "type", "type": "string", "enum": ["object", "function", "undefined", "string", "number", "boolean", "symbol"], "description": "Object type." },
 16 { "name": "type", "type": "string", "enum": ["object", "function", "undefined", "string", "number", "boolean", "symbol", "bigint"], "description": "Object type." },
1717 { "name": "subtype", "type": "string", "optional": true, "enum": ["array", "null", "node", "regexp", "date", "error", "map", "set", "weakmap", "weakset", "iterator", "class", "proxy"], "description": "Object subtype hint. Specified for <code>object</code> <code>function</code> (for class) type values only." },
1818 { "name": "className", "type": "string", "optional": true, "description": "Object class (constructor) name. Specified for <code>object</code> type values only." },
1919 { "name": "value", "type": "any", "optional": true, "description": "Remote object value (in case of primitive values or JSON values if it was requested)." },

2929 "type": "object",
3030 "description": "Object containing abbreviated remote object value.",
3131 "properties": [
32  { "name": "type", "type": "string", "enum": ["object", "function", "undefined", "string", "number", "boolean", "symbol"], "description": "Object type." },
 32 { "name": "type", "type": "string", "enum": ["object", "function", "undefined", "string", "number", "boolean", "symbol", "bigint"], "description": "Object type." },
3333 { "name": "subtype", "type": "string", "optional": true, "enum": ["array", "null", "node", "regexp", "date", "error", "map", "set", "weakmap", "weakset", "iterator", "class", "proxy"], "description": "Object subtype hint. Specified for <code>object</code> type values only." },
3434 { "name": "description", "type": "string", "optional": true, "description": "String representation of the object." },
3535 { "name": "lossless", "type": "boolean", "description": "Determines whether preview is lossless (contains all information of the original object)." },

4444 "type": "object",
4545 "properties": [
4646 { "name": "name", "type": "string", "description": "Property name." },
47  { "name": "type", "type": "string", "enum": ["object", "function", "undefined", "string", "number", "boolean", "symbol", "accessor"], "description": "Object type." },
 47 { "name": "type", "type": "string", "enum": ["object", "function", "undefined", "string", "number", "boolean", "symbol", "bigint", "accessor"], "description": "Object type." },
4848 { "name": "subtype", "type": "string", "optional": true, "enum": ["array", "null", "node", "regexp", "date", "error", "map", "set", "weakmap", "weakset", "iterator", "class", "proxy"], "description": "Object subtype hint. Specified for <code>object</code> type values only." },
4949 { "name": "value", "type": "string", "optional": true, "description": "User-friendly property value string." },
5050 { "name": "valuePreview", "$ref": "ObjectPreview", "optional": true, "description": "Nested value preview." },

157157 { "name": "isNumber", "type": "boolean", "description": "Indicates if this type description has been type Number." },
158158 { "name": "isString", "type": "boolean", "description": "Indicates if this type description has been type String." },
159159 { "name": "isObject", "type": "boolean", "description": "Indicates if this type description has been type Object." },
160  { "name": "isSymbol", "type": "boolean", "description": "Indicates if this type description has been type Symbol." }
 160 { "name": "isSymbol", "type": "boolean", "description": "Indicates if this type description has been type Symbol." },
 161 { "name": "isBigInt", "type": "boolean", "description": "Indicates if this type description has been type BigInt." }
161162 ]
162163 },
163164 {

Source/JavaScriptCore/runtime/RuntimeType.cpp

@@RuntimeType runtimeTypeForValue(VM& vm, JSValue value)
5555 return TypeFunction;
5656 if (value.isSymbol())
5757 return TypeSymbol;
 58 if (value.isBigInt())
 59 return TypeBigInt;
5860
5961 return TypeNothing;
6062}

@@String runtimeTypeAsString(RuntimeType type)
7779 return "Boolean"_s;
7880 if (type == TypeFunction)
7981 return "Function"_s;
 82 if (type == TypeSymbol)
 83 return "Symbol"_s;
 84 if (type == TypeBigInt)
 85 return "BigInt"_s;
8086 if (type == TypeNothing)
8187 return "(Nothing)"_s;
8288

Source/JavaScriptCore/runtime/RuntimeType.h

@@enum RuntimeType : uint16_t {
4040 TypeNumber = 0x20,
4141 TypeString = 0x40,
4242 TypeObject = 0x80,
43  TypeSymbol = 0x100
 43 TypeSymbol = 0x100,
 44 TypeBigInt = 0x200,
4445};
4546
4647typedef uint16_t RuntimeTypeMask;
4748
48 static const RuntimeTypeMask RuntimeTypeMaskAllTypes = TypeFunction | TypeUndefined | TypeNull | TypeBoolean | TypeAnyInt | TypeNumber | TypeString | TypeObject | TypeSymbol;
 49static const RuntimeTypeMask RuntimeTypeMaskAllTypes = TypeFunction | TypeUndefined | TypeNull | TypeBoolean | TypeAnyInt | TypeNumber | TypeString | TypeObject | TypeSymbol | TypeBigInt;
4950
5051class JSValue;
5152RuntimeType runtimeTypeForValue(VM&, JSValue);

Source/JavaScriptCore/runtime/TypeSet.cpp

@@String TypeSet::displayName() const
187187 return "String"_s;
188188 if (doesTypeConformTo(TypeSymbol))
189189 return "Symbol"_s;
 190 if (doesTypeConformTo(TypeBigInt))
 191 return "BigInt"_s;
190192
191193 if (doesTypeConformTo(TypeNull | TypeUndefined))
192194 return "(?)"_s;

@@String TypeSet::displayName() const
203205 return "String?"_s;
204206 if (doesTypeConformTo(TypeSymbol | TypeNull | TypeUndefined))
205207 return "Symbol?"_s;
 208 if (doesTypeConformTo(TypeBigInt | TypeNull | TypeUndefined))
 209 return "BigInt?"_s;
206210
207211 if (doesTypeConformTo(TypeObject | TypeFunction | TypeString))
208212 return "Object"_s;

@@Ref<Inspector::Protocol::Runtime::TypeSet> TypeSet::inspectorTypeSet() const
239243 .setIsString((m_seenTypes & TypeString) != TypeNothing)
240244 .setIsObject((m_seenTypes & TypeObject) != TypeNothing)
241245 .setIsSymbol((m_seenTypes & TypeSymbol) != TypeNothing)
 246 .setIsBigInt((m_seenTypes & TypeBigInt) != TypeNothing)
242247 .release();
243248}
244249

Source/WebInspectorUI/UserInterface/External/CodeMirror/javascript.js

@@CodeMirror.defineMode("javascript", function(config, parserConfig) {
112112 return ret(ch);
113113 } else if (ch == "=" && stream.eat(">")) {
114114 return ret("=>", "operator");
115  } else if (ch == "0" && stream.eat(/x/i)) {
116  stream.eatWhile(/[\da-f]/i);
117  return ret("number", "number");
118  } else if (ch == "0" && stream.eat(/o/i)) {
119  stream.eatWhile(/[0-7]/i);
120  return ret("number", "number");
121  } else if (ch == "0" && stream.eat(/b/i)) {
122  stream.eatWhile(/[01]/i);
 115 } else if (ch == "0" && stream.match(/^(?:x[\da-f]+|o[0-7]+|b[01]+)n?/i)) {
123116 return ret("number", "number");
124117 } else if (/\d/.test(ch)) {
125  stream.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/);
 118 stream.match(/^\d*(?:n|(?:\.\d*)?(?:[eE][+\-]?\d+)?)?/);
126119 return ret("number", "number");
127120 } else if (ch == "/") {
128121 if (stream.eat("*")) {

Source/WebInspectorUI/UserInterface/Models/TypeSet.js

@@WI.TypeSet = class TypeSet
4949 bitString |= WI.TypeSet.TypeBit.Object;
5050 if (typeSet.isSymbol)
5151 bitString |= WI.TypeSet.TypeBit.Symbol;
 52 if (typeSet.isBigInt)
 53 bitString |= WI.TypeSet.TypeBit.BigInt;
5254 console.assert(bitString);
5355
5456 this._typeSet = typeSet;

@@WI.TypeSet = class TypeSet
102104 this._primitiveTypeNames.push("String");
103105 if (typeSet.isSymbol)
104106 this._primitiveTypeNames.push("Symbol");
 107 if (typeSet.isBigInt)
 108 this._primitiveTypeNames.push("BigInt");
105109
106110 // It's implied that type Integer is contained in type Number. Don't put
107111 // both 'Integer' and 'Number' into the set because this could imply that

@@WI.TypeSet.TypeBit = {
124128 "Number" : 0x20,
125129 "String" : 0x40,
126130 "Object" : 0x80,
127  "Symbol" : 0x100
 131 "Symbol" : 0x100,
 132 "BigInt" : 0x200,
128133};
129134
130135WI.TypeSet.NullOrUndefinedTypeBits = WI.TypeSet.TypeBit.Null | WI.TypeSet.TypeBit.Undefined;

Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js

@@WI.RemoteObject = class RemoteObject
5959 this._description = "class " + className;
6060 }
6161 } else {
62  // Primitive or null.
 62 // Primitive, BigInt, or null.
6363 console.assert(type !== "object" || value === null);
6464 console.assert(!preview);
6565
6666 this._description = description || (value + "");
6767 this._hasChildren = false;
6868 this._value = value;
 69
 70 if (type === "bigint") {
 71 console.assert(value === undefined);
 72 console.assert(description.endsWith("n"));
 73 this._value = BigInt(description.substring(0, description.length - 1));
 74 }
6975 }
7076 }
7177

Source/WebInspectorUI/UserInterface/Views/FormattedValue.css

5858 color: var(--syntax-highlight-symbol-color);
5959}
6060
 61.formatted-bigint {
 62 color: var(--syntax-highlight-bigint-color);
 63}
 64
6165.formatted-null, .formatted-undefined {
6266 color: hsl(0, 0%, 50%);
6367}

Source/WebInspectorUI/UserInterface/Views/TypeTokenView.css

5959 background-color: var(--syntax-highlight-symbol-color);
6060}
6161
 62.type-token-bigint {
 63 background-color: var(--syntax-highlight-bigint-color);
 64}
 65
6266.type-token-default {
6367 background-color: hsl(83, 71%, 39%);
6468}

Source/WebInspectorUI/UserInterface/Views/TypeTokenView.js

@@WI.TypeTokenView = class TypeTokenView extends WI.Object
160160 return "String";
161161 if (typeSet.isContainedIn(WI.TypeSet.TypeBit.Symbol))
162162 return "Symbol";
 163 if (typeSet.isContainedIn(WI.TypeSet.TypeBit.BigInt))
 164 return "BigInt";
163165
164166 if (typeSet.isContainedIn(WI.TypeSet.NullOrUndefinedTypeBits))
165167 return "(?)";

@@WI.TypeTokenView = class TypeTokenView extends WI.Object
176178 return "String?";
177179 if (typeSet.isContainedIn(WI.TypeSet.TypeBit.Symbol | WI.TypeSet.NullOrUndefinedTypeBits))
178180 return "Symbol?";
 181 if (typeSet.isContainedIn(WI.TypeSet.TypeBit.BigInt | WI.TypeSet.NullOrUndefinedTypeBits))
 182 return "BigInt?";
179183
180184 if (typeSet.isContainedIn(WI.TypeSet.TypeBit.Object | WI.TypeSet.TypeBit.Function | WI.TypeSet.TypeBit.String))
181185 return "Object";

@@WI.TypeTokenView.TitleType = {
194198WI.TypeTokenView.ColorClassForType = {
195199 "String": "type-token-string",
196200 "Symbol": "type-token-symbol",
 201 "BigInt": "type-token-bigint",
197202 "Function": "type-token-function",
198203 "Number": "type-token-number",
199204 "Integer": "type-token-number",

Source/WebInspectorUI/UserInterface/Views/Variables.css

8282 --breakpoint-unresolved-disabled-stroke-color: hsl(0, 0%, 78%);
8383
8484 --syntax-highlight-number-color: hsl(248, 100%, 40%);
 85 --syntax-highlight-bigint-color: var(--syntax-highlight-number-color);
8586 --syntax-highlight-boolean-color: hsl(309, 85%, 35%);
8687 --syntax-highlight-string-color: hsl(1, 79%, 42%);
8788 --syntax-highlight-link-color: hsl(240, 100%, 52%);