-
Notifications
You must be signed in to change notification settings - Fork 24.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ivy LS: TemplateTypeChecker
operation to get ts.Symbol
for input
#38063
Labels
area: compiler
Issues related to `ngc`, Angular's template compiler
area: language-service
Issues related to Angular's VS Code language service
feature
Issue that requests a new feature
Projects
Milestone
Comments
atscott
added a commit
to atscott/angular
that referenced
this issue
Aug 11, 2020
…eTypeChecker Adds the ability to get the `ts.Symbol`s for the Directive and/or Component that an input in a template binds to. Fixes angular#38063
atscott
added a commit
to atscott/angular
that referenced
this issue
Aug 11, 2020
…eTypeChecker Adds the ability to get the `ts.Symbol`s for the Directive and/or Component that an input in a template binds to. Fixes angular#38063
atscott
added a commit
to atscott/angular
that referenced
this issue
Aug 13, 2020
…eTypeChecker Adds the ability to get the `ts.Symbol`s for the Directive and/or Component that an input in a template binds to. Fixes angular#38063
atscott
added a commit
to atscott/angular
that referenced
this issue
Aug 27, 2020
…eTypeChecker Adds the ability to get the `ts.Symbol`s for the Directive and/or Component that an input in a template binds to. Fixes angular#38063 feat(compiler-cli): Add ability to retrieve symbol from ast Add `TemplateTypeChecker` operation to retrieve the `ts.Symbol` of an AST expression from a template. Not all expressions will have symbols (e.g. there is no symbol associated with the expression a + b, but there are symbols for both the a and b nodes individually). Sometimes we need to traverse an intermediate variable declaration to arrive at the correct `ts.Symbol`. For example, loop variables are declared using an intermediate: ``` <div *ngFor="let user of users"> {{user.name}} </div> ``` Getting the symbol of user here (from the expression) is tricky, because the TCB looks like: ``` var _t0 = ...; // type of NgForOf var _t1: any; // context of embedded view for NgForOf structural directive if (NgForOf.ngTemplateContextGuard(_t0, _t1)) { // _t1 is now NgForOfContext<...> var _t2 = _t1.$implicit; // let user = '$implicit' _t2.name; // user.name expression } ``` Just getting the `ts.Expression` for the `AST` node `PropRead(ImplicitReceiver, 'user')` via the sourcemaps will yield the `_t2` expression. This function recognizes that `_t2` is an aliasing variable declared locally in the TCB, and actually fetch the `ts.Symbol` of its initializer. There is also similar special case handling for `#ref` local references as well. Resolves angular#38064 feat(compiler-cli): Add ability to retrieve type from ast This adds the ability to retrieve type from template ast
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
area: compiler
Issues related to `ngc`, Angular's template compiler
area: language-service
Issues related to Angular's VS Code language service
feature
Issue that requests a new feature
Add a
TemplateTypeChecker
operation to retrieve ats.Symbol
given a pointer to an input binding within the template AST. This can potentially be resolved without referring to the TCB.The text was updated successfully, but these errors were encountered: