Skip to content

refactor(compiler-cli): decouple SymbolReference from AST nodes in te…#68181

Open
atscott wants to merge 1 commit intoangular:mainfrom
atscott:removeTsAstInAdapter
Open

refactor(compiler-cli): decouple SymbolReference from AST nodes in te…#68181
atscott wants to merge 1 commit intoangular:mainfrom
atscott:removeTsAstInAdapter

Conversation

@atscott
Copy link
Copy Markdown
Contributor

@atscott atscott commented Apr 13, 2026

…mplate checker

To support the need to resolve symbols without full AST access (e.g. when using virtual files), this commit decouples ReferenceSymbol from ts.ClassDeclaration.

Changes:

  • Updated ReferenceSymbol.target to use SymbolReference instead of ts.ClassDeclaration.
  • Removed getReferenceTargetNode() from SymbolDirectiveMeta and transitioned to getSymbolReference().
  • Refactored getTsSymbolOfReference in checker.ts to handle SymbolReference and resolve it to a ts.Symbol using a position-optimized AST traversal. This avoids using the private getTokenAtPosition API and avoids full file scans by only traversing nodes containing the target position.

…mplate checker

To support the need to resolve symbols without full AST access (e.g. when using virtual files), this commit decouples `ReferenceSymbol` from `ts.ClassDeclaration`.

Changes:
- Updated `ReferenceSymbol.target` to use `SymbolReference` instead of `ts.ClassDeclaration`.
- Removed `getReferenceTargetNode()` from `SymbolDirectiveMeta` and transitioned to `getSymbolReference()`.
- Refactored `getTsSymbolOfReference` in `checker.ts` to handle `SymbolReference` and resolve it to a `ts.Symbol` using a position-optimized AST traversal. This avoids using the private `getTokenAtPosition` API and avoids full file scans by only traversing nodes containing the target position.
@atscott atscott requested a review from crisbeto April 13, 2026 19:18
@atscott atscott added the target: patch This PR is targeted for the next patch release label Apr 13, 2026
@angular-robot angular-robot bot added the area: compiler Issues related to `ngc`, Angular's template compiler label Apr 13, 2026
@ngbot ngbot bot added this to the Backlog milestone Apr 13, 2026
@atscott atscott added action: merge The PR is ready for merge by the caretaker merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note labels Apr 13, 2026
@atscott
Copy link
Copy Markdown
Contributor Author

atscott commented Apr 13, 2026

caretaker: unrelated failures

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: compiler Issues related to `ngc`, Angular's template compiler merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants