no usingnamespace, organize jsc namespace, enable -fincremental (#19122)

Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com>
This commit is contained in:
chloe caruso
2025-04-22 16:34:15 -07:00
committed by GitHub
parent 842fe8664e
commit 3349c995b5
271 changed files with 30131 additions and 30868 deletions

View File

@@ -1127,7 +1127,7 @@ const headers = new Set<string>();
zig.line('const bun = @import("bun");');
zig.line("const JSC = bun.JSC;");
zig.line("const JSHostFunctionType = JSC.JSHostFunctionType;\n");
zig.line("const JSHostFunctionType = JSC.JSHostFn;\n");
zigInternal.line("const binding_internals = struct {");
zigInternal.indent();
@@ -1446,7 +1446,7 @@ for (const [filename, { functions, typedefs }] of files) {
const minArgCount = fn.variants.reduce((acc, vari) => Math.min(acc, vari.args.length), Number.MAX_SAFE_INTEGER);
zig.line(`pub fn ${wrapperName}(global: *JSC.JSGlobalObject) callconv(JSC.conv) JSC.JSValue {`);
zig.line(
` return JSC.NewRuntimeFunction(global, JSC.ZigString.static(${str(fn.name)}), ${minArgCount}, js${cap(fn.name)}, false, false, null);`,
` return JSC.host_fn.NewRuntimeFunction(global, JSC.ZigString.static(${str(fn.name)}), ${minArgCount}, js${cap(fn.name)}, false, false, null);`,
);
zig.line(`}`);
}

View File

@@ -1919,7 +1919,7 @@ const JavaScriptCoreBindings = struct {
output += `
pub fn ${classSymbolName(typeName, "call")}(globalObject: *JSC.JSGlobalObject, callFrame: *JSC.CallFrame) callconv(JSC.conv) JSC.JSValue {
if (comptime Environment.enable_logs) log_zig_call("${typeName}", callFrame);
return @call(.always_inline, JSC.toJSHostFunction(${typeName}.call), .{globalObject, callFrame});
return @call(.always_inline, JSC.toJSHostFn(${typeName}.call), .{globalObject, callFrame});
}
`;
}
@@ -2019,7 +2019,7 @@ const JavaScriptCoreBindings = struct {
output += `
pub fn ${names.fn}(globalObject: *JSC.JSGlobalObject, callFrame: *JSC.CallFrame) callconv(JSC.conv) JSC.JSValue {
if (comptime Environment.enable_logs) log_zig_class_method("${typeName}", "${name}", callFrame);
return @call(.always_inline, JSC.toJSHostFunction(${typeName}.${fn}), .{globalObject, callFrame});
return @call(.always_inline, JSC.toJSHostFn(${typeName}.${fn}), .{globalObject, callFrame});
}
`;
}
@@ -2353,7 +2353,7 @@ const wrapGetterWithValueCallback = bun.gen_classes_lib.wrapGetterWithValueCallb
pub const StaticGetterType = fn(*JSC.JSGlobalObject, JSC.JSValue, JSC.JSValue) callconv(JSC.conv) JSC.JSValue;
pub const StaticSetterType = fn(*JSC.JSGlobalObject, JSC.JSValue, JSC.JSValue, JSC.JSValue) callconv(JSC.conv) bool;
pub const StaticCallbackType = JSC.JSHostFunctionType;
pub const StaticCallbackType = JSC.JSHostFn;
pub const WriteBytesFn = *const fn(*anyopaque, ptr: [*]const u8, len: u32) callconv(JSC.conv) void;
`;

View File

@@ -227,7 +227,7 @@ export function getJS2NativeZig(gs2NativeZigPath: string) {
filename: x.filename,
})}(global: *JSC.JSGlobalObject, call_frame: *JSC.CallFrame) callconv(JSC.conv) JSC.JSValue {`,
` const function = @import(${JSON.stringify(path.relative(path.dirname(gs2NativeZigPath), x.filename))});`,
` return @call(.always_inline, JSC.toJSHostFunction(function.${x.symbol_target}), .{global, call_frame});`,
` return @call(.always_inline, JSC.toJSHostFn(function.${x.symbol_target}), .{global, call_frame});`,
"}",
]),
"comptime {",

View File

@@ -92,7 +92,7 @@ for (let [code, constructor, name, ...other_constructors] of NodeErrors) {
if (name == null) name = constructor.name;
// it's useful to avoid the prefix, but module not found has a prefixed and unprefixed version
const codeWithoutPrefix = code === "ERR_MODULE_NOT_FOUND" ? code : code.replace(/^ERR_/, "");
const codeWithoutPrefix = code === 'ERR_MODULE_NOT_FOUND' ? code : code.replace(/^ERR_/, '');
enumHeader += ` ${code} = ${i},\n`;
listHeader += ` { JSC::ErrorType::${constructor.name}, "${name}"_s, "${code}"_s },\n`;