Skip to content

typescript: a class property initialised with an arrow is a method named for its field - #1787

Merged
swapnilpaliwal-sd merged 1 commit into
0.1.9from
loop/ty-is636
Sep 29, 2026
Merged

swapnilpaliwal-sd merged 1 commit into
0.1.9from
loop/ty-is636

Conversation

@swapnilpaliwal-sd

Copy link
Copy Markdown
Contributor

The last open resolver rule from #636: a class property initialised with an arrow (handler = () => {…}) was indexed as Svc.<arrow> next to a field Svc.handler, so this.handler(), which the engine resolves to the arrow, only reached Svc.handler as [in scope].

  • The TypeScript adapter now names the arrow after its field (field initializerExpressionLinkHash → the expression's anonymousDeclarationHash), the same way const foo = () => … is already handled.
  • The field or variable row that names the arrow is dropped at its own line, so a property written over several lines is one member, not a field plus a method.
  • Control: throttled = debounce(() => …) stays a field.
  • New golden case: tests/cases/typescript/class-property-arrow (2/5 before, 5/5 after).
  • This repo's TS graph: 8 members renamed, fields 8149 → 8141, names declared as two kinds 112 → 109, call edges 40013 unchanged. A real Angular app: 761 symbols / 2266 edges, unchanged.
  • TS suite 161/163, JS 230/232. The failing checks fail the same way on the base (pipeline-array-dispatch is marked pending but passes; JS field-initializer-is-a-sibling and wrapped-handler-route).

Closes #636

…med for its field

`handler = () => {…}` was indexed as Svc.<arrow> beside a field Svc.handler, so
this.handler(), which the engine resolves to the arrow, never reached Svc.handler
(the caller showed only as [in scope]). The field's initializer is the arrow's
expression row, whose anonymousDeclarationHash is the method: name it for the
field, as const foo = () => … already is. The bound field or variable row is
dropped by its own line, so a property written over several lines is one member.
A property whose initializer is a call wrapping an arrow stays a field.

Co-authored-by: axiomcode-bot[bot] <334110751+axiomcode-bot[bot]@users.noreply.github.com>
@swapnilpaliwal-sd
swapnilpaliwal-sd merged commit 4f92d82 into 0.1.9 Sep 29, 2026
12 checks passed
@swapnilpaliwal-sd
swapnilpaliwal-sd deleted the loop/ty-is636 branch September 29, 2026 07:37
swapnilpaliwal-sd added a commit that referenced this pull request Sep 29, 2026
Conflict in axiomcode-index with #1787: keep 0.1.9's field-bound names
and this branch's member names; the owner line stays this branch's.

Co-authored-by: axiomcode-bot[bot] <334110751+axiomcode-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant