From 7886bce8c80b350f243e07e0c571ac6f6183cd14 Mon Sep 17 00:00:00 2001 From: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Date: Tue, 7 Feb 2023 10:51:36 -0800 Subject: cleanup --- src/bun.js/scripts/generate-classes.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src/bun.js/scripts/generate-classes.ts') 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; -- cgit v1.2.3