Skip to content

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

Merged
kirjs merged 1 commit intoangular:mainfrom
atscott:removeTsAstInAdapter
Apr 14, 2026
Merged

refactor(compiler-cli): decouple SymbolReference from AST nodes in te…#68181
kirjs merged 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

@kirjs kirjs merged commit c2f4b2a into angular:main Apr 14, 2026
24 of 26 checks passed
@kirjs
Copy link
Copy Markdown
Contributor

kirjs commented Apr 14, 2026

This PR was merged into the repository. The changes were merged into the following branches:

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.

3 participants