Skip to content

Commit a004e25

Browse files
committed
fix(extractor): remove duplicate extractPrototypeMethodsWalk calls
Both extractSymbolsQuery and extractSymbolsWalk had a second call to extractPrototypeMethodsWalk appended at the bottom, causing prototype methods to be extracted twice. Remove the duplicate from each path. The duplication caused a ~44% WASM benchmark regression on the query path (used by wasm-worker-entry.js in benchmarks).
1 parent 41d7811 commit a004e25

1 file changed

Lines changed: 0 additions & 5 deletions

File tree

src/extractors/javascript.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -354,9 +354,6 @@ function extractSymbolsQuery(tree: TreeSitterTree, query: TreeSitterQuery): Extr
354354
// Extract definitions from destructured bindings (query patterns don't match object_pattern)
355355
extractDestructuredBindingsWalk(tree.rootNode, definitions);
356356

357-
// Pre-ES6 prototype methods: `Foo.prototype.bar = fn` and `Foo.prototype = { bar: fn }`
358-
extractPrototypeMethodsWalk(tree.rootNode, definitions, typeMap);
359-
360357
// Phase 8.5: collect all `new X()` constructor names for RTA instantiation tracking
361358
const newExpressions: string[] = [];
362359
extractNewExpressionsWalk(tree.rootNode, newExpressions);
@@ -622,8 +619,6 @@ function extractSymbolsWalk(tree: TreeSitterTree): ExtractorOutput {
622619
extractPrototypeMethodsWalk(tree.rootNode, ctx.definitions, ctx.typeMap!);
623620
// Phase 8.3c: Extract call-site argument bindings for parameter-flow pts analysis
624621
extractParamBindingsWalk(tree.rootNode, ctx.paramBindings!);
625-
// Pre-ES6 prototype methods: `Foo.prototype.bar = fn` and `Foo.prototype = { bar: fn }`
626-
extractPrototypeMethodsWalk(tree.rootNode, ctx.definitions, ctx.typeMap!);
627622
// Phase 8.5: collect all `new X()` constructor names for RTA instantiation tracking
628623
const newExpressions: string[] = [];
629624
extractNewExpressionsWalk(tree.rootNode, newExpressions);

0 commit comments

Comments
 (0)