tweaks to generator

This commit is contained in:
Jarred Sumner
2023-02-06 19:27:21 -08:00
parent ed72bee373
commit 77974f2a6e
2 changed files with 167 additions and 415 deletions

View File

@@ -1,19 +1,24 @@
interface PropertyAttribute {
enumerable?: boolean;
configurable?: boolean;
}
export type Field =
| { getter: string; cache?: true | string; this?: boolean }
| { setter: string; this?: boolean }
| {
| ({ getter: string; cache?: true | string; this?: boolean } & PropertyAttribute)
| ({ setter: string; this?: boolean } & PropertyAttribute)
| ({
accessor: { getter: string; setter: string };
cache?: true | string;
this?: boolean;
}
| {
} & PropertyAttribute)
| ({
fn: string;
length?: number;
DOMJIT?: {
returns: string;
args?: [string, string] | [string, string, string] | [string];
};
}
} & PropertyAttribute)
| { internal: true };
export interface ClassDefinition {
@@ -31,6 +36,9 @@ export interface ClassDefinition {
isEventEmitter?: boolean;
custom?: Record<string, CustomField>;
configurable?: boolean;
enumerable?: boolean;
}
export interface CustomField {
@@ -57,11 +65,7 @@ export function define(
construct,
estimatedSize,
values,
klass: Object.fromEntries(
Object.entries(klass).sort(([a], [b]) => a.localeCompare(b)),
),
proto: Object.fromEntries(
Object.entries(proto).sort(([a], [b]) => a.localeCompare(b)),
),
klass: Object.fromEntries(Object.entries(klass).sort(([a], [b]) => a.localeCompare(b))),
proto: Object.fromEntries(Object.entries(proto).sort(([a], [b]) => a.localeCompare(b))),
};
}

File diff suppressed because it is too large Load Diff