mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
Update JSType (#14373)
This commit is contained in:
@@ -1138,13 +1138,18 @@ pub const Formatter = struct {
|
||||
.Symbol => .Symbol,
|
||||
.BooleanObject => .Boolean,
|
||||
.JSFunction => .Function,
|
||||
.JSWeakMap, JSValue.JSType.JSMap => .Map,
|
||||
.JSMapIterator => .MapIterator,
|
||||
.JSSetIterator => .SetIterator,
|
||||
.JSWeakSet, JSValue.JSType.JSSet => .Set,
|
||||
.WeakMap, JSValue.JSType.Map => .Map,
|
||||
.MapIterator => .MapIterator,
|
||||
.SetIterator => .SetIterator,
|
||||
.WeakSet, JSValue.JSType.Set => .Set,
|
||||
.JSDate => .JSON,
|
||||
.JSPromise => .Promise,
|
||||
|
||||
.WrapForValidIterator,
|
||||
.RegExpStringIterator,
|
||||
.JSArrayIterator,
|
||||
.Iterator,
|
||||
.IteratorHelper,
|
||||
.Object,
|
||||
.FinalObject,
|
||||
.ModuleNamespaceObject,
|
||||
@@ -2433,7 +2438,7 @@ pub const Formatter = struct {
|
||||
this.quote_strings = true;
|
||||
defer this.quote_strings = prev_quote_strings;
|
||||
|
||||
const map_name = if (value.jsType() == .JSWeakMap) "WeakMap" else "Map";
|
||||
const map_name = if (value.jsType() == .WeakMap) "WeakMap" else "Map";
|
||||
|
||||
if (length == 0) {
|
||||
return writer.print("{s} {{}}", .{map_name});
|
||||
@@ -2541,7 +2546,7 @@ pub const Formatter = struct {
|
||||
this.writeIndent(Writer, writer_) catch {};
|
||||
}
|
||||
|
||||
const set_name = if (value.jsType() == .JSWeakSet) "WeakSet" else "Set";
|
||||
const set_name = if (value.jsType() == .WeakSet) "WeakSet" else "Set";
|
||||
|
||||
if (length == 0) {
|
||||
return writer.print("{s} {{}}", .{set_name});
|
||||
|
||||
@@ -877,7 +877,7 @@ pub const DOMEffect = struct {
|
||||
JSMapFields,
|
||||
JSSetFields,
|
||||
JSWeakMapFields,
|
||||
JSWeakSetFields,
|
||||
WeakSetFields,
|
||||
JSInternalFields,
|
||||
InternalState,
|
||||
CatchLocals,
|
||||
|
||||
@@ -3628,7 +3628,7 @@ pub const JSMap = opaque {
|
||||
}
|
||||
|
||||
pub fn fromJS(value: JSValue) ?*JSMap {
|
||||
if (value.jsTypeLoose() == .JSMap) {
|
||||
if (value.jsTypeLoose() == .Map) {
|
||||
return bun.cast(*JSMap, value.asEncoded().asPtr.?);
|
||||
}
|
||||
|
||||
@@ -3728,26 +3728,27 @@ pub const JSValue = enum(JSValueReprInt) {
|
||||
RegExpObject = 60,
|
||||
JSDate = 61,
|
||||
ProxyObject = 62,
|
||||
JSGenerator = 63,
|
||||
JSAsyncGenerator = 64,
|
||||
Generator = 63,
|
||||
AsyncGenerator = 64,
|
||||
JSArrayIterator = 65,
|
||||
JSIterator = 66,
|
||||
JSMapIterator = 67,
|
||||
JSSetIterator = 68,
|
||||
JSStringIterator = 69,
|
||||
JSWrapForValidIterator = 70,
|
||||
JSRegExpStringIterator = 71,
|
||||
JSPromise = 72,
|
||||
JSMap = 73,
|
||||
JSSet = 74,
|
||||
JSWeakMap = 75,
|
||||
JSWeakSet = 76,
|
||||
WebAssemblyModule = 77,
|
||||
WebAssemblyInstance = 78,
|
||||
WebAssemblyGCObject = 79,
|
||||
StringObject = 80,
|
||||
DerivedStringObject = 81,
|
||||
InternalFieldTuple = 82,
|
||||
Iterator = 66,
|
||||
IteratorHelper = 67,
|
||||
MapIterator = 68,
|
||||
SetIterator = 69,
|
||||
StringIterator = 70,
|
||||
WrapForValidIterator = 71,
|
||||
RegExpStringIterator = 72,
|
||||
JSPromise = 73,
|
||||
Map = 74,
|
||||
Set = 75,
|
||||
WeakMap = 76,
|
||||
WeakSet = 77,
|
||||
WebAssemblyModule = 78,
|
||||
WebAssemblyInstance = 79,
|
||||
WebAssemblyGCObject = 80,
|
||||
StringObject = 81,
|
||||
DerivedStringObject = 82,
|
||||
InternalFieldTuple = 83,
|
||||
|
||||
MaxJS = 0b11111111,
|
||||
Event = 0b11101111,
|
||||
@@ -3785,18 +3786,20 @@ pub const JSValue = enum(JSValueReprInt) {
|
||||
.Int8Array,
|
||||
.InternalFunction,
|
||||
.JSArrayIterator,
|
||||
.JSAsyncGenerator,
|
||||
.AsyncGenerator,
|
||||
.JSDate,
|
||||
.JSFunction,
|
||||
.JSGenerator,
|
||||
.JSMap,
|
||||
.JSMapIterator,
|
||||
.Generator,
|
||||
.Map,
|
||||
.MapIterator,
|
||||
.JSPromise,
|
||||
.JSSet,
|
||||
.JSSetIterator,
|
||||
.JSStringIterator,
|
||||
.JSWeakMap,
|
||||
.JSWeakSet,
|
||||
.Set,
|
||||
.SetIterator,
|
||||
.IteratorHelper,
|
||||
.Iterator,
|
||||
.StringIterator,
|
||||
.WeakMap,
|
||||
.WeakSet,
|
||||
.ModuleNamespaceObject,
|
||||
.NumberObject,
|
||||
.Object,
|
||||
@@ -3946,14 +3949,14 @@ pub const JSValue = enum(JSValueReprInt) {
|
||||
|
||||
pub inline fn isSet(this: JSType) bool {
|
||||
return switch (this) {
|
||||
.JSSet, .JSWeakSet => true,
|
||||
.Set, .WeakSet => true,
|
||||
else => false,
|
||||
};
|
||||
}
|
||||
|
||||
pub inline fn isMap(this: JSType) bool {
|
||||
return switch (this) {
|
||||
.JSMap, .JSWeakMap => true,
|
||||
.Map, .WeakMap => true,
|
||||
else => false,
|
||||
};
|
||||
}
|
||||
|
||||
8
src/bun.js/bindings/headers.zig
generated
8
src/bun.js/bindings/headers.zig
generated
@@ -187,10 +187,10 @@ pub extern fn JSC__JSGlobalObject__reload(arg0: *bindings.JSGlobalObject) void;
|
||||
pub extern fn JSC__JSGlobalObject__startRemoteInspector(arg0: *bindings.JSGlobalObject, arg1: [*c]u8, arg2: u16) bool;
|
||||
pub extern fn JSC__JSGlobalObject__vm(arg0: *bindings.JSGlobalObject) *bindings.VM;
|
||||
pub extern fn JSC__JSMap__create(arg0: *bindings.JSGlobalObject) JSC__JSValue;
|
||||
pub extern fn JSC__JSMap__get_(arg0: ?*bindings.JSMap, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue) JSC__JSValue;
|
||||
pub extern fn JSC__JSMap__has(arg0: ?*bindings.JSMap, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue) bool;
|
||||
pub extern fn JSC__JSMap__remove(arg0: ?*bindings.JSMap, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue) bool;
|
||||
pub extern fn JSC__JSMap__set(arg0: ?*bindings.JSMap, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue, JSValue3: JSC__JSValue) void;
|
||||
pub extern fn JSC__JSMap__get_(arg0: ?*bindings.Map, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue) JSC__JSValue;
|
||||
pub extern fn JSC__JSMap__has(arg0: ?*bindings.Map, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue) bool;
|
||||
pub extern fn JSC__JSMap__remove(arg0: ?*bindings.Map, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue) bool;
|
||||
pub extern fn JSC__JSMap__set(arg0: ?*bindings.Map, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue, JSValue3: JSC__JSValue) void;
|
||||
pub extern fn JSC__JSValue___then(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue, ArgFn3: ?bun.JSC.JSHostFunctionPtr, ArgFn4: ?bun.JSC.JSHostFunctionPtr) void;
|
||||
pub extern fn JSC__JSValue__asArrayBuffer_(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, arg2: ?*Bun__ArrayBuffer) bool;
|
||||
pub extern fn JSC__JSValue__asBigIntCompare(JSValue0: JSC__JSValue, arg1: *bindings.JSGlobalObject, JSValue2: JSC__JSValue) u8;
|
||||
|
||||
@@ -463,8 +463,8 @@ pub const JestPrettyFormat = struct {
|
||||
.Symbol => .Symbol,
|
||||
.BooleanObject => .Boolean,
|
||||
.JSFunction => .Function,
|
||||
.JSWeakMap, .JSMap => .Map,
|
||||
.JSWeakSet, .JSSet => .Set,
|
||||
.WeakMap, .Map => .Map,
|
||||
.WeakSet, .Set => .Set,
|
||||
.JSDate => .JSON,
|
||||
.JSPromise => .Promise,
|
||||
.Object,
|
||||
@@ -1317,7 +1317,7 @@ pub const JestPrettyFormat = struct {
|
||||
this.quote_strings = true;
|
||||
defer this.quote_strings = prev_quote_strings;
|
||||
|
||||
const map_name = if (value.jsType() == .JSWeakMap) "WeakMap" else "Map";
|
||||
const map_name = if (value.jsType() == .WeakMap) "WeakMap" else "Map";
|
||||
|
||||
if (length == 0) {
|
||||
return writer.print("{s} {{}}", .{map_name});
|
||||
@@ -1347,7 +1347,7 @@ pub const JestPrettyFormat = struct {
|
||||
|
||||
this.writeIndent(Writer, writer_) catch {};
|
||||
|
||||
const set_name = if (value.jsType() == .JSWeakSet) "WeakSet" else "Set";
|
||||
const set_name = if (value.jsType() == .WeakSet) "WeakSet" else "Set";
|
||||
|
||||
if (length == 0) {
|
||||
return writer.print("{s} {{}}", .{set_name});
|
||||
|
||||
Reference in New Issue
Block a user