-
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
Fix 3 "Illegal State" bugs in the Angular Indexer #44678
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…exer Previously, the Angular Indexer made an assumption that in any binding to a property of an `ImplicitReceiver`, the property name begins at the start of the binding. This is true for normal reads from `ImplicitReceiver` as the implicit receiver has no representation in the template. However, `ThisReceiver` inherits from `ImplicitReceiver` and _does_ have a template representation. Such a binding looks like `{{this.foo}}`. This commit corrects the logic of the indexer to use the `nameSpan` of the property binding instead of its `sourceSpan` to locate the identifier.
alxhub
added
area: compiler
Issues related to `ngc`, Angular's template compiler
area: language-service
Issues related to Angular's VS Code language service
type: bug/fix
labels
Jan 10, 2022
When parsing a binding with a comment at the end of the expression, the parser previously had logic to offset the parsed spans by the length of the comment. This logic seemed not to serve any useful purpose, and instead resulted in the corruption of the spans. For example, in the expression `{{foo // comment}}`, the parser would map the parsed `foo` `PropertyRead` node at the location of the characters 'ent' from the comment suffix. This commit removes that logic, correcting the parsed spans of such nodes in the presence of comments. Removing this logic does not seem to have caused any tests to fail.
In the `Element` node of a parsed `<svg>` element, the `name` is recorded as `:svg:svg`. When the Angular Indexer ran over this element, it would attempt to find this name in the template text and fail, as the namespace portion of the name was added automatically at parse time and is of course missing from the original template. This commit changes the indexer to detect these namespaced elements and only search for the tag name.
alxhub
force-pushed
the
kythe/illegal-state-bugs
branch
from
January 10, 2022 22:43
0463510
to
3438b51
Compare
crisbeto
reviewed
Jan 10, 2022
atscott
approved these changes
Jan 10, 2022
This PR was merged into the repository by commit 92b23f4. |
atscott
pushed a commit
that referenced
this pull request
Jan 11, 2022
) When parsing a binding with a comment at the end of the expression, the parser previously had logic to offset the parsed spans by the length of the comment. This logic seemed not to serve any useful purpose, and instead resulted in the corruption of the spans. For example, in the expression `{{foo // comment}}`, the parser would map the parsed `foo` `PropertyRead` node at the location of the characters 'ent' from the comment suffix. This commit removes that logic, correcting the parsed spans of such nodes in the presence of comments. Removing this logic does not seem to have caused any tests to fail. PR Close #44678
atscott
pushed a commit
that referenced
this pull request
Jan 11, 2022
In the `Element` node of a parsed `<svg>` element, the `name` is recorded as `:svg:svg`. When the Angular Indexer ran over this element, it would attempt to find this name in the template text and fail, as the namespace portion of the name was added automatically at parse time and is of course missing from the original template. This commit changes the indexer to detect these namespaced elements and only search for the tag name. PR Close #44678
atscott
pushed a commit
that referenced
this pull request
Jan 11, 2022
…exer (#44678) Previously, the Angular Indexer made an assumption that in any binding to a property of an `ImplicitReceiver`, the property name begins at the start of the binding. This is true for normal reads from `ImplicitReceiver` as the implicit receiver has no representation in the template. However, `ThisReceiver` inherits from `ImplicitReceiver` and _does_ have a template representation. Such a binding looks like `{{this.foo}}`. This commit corrects the logic of the indexer to use the `nameSpan` of the property binding instead of its `sourceSpan` to locate the identifier. PR Close #44678
atscott
pushed a commit
that referenced
this pull request
Jan 11, 2022
) When parsing a binding with a comment at the end of the expression, the parser previously had logic to offset the parsed spans by the length of the comment. This logic seemed not to serve any useful purpose, and instead resulted in the corruption of the spans. For example, in the expression `{{foo // comment}}`, the parser would map the parsed `foo` `PropertyRead` node at the location of the characters 'ent' from the comment suffix. This commit removes that logic, correcting the parsed spans of such nodes in the presence of comments. Removing this logic does not seem to have caused any tests to fail. PR Close #44678
atscott
pushed a commit
that referenced
this pull request
Jan 11, 2022
In the `Element` node of a parsed `<svg>` element, the `name` is recorded as `:svg:svg`. When the Angular Indexer ran over this element, it would attempt to find this name in the template text and fail, as the namespace portion of the name was added automatically at parse time and is of course missing from the original template. This commit changes the indexer to detect these namespaced elements and only search for the tag name. PR Close #44678
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
action: merge
The PR is ready for merge by the caretaker
area: compiler
Issues related to `ngc`, Angular's template compiler
area: language-service
Issues related to Angular's VS Code language service
target: patch
This PR is targeted for the next patch release
type: bug/fix
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains 3 commits, each of which fixes a separate crash in the Angular Indexer:
this
as a receiver:{{this.foo}}
{{foo // comment}}
<svg></svg>
Each of these templates would previously crash the indexer.