mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
refactor(compiler): implement let declarations in render3 ast (#55848)
Introduces a new `LetDeclaration` into the Render3 AST, simiarly to the HTML AST, and adds an initial integration into the various visitors. PR Close #55848
This commit is contained in:
committed by
Jessica Janiuk
parent
1ae06e4fc6
commit
9eef041211
@@ -28,6 +28,7 @@ import {
|
||||
TmplAstForLoopBlockEmpty,
|
||||
TmplAstIfBlock,
|
||||
TmplAstIfBlockBranch,
|
||||
TmplAstLetDeclaration,
|
||||
TmplAstNode,
|
||||
TmplAstRecursiveVisitor,
|
||||
TmplAstReference,
|
||||
@@ -351,6 +352,10 @@ class TemplateVisitor extends TmplAstRecursiveVisitor {
|
||||
this.visitAll(block.children);
|
||||
}
|
||||
|
||||
override visitLetDeclaration(decl: TmplAstLetDeclaration): void {
|
||||
this.visitExpression(decl.value);
|
||||
}
|
||||
|
||||
/** Creates an identifier for a template element or template node. */
|
||||
private elementOrTemplateToIdentifier(
|
||||
node: TmplAstElement | TmplAstTemplate,
|
||||
|
||||
@@ -27,6 +27,7 @@ import {
|
||||
TmplAstIcu,
|
||||
TmplAstIfBlock,
|
||||
TmplAstIfBlockBranch,
|
||||
TmplAstLetDeclaration,
|
||||
TmplAstNode,
|
||||
TmplAstRecursiveVisitor,
|
||||
TmplAstReference,
|
||||
@@ -264,6 +265,10 @@ class TemplateVisitor<Code extends ErrorCode>
|
||||
this.visitAllNodes(block.children);
|
||||
}
|
||||
|
||||
visitLetDeclaration(decl: TmplAstLetDeclaration): void {
|
||||
this.visitAst(decl.value);
|
||||
}
|
||||
|
||||
getDiagnostics(template: TmplAstNode[]): NgTemplateDiagnostic<Code>[] {
|
||||
this.diagnostics = [];
|
||||
this.visitAllNodes(template);
|
||||
|
||||
Reference in New Issue
Block a user