Pattern
When a function is registered as a getter or setter via `Object.defineProperty`, `this` inside that function refers to the object the property was defined on. Codegraph does not resolve `this.method()` calls inside such accessors.
Failing example (from Jelly micro-test `accessors3.js`)
```js
const obj = {
baz: () => { console.log("baz"); },
};
function getter() {
this.baz(); // this === obj when invoked as obj's accessor
}
Object.defineProperty(obj, "bar", { get: getter });
const x = obj.bar; // invokes getter, which calls obj.baz
```
Expected edge: `getter → baz` (via `this.baz()` with `this === obj`) — not resolved.
Relationship to #1320
Issue #1320 tracks resolving calls to functions installed via `Object.defineProperty` (i.e. the getter/setter themselves as callees). This issue is distinct: it's about `this`-dispatch inside accessor functions once they are called — knowing that `this` is bound to the descriptor's target object.
What's needed
- Track that `getter` is used as a `get`/`set` descriptor for `obj` (via `Object.defineProperty`)
- When resolving `this.baz()` inside `getter`, use `obj` as the receiver type
Benchmark evidence
Jelly micro-test corpus (`tests/benchmarks/resolution/fixtures/jelly-micro/accessors3/`):
Pattern
When a function is registered as a getter or setter via `Object.defineProperty`, `this` inside that function refers to the object the property was defined on. Codegraph does not resolve `this.method()` calls inside such accessors.
Failing example (from Jelly micro-test `accessors3.js`)
```js
const obj = {
baz: () => { console.log("baz"); },
};
function getter() {
this.baz(); // this === obj when invoked as obj's accessor
}
Object.defineProperty(obj, "bar", { get: getter });
const x = obj.bar; // invokes getter, which calls obj.baz
```
Expected edge: `getter → baz` (via `this.baz()` with `this === obj`) — not resolved.
Relationship to #1320
Issue #1320 tracks resolving calls to functions installed via `Object.defineProperty` (i.e. the getter/setter themselves as callees). This issue is distinct: it's about `this`-dispatch inside accessor functions once they are called — knowing that `this` is bound to the descriptor's target object.
What's needed
Benchmark evidence
Jelly micro-test corpus (`tests/benchmarks/resolution/fixtures/jelly-micro/accessors3/`):