Skip to content

Commit

Permalink
Simple approach
Browse files Browse the repository at this point in the history
  • Loading branch information
JoviDeCroock committed Dec 16, 2024
1 parent e53c6ce commit 30e61f3
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions src/language/visitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,23 +222,9 @@ export function visit(
}
}
} else {
const descriptors = Object.getOwnPropertyDescriptors(node);
node = { ...node };
for (const nodeKey of Object.keys(descriptors)) {
if (!(nodeKey in node)) {
const descriptor = descriptors[nodeKey];
if (
descriptor.enumerable &&
descriptor.configurable &&
descriptor.writable &&
!descriptor.get &&
!descriptor.set
) {
// We already own this by means of the spread
} else {
Object.defineProperty(node, nodeKey, descriptor);
}
}
for (const [editKey, editValue] of edits) {
node[editKey] = editValue;
}
}
}
Expand Down

0 comments on commit 30e61f3

Please sign in to comment.