From edf646fb771a2005abac8a165270dc009e5dbf0c Mon Sep 17 00:00:00 2001 From: dave caruso Date: Thu, 19 Dec 2024 11:01:00 -0800 Subject: [PATCH] waa --- src/bun.js/bindgen_test.bind.ts | 10 ++++++++++ src/bun.js/webcore/request.bind.ts | 10 ---------- src/bun.js/webcore/request.zig | 6 +----- src/codegen/bindgen-lib-internal.ts | 2 +- src/codegen/bindgen.ts | 5 +++++ 5 files changed, 17 insertions(+), 16 deletions(-) delete mode 100644 src/bun.js/webcore/request.bind.ts diff --git a/src/bun.js/bindgen_test.bind.ts b/src/bun.js/bindgen_test.bind.ts index 9093ffd0b9..8abf228ee5 100644 --- a/src/bun.js/bindgen_test.bind.ts +++ b/src/bun.js/bindgen_test.bind.ts @@ -18,3 +18,13 @@ export const requiredAndOptionalArg = fn({ }, ret: t.i32, }); + +// export const HeadersInit = t.oneOf(t.sequence(t.sequence(t.ByteString)), t.record(t.ByteString)); +export const HeadersInit = t.sequence(t.DOMString); + +export const headersInit = fn({ + args: { + a: HeadersInit, + }, + ret: t.i32, +}); diff --git a/src/bun.js/webcore/request.bind.ts b/src/bun.js/webcore/request.bind.ts deleted file mode 100644 index d77ee77f49..0000000000 --- a/src/bun.js/webcore/request.bind.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { t, fn } from "bindgen"; - -export const clone = fn({ - this: t.externalClass("Request"), - args: { - global: t.globalObject, - this_js: t.anyThisValue, - }, - ret: t.externalClass("Request"), -}); diff --git a/src/bun.js/webcore/request.zig b/src/bun.js/webcore/request.zig index f0bf113599..d8dafb0e79 100644 --- a/src/bun.js/webcore/request.zig +++ b/src/bun.js/webcore/request.zig @@ -758,10 +758,7 @@ pub const Request = struct { } pub fn constructor(globalThis: *JSC.JSGlobalObject, callframe: *JSC.CallFrame) bun.JSError!*Request { - const arguments_ = callframe.arguments_old(2); - const arguments = arguments_.ptr[0..arguments_.len]; - - const request = try constructInto(globalThis, arguments); + const request = try constructInto(globalThis, callframe.arguments()); return Request.new(request); } @@ -800,7 +797,6 @@ pub const Request = struct { } } } - return js_wrapper; } diff --git a/src/codegen/bindgen-lib-internal.ts b/src/codegen/bindgen-lib-internal.ts index 47f92f3521..235ee17c66 100644 --- a/src/codegen/bindgen-lib-internal.ts +++ b/src/codegen/bindgen-lib-internal.ts @@ -70,7 +70,7 @@ interface TypeDataDefs { oneOf: TypeImpl[]; dictionary: DictionaryField[]; } -type TypeData = K extends keyof TypeDataDefs ? TypeDataDefs[K] : any; +export type TypeData = K extends keyof TypeDataDefs ? TypeDataDefs[K] : any; export const enum NodeValidator { validateInteger = "validateInteger", diff --git a/src/codegen/bindgen.ts b/src/codegen/bindgen.ts index f40ab0bffe..072ece8924 100644 --- a/src/codegen/bindgen.ts +++ b/src/codegen/bindgen.ts @@ -33,6 +33,7 @@ import { NodeValidator, cAbiIntegerLimits, extInternalDispatchVariant, + TypeData, } from "./bindgen-lib-internal"; import assert from "node:assert"; import { argParse, readdirRecursiveWithExclusionsAndExtensionsSync, writeIfNotChanged } from "./helpers"; @@ -139,6 +140,10 @@ function resolveComplexArgumentStrategy( } switch (type.kind) { + case "sequence": { + const child = type.data as TypeData<"sequence">; + break; + } default: throw new Error(`TODO: resolveComplexArgumentStrategy for ${type.kind}`); }