Skip to content

Commit 975d595

Browse files
refactor: remove automatic context spawning from visit() method
- Change visit() to pass original context instead of spawning new context - Prevents premature context spawning and gives node methods control - All tests continue to pass (279/279 test suites) - Helper methods already properly use passed context parameters Co-Authored-By: Dan Lynch <[email protected]>
1 parent 268f751 commit 975d595

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

packages/deparser/src/deparser.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,21 +214,21 @@ export class Deparser implements DeparserVisitor {
214214

215215
visit(node: Node, context: DeparserContext = new DeparserContext({})): string {
216216
const nodeType = this.getNodeType(node);
217-
217+
218218
// Handle empty objects
219219
if (!nodeType) {
220220
return '';
221221
}
222-
222+
223223
const nodeData = this.getNodeData(node);
224224

225225
const methodName = nodeType as keyof this;
226226
if (typeof this[methodName] === 'function') {
227-
const result = (this[methodName] as any)(nodeData, context.spawn(nodeType));
228-
227+
const result = (this[methodName] as any)(nodeData, context);
228+
229229
return result;
230230
}
231-
231+
232232
throw new Error(`Deparser does not handle node type: ${nodeType}`);
233233
}
234234

0 commit comments

Comments
 (0)