diff options
author | 2023-02-07 10:51:36 -0800 | |
---|---|---|
committer | 2023-02-07 10:51:55 -0800 | |
commit | 7886bce8c80b350f243e07e0c571ac6f6183cd14 (patch) | |
tree | bd6c2a5d29ab8a87f28627b14257f60bf4db2801 | |
parent | 7cd26232b12fae36a907722c4f50edd6e2ddf596 (diff) | |
download | bun-7886bce8c80b350f243e07e0c571ac6f6183cd14.tar.gz bun-7886bce8c80b350f243e07e0c571ac6f6183cd14.tar.zst bun-7886bce8c80b350f243e07e0c571ac6f6183cd14.zip |
cleanup
-rw-r--r-- | src/bun.js/scripts/class-definitions.ts | 1 | ||||
-rw-r--r-- | src/bun.js/scripts/generate-classes.ts | 17 |
2 files changed, 13 insertions, 5 deletions
diff --git a/src/bun.js/scripts/class-definitions.ts b/src/bun.js/scripts/class-definitions.ts index 575daa01c..0f06bdbde 100644 --- a/src/bun.js/scripts/class-definitions.ts +++ b/src/bun.js/scripts/class-definitions.ts @@ -17,6 +17,7 @@ export type Field = DOMJIT?: { returns: string; args?: [string, string] | [string, string, string] | [string] | []; + pure?: boolean; }; } & PropertyAttribute) | { internal: true }; diff --git a/src/bun.js/scripts/generate-classes.ts b/src/bun.js/scripts/generate-classes.ts index 73036ef21..765f30d8a 100644 --- a/src/bun.js/scripts/generate-classes.ts +++ b/src/bun.js/scripts/generate-classes.ts @@ -181,7 +181,7 @@ function propRow( DOMJIT, enumerable = true, configurable = false, - } = (defaultPropertyAttributes ? Object.assign({}, prop, defaultPropertyAttributes) : prop) as any; + } = (defaultPropertyAttributes ? Object.assign({}, defaultPropertyAttributes, prop) : prop) as any; var extraPropertyAttributes = ""; if (!enumerable) { @@ -252,10 +252,17 @@ function propRow( export function generateHashTable(nameToUse, symbolName, typeName, obj, props = {}, wrapped) { const rows = []; - const defaultPropertyAttributes = - "enumerable" in obj || "configurable" in obj - ? { enumerable: obj.enumerable, configurable: obj.configurable } - : undefined; + let defaultPropertyAttributes = undefined; + + if ("enumerable" in obj) { + defaultPropertyAttributes ||= {}; + defaultPropertyAttributes.enumerable = obj.enumerable; + } + + if ("configurable" in obj) { + defaultPropertyAttributes ||= {}; + defaultPropertyAttributes.configurable = obj.configurable; + } for (const name in props) { if ("internal" in props[name]) continue; |