Pattern
When a function is used as a namespace-like object with methods assigned as properties, and one of those methods calls `this.other()`, codegraph does not resolve the callee.
Failing example (from Jelly micro-test `this.js`)
```js
function f() {}
f.g = function() { console.log("2"); }
f.h = function() {
this.g(); // this === f when called as f.h()
}
f.h();
```
Expected edge: `f.h → f.g` — not resolved.
Also from the same test, `this.bar()` inside an arrow function returned from an object method:
```js
const o = {
foo() { return () => this.bar(); },
bar() { console.log("3"); },
};
```
Why it's hard
Existing this-dispatch logic is scoped to class bodies. For function-property objects (`fn.method = function() { this.other(); }`), the receiver at call-site `fn.method()` is `fn` itself — not a class instance. Resolving requires:
- Detecting the call form `fn.method()` at the call site → receiver is `fn`
- Looking up `fn.other` as the callee for `this.other()` inside `method`
Benchmark evidence
Jelly micro-test corpus (tests/benchmarks/resolution/fixtures/jelly-micro/this/):
Pattern
When a function is used as a namespace-like object with methods assigned as properties, and one of those methods calls `this.other()`, codegraph does not resolve the callee.
Failing example (from Jelly micro-test `this.js`)
```js
function f() {}
f.g = function() { console.log("2"); }
f.h = function() {
this.g(); // this === f when called as f.h()
}
f.h();
```
Expected edge: `f.h → f.g` — not resolved.
Also from the same test, `this.bar()` inside an arrow function returned from an object method:
```js
const o = {
foo() { return () => this.bar(); },
bar() { console.log("3"); },
};
```
Why it's hard
Existing this-dispatch logic is scoped to class bodies. For function-property objects (`fn.method = function() { this.other(); }`), the receiver at call-site `fn.method()` is `fn` itself — not a class instance. Resolving requires:
Benchmark evidence
Jelly micro-test corpus (
tests/benchmarks/resolution/fixtures/jelly-micro/this/):