mirror of
https://github.com/oven-sh/bun
synced 2026-02-14 04:49:06 +00:00
Refactor Zig imports and file structure (part 1) (#21270)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -1,24 +1,25 @@
|
||||
pub const ERR_INVALID_HANDLE_TYPE = createSimpleError(createTypeError, .ERR_INVALID_HANDLE_TYPE, "This handle type cannot be sent");
|
||||
pub const ERR_CHILD_CLOSED_BEFORE_REPLY = createSimpleError(createError, .ERR_CHILD_CLOSED_BEFORE_REPLY, "Child closed before reply received");
|
||||
|
||||
fn createSimpleError(comptime createFn: anytype, comptime code: JSC.Node.ErrorCode, comptime message: string) JSC.JS2NativeFunctionType {
|
||||
fn createSimpleError(comptime createFn: anytype, comptime code: jsc.Node.ErrorCode, comptime message: string) jsc.JS2NativeFunctionType {
|
||||
const R = struct {
|
||||
pub fn cbb(global: *JSC.JSGlobalObject) bun.JSError!JSC.JSValue {
|
||||
pub fn cbb(global: *jsc.JSGlobalObject) bun.JSError!jsc.JSValue {
|
||||
const S = struct {
|
||||
fn cb(globalThis: *JSC.JSGlobalObject, callframe: *JSC.CallFrame) bun.JSError!JSC.JSValue {
|
||||
fn cb(globalThis: *jsc.JSGlobalObject, callframe: *jsc.CallFrame) bun.JSError!jsc.JSValue {
|
||||
_ = callframe;
|
||||
return createFn(globalThis, code, message, .{});
|
||||
}
|
||||
};
|
||||
return JSC.JSFunction.create(global, @tagName(code), S.cb, 0, .{});
|
||||
return jsc.JSFunction.create(global, @tagName(code), S.cb, 0, .{});
|
||||
}
|
||||
};
|
||||
return R.cbb;
|
||||
}
|
||||
|
||||
const bun = @import("bun");
|
||||
const JSC = bun.JSC;
|
||||
const string = bun.string;
|
||||
const string = []const u8;
|
||||
|
||||
const createError = JSC.JSGlobalObject.createErrorInstanceWithCode;
|
||||
const createTypeError = JSC.JSGlobalObject.createTypeErrorInstanceWithCode;
|
||||
const bun = @import("bun");
|
||||
const jsc = bun.jsc;
|
||||
|
||||
const createError = jsc.JSGlobalObject.createErrorInstanceWithCode;
|
||||
const createTypeError = jsc.JSGlobalObject.createTypeErrorInstanceWithCode;
|
||||
|
||||
Reference in New Issue
Block a user