mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
createEmptyObjectWithNullPrototype
This commit is contained in:
@@ -1601,15 +1601,10 @@ JSC__JSObject__create(JSC__JSGlobalObject* globalObject, size_t initialCapacity,
|
||||
return JSC::JSValue::encode(object);
|
||||
}
|
||||
|
||||
JSC__JSValue JSC__JSValue__constructEmptyObject(JSC__JSGlobalObject* globalObject,
|
||||
JSC__JSObject* prototype,
|
||||
size_t initialCapacity)
|
||||
JSC__JSValue JSC__JSValue__createEmptyObjectWithNullPrototype(JSC__JSGlobalObject* globalObject)
|
||||
{
|
||||
if (prototype == nullptr) {
|
||||
return JSC::JSValue::encode(JSC::constructEmptyObject(globalObject->vm(), globalObject->nullPrototypeObjectStructure()));
|
||||
} else {
|
||||
return JSC::JSValue::encode(JSC::constructEmptyObject(globalObject, prototype, std::min(static_cast<unsigned int>(initialCapacity), JSFinalObject::maxInlineCapacity)));
|
||||
}
|
||||
return JSValue::encode(
|
||||
JSC::constructEmptyObject(globalObject->vm(), globalObject->nullPrototypeObjectStructure()));
|
||||
}
|
||||
|
||||
JSC__JSValue JSC__JSValue__createEmptyObject(JSC__JSGlobalObject* globalObject,
|
||||
|
||||
@@ -3555,11 +3555,10 @@ pub const JSValue = enum(JSValueReprInt) {
|
||||
return JSC__jsTypeStringForValue(globalObject, this);
|
||||
}
|
||||
|
||||
extern fn JSC__JSValue__constructEmptyObject(globalObject: *JSGlobalObject, prototype: [*c]JSC.JSObject, len: usize) JSValue;
|
||||
extern fn JSC__JSValue__createEmptyObjectWithNullPrototype(globalObject: *JSGlobalObject) JSValue;
|
||||
|
||||
/// Creates a new empty object with the specified prototype, or no prototype if null
|
||||
pub fn constructEmptyObject(global: *JSGlobalObject, prototype: ?*JSC.JSObject, len: usize) JSValue {
|
||||
return JSC__JSValue__constructEmptyObject(global, prototype, len);
|
||||
pub fn createEmptyObjectWithNullPrototype(global: *JSGlobalObject) JSValue {
|
||||
return JSC__JSValue__createEmptyObjectWithNullPrototype(global);
|
||||
}
|
||||
|
||||
/// Creates a new empty object, with Object as its prototype
|
||||
|
||||
@@ -622,7 +622,7 @@ pub fn parseArgs(globalThis: *JSGlobalObject, config_obj: JSValue) !JSValue {
|
||||
log("Phase 2: parse options from tokens (tokens.len={d})", .{tokens.items.len});
|
||||
|
||||
// note that "values" needs to have a null prototype instead of Object, to avoid issues such as "values.toString"` being defined
|
||||
var result_values = JSValue.constructEmptyObject(globalThis, null, 0);
|
||||
var result_values = JSValue.createEmptyObjectWithNullPrototype(globalThis);
|
||||
var result_positionals = JSC.JSValue.createEmptyArray(globalThis, 0);
|
||||
var result_positionals_len: u32 = 0;
|
||||
for (tokens.items) |t| {
|
||||
|
||||
Reference in New Issue
Block a user