zig: prefer .jsUndefined() over .undefined for JSValue (#20332)

This commit is contained in:
Meghan Denny
2025-06-12 12:18:46 -08:00
committed by GitHub
parent d6590c4bfa
commit dedd433cbf
84 changed files with 569 additions and 574 deletions

View File

@@ -54,12 +54,12 @@ pub fn setCwd(this: *ParsedShellScript, globalThis: *JSGlobalObject, callframe:
};
const str = try bun.String.fromJS(str_js, globalThis);
this.cwd = str;
return .undefined;
return .jsUndefined();
}
pub fn setQuiet(this: *ParsedShellScript, _: *JSGlobalObject, _: *JSC.CallFrame) bun.JSError!JSC.JSValue {
this.quiet = true;
return .undefined;
return .jsUndefined();
}
pub fn setEnv(this: *ParsedShellScript, globalThis: *JSGlobalObject, callframe: *JSC.CallFrame) bun.JSError!JSC.JSValue {
@@ -82,7 +82,7 @@ pub fn setEnv(this: *ParsedShellScript, globalThis: *JSGlobalObject, callframe:
while (try object_iter.next()) |key| {
const keyslice = key.toOwnedSlice(bun.default_allocator) catch bun.outOfMemory();
var value = object_iter.value;
if (value == .undefined) continue;
if (value.isUndefined()) continue;
const value_str = try value.getZigString(globalThis);
const slice = value_str.toOwnedSlice(bun.default_allocator) catch bun.outOfMemory();
@@ -97,7 +97,7 @@ pub fn setEnv(this: *ParsedShellScript, globalThis: *JSGlobalObject, callframe:
previous.deinit();
}
this.export_env = env;
return .undefined;
return .jsUndefined();
}
pub fn createParsedShellScript(globalThis: *JSC.JSGlobalObject, callframe: *JSC.CallFrame) bun.JSError!JSValue {

View File

@@ -1137,7 +1137,7 @@ pub const Interpreter = struct {
root.start();
if (globalThis.hasException()) return error.JSError;
return .undefined;
return .jsUndefined();
}
fn ioToJSValue(globalThis: *JSGlobalObject, buf: *bun.ByteList) JSValue {
@@ -1185,13 +1185,13 @@ pub const Interpreter = struct {
const loop = this.event_loop.js;
this.keep_alive.disable();
loop.enter();
_ = resolve.call(globalThis, .undefined, &.{
_ = resolve.call(globalThis, .jsUndefined(), &.{
JSValue.jsNumberFromU16(exit_code),
this.getBufferedStdout(globalThis),
this.getBufferedStderr(globalThis),
}) catch |err| globalThis.reportActiveExceptionAsUnhandled(err);
JSC.Codegen.JSShellInterpreter.resolveSetCached(this_jsvalue, globalThis, .undefined);
JSC.Codegen.JSShellInterpreter.rejectSetCached(this_jsvalue, globalThis, .undefined);
JSC.Codegen.JSShellInterpreter.resolveSetCached(this_jsvalue, globalThis, .jsUndefined());
JSC.Codegen.JSShellInterpreter.rejectSetCached(this_jsvalue, globalThis, .jsUndefined());
loop.exit();
}
}
@@ -1220,8 +1220,8 @@ pub const Interpreter = struct {
this.getBufferedStdout(globalThis),
this.getBufferedStderr(globalThis),
}) catch |err| globalThis.reportActiveExceptionAsUnhandled(err);
JSC.Codegen.JSShellInterpreter.resolveSetCached(this_jsvalue, globalThis, .undefined);
JSC.Codegen.JSShellInterpreter.rejectSetCached(this_jsvalue, globalThis, .undefined);
JSC.Codegen.JSShellInterpreter.resolveSetCached(this_jsvalue, globalThis, .jsUndefined());
JSC.Codegen.JSShellInterpreter.rejectSetCached(this_jsvalue, globalThis, .jsUndefined());
loop.exit();
}
@@ -1269,7 +1269,7 @@ pub const Interpreter = struct {
pub fn setQuiet(this: *ThisInterpreter, _: *JSGlobalObject, _: *JSC.CallFrame) bun.JSError!JSC.JSValue {
log("Interpreter(0x{x}) setQuiet()", .{@intFromPtr(this)});
this.flags.quiet = true;
return .undefined;
return .jsUndefined();
}
pub fn setCwd(this: *ThisInterpreter, globalThis: *JSGlobalObject, callframe: *JSC.CallFrame) bun.JSError!JSC.JSValue {
@@ -1284,7 +1284,7 @@ pub const Interpreter = struct {
},
.result => {},
}
return .undefined;
return .jsUndefined();
}
pub fn setEnv(this: *ThisInterpreter, globalThis: *JSGlobalObject, callframe: *JSC.CallFrame) bun.JSError!JSC.JSValue {
@@ -1308,7 +1308,7 @@ pub const Interpreter = struct {
while (object_iter.next()) |key| {
const keyslice = key.toOwnedSlice(bun.default_allocator) catch bun.outOfMemory();
var value = object_iter.value;
if (value == .undefined) continue;
if (value.isUndefined()) continue;
const value_str = value.getZigString(globalThis);
const slice = value_str.toOwnedSlice(bun.default_allocator) catch bun.outOfMemory();
@@ -1320,7 +1320,7 @@ pub const Interpreter = struct {
this.root_shell.export_env.insert(keyref, valueref);
}
return .undefined;
return .jsUndefined();
}
pub fn isRunning(

View File

@@ -1295,7 +1295,7 @@ pub const PipeReader = struct {
return JSC.MarkedArrayBuffer.fromBytes(bytes, bun.default_allocator, .Uint8Array).toNodeBuffer(globalThis);
},
else => {
return JSC.JSValue.undefined;
return .jsUndefined();
},
}
}