Context
The Jelly comparison in #1304 showed that codegraph misses 3 JavaScript receiver-typed edges where the receiver type is assigned through a constructor property write:
class UserService {
constructor() {
this.logger = new Logger('UserService'); // property write
}
createUser(data) {
this.logger.error('...'); // ← codegraph misses this (FN)
this.logger.info('...'); // ← codegraph misses this (FN)
}
deleteUser(id) {
this.logger.warn('...'); // ← codegraph misses this (FN)
}
}
Jelly resolves all three correctly because its whole-program points-to analysis tracks property writes (this.logger = new Logger()) and reads them back when resolving this.logger.method().
Codegraph resolves return-type–based receiver-typed edges (e.g. svc = buildService() → UserService → svc.createUser()) but not property-write–based receiver-typed edges.
What's needed
In the import resolver / points-to analysis layer:
- During graph building, record
this.prop = new ClassName() assignments alongside the function/method they appear in
- When resolving a call
this.prop.method(), look up the recorded type for this.prop in the enclosing class
- Use the resolved class type to find the target method (same mechanism as the existing
this.method() receiver-typed resolution)
This is an extension of the existing property-write tracking introduced in Phase 8.3d (feat(resolver): phase 8.3d — object property write tracking in points-to analysis).
Expected impact
+3 edges on the JS fixture (Logger.error, Logger.info, Logger.warn as targets of this.logger.* calls in UserService). Likely helps broadly across all OOP-heavy JS/TS codebases.
References
Context
The Jelly comparison in #1304 showed that codegraph misses 3 JavaScript
receiver-typededges where the receiver type is assigned through a constructor property write:Jelly resolves all three correctly because its whole-program points-to analysis tracks property writes (
this.logger = new Logger()) and reads them back when resolvingthis.logger.method().Codegraph resolves return-type–based receiver-typed edges (e.g.
svc = buildService()→UserService→svc.createUser()) but not property-write–based receiver-typed edges.What's needed
In the import resolver / points-to analysis layer:
this.prop = new ClassName()assignments alongside the function/method they appear inthis.prop.method(), look up the recorded type forthis.propin the enclosing classthis.method()receiver-typed resolution)This is an extension of the existing property-write tracking introduced in Phase 8.3d (
feat(resolver): phase 8.3d — object property write tracking in points-to analysis).Expected impact
+3 edges on the JS fixture (
Logger.error,Logger.info,Logger.warnas targets ofthis.logger.*calls inUserService). Likely helps broadly across all OOP-heavy JS/TS codebases.References
docs/benchmarks/RESOLUTION-COMPARISON.md(PR research(bench): Jelly vs codegraph call resolution comparison on JS/TS fixtures #1304)domain/graph/resolve.tstests/benchmarks/resolution/fixtures/javascript/expected-edges.json