forked from angular/angular
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(compiler): Drop the explicit
this.
in most explicit receivers
Consider a case when an explicit `this` read is inside a template with a context that also provides the variable name being read: ``` <ng-template let-a>{{this.a}}</ng-template> ``` Clearly, `this.a` should refer to the class property `a`. However, in today's Angular, `this.a` will refer to `let-a` on the template context. Amazingly, both TemplateDefinitionBuilder and the Typecheck block have the same bug, and are consistent with each other! This is because `ImplicitReceiver` extends `ThisReceiver` in the parser AST, which is an insane gotcha. In this commit, I patch the template pipeline to emulate this behavior as well. To actually fix this nastiness, we have to: - Update `ingest.ts` in the Template Pipeline (see the corresponding comment) - Check `type_check_block.ts` in the Typecheck block code (see the corresponding comment) - Turn off legacy TemplateDefinitionBuilder - Fix g3, and release in a major version
- Loading branch information
Showing
4 changed files
with
40 additions
and
3 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -399,8 +399,7 @@ | |
{ | ||
"failureMessage": "Incorrect template" | ||
} | ||
], | ||
"skipForTemplatePipeline": true | ||
] | ||
} | ||
] | ||
} |
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
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