This commit is contained in:
dave caruso
2024-12-19 11:01:00 -08:00
parent 290e3769be
commit edf646fb77
5 changed files with 17 additions and 16 deletions

View File

@@ -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,
});

View File

@@ -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"),
});

View File

@@ -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;
}

View File

@@ -70,7 +70,7 @@ interface TypeDataDefs {
oneOf: TypeImpl[];
dictionary: DictionaryField[];
}
type TypeData<K extends TypeKind> = K extends keyof TypeDataDefs ? TypeDataDefs[K] : any;
export type TypeData<K extends TypeKind> = K extends keyof TypeDataDefs ? TypeDataDefs[K] : any;
export const enum NodeValidator {
validateInteger = "validateInteger",

View File

@@ -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}`);
}