mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
refactor(compiler): write expressions in the template pipeline (#50118)
This commit adds ingest and transformation support for property writes and keyed writes to the template pipeline. PR Close #50118
This commit is contained in:
parent
a48c5f72a6
commit
6984431dde
2 changed files with 15 additions and 0 deletions
|
|
@ -510,6 +510,13 @@ export function transformExpressionsInExpression(
|
|||
} else if (expr instanceof o.ReadKeyExpr) {
|
||||
expr.receiver = transformExpressionsInExpression(expr.receiver, transform, flags);
|
||||
expr.index = transformExpressionsInExpression(expr.index, transform, flags);
|
||||
} else if (expr instanceof o.WritePropExpr) {
|
||||
expr.receiver = transformExpressionsInExpression(expr.receiver, transform, flags);
|
||||
expr.value = transformExpressionsInExpression(expr.value, transform, flags);
|
||||
} else if (expr instanceof o.WriteKeyExpr) {
|
||||
expr.receiver = transformExpressionsInExpression(expr.receiver, transform, flags);
|
||||
expr.index = transformExpressionsInExpression(expr.index, transform, flags);
|
||||
expr.value = transformExpressionsInExpression(expr.value, transform, flags);
|
||||
} else if (expr instanceof o.InvokeFunctionExpr) {
|
||||
expr.fn = transformExpressionsInExpression(expr.fn, transform, flags);
|
||||
for (let i = 0; i < expr.args.length; i++) {
|
||||
|
|
|
|||
|
|
@ -125,6 +125,14 @@ function convertAst(ast: e.AST, cpl: ComponentCompilation): o.Expression {
|
|||
} else {
|
||||
return new o.ReadPropExpr(convertAst(ast.receiver, cpl), ast.name);
|
||||
}
|
||||
} else if (ast instanceof e.PropertyWrite) {
|
||||
return new o.WritePropExpr(convertAst(ast.receiver, cpl), ast.name, convertAst(ast.value, cpl));
|
||||
} else if (ast instanceof e.KeyedWrite) {
|
||||
return new o.WriteKeyExpr(
|
||||
convertAst(ast.receiver, cpl),
|
||||
convertAst(ast.key, cpl),
|
||||
convertAst(ast.value, cpl),
|
||||
);
|
||||
} else if (ast instanceof e.Call) {
|
||||
if (ast.receiver instanceof e.ImplicitReceiver) {
|
||||
throw new Error(`Unexpected ImplicitReceiver`);
|
||||
|
|
|
|||
Loading…
Reference in a new issue