MCPcopy Create free account
hub / github.com/angular/angular / toStringExpression

Function toStringExpression

packages/compiler/test/render3/view/util.ts:120–142  ·  view source on GitHub ↗
(expr: e.AST)

Source from the content-addressed store, hash-verified

118}
119
120export function toStringExpression(expr: e.AST): string {
121 while (expr instanceof e.ASTWithSource) {
122 expr = expr.ast;
123 }
124 if (expr instanceof e.PropertyRead) {
125 if (expr.receiver instanceof e.ImplicitReceiver || expr.receiver instanceof e.ThisReceiver) {
126 return expr.name;
127 } else {
128 return `${toStringExpression(expr.receiver)}.${expr.name}`;
129 }
130 } else if (expr instanceof e.ImplicitReceiver) {
131 return '';
132 } else if (expr instanceof e.Interpolation) {
133 let str = '{{';
134 for (let i = 0; i < expr.expressions.length; i++) {
135 str += expr.strings[i] + toStringExpression(expr.expressions[i]);
136 }
137 str += expr.strings[expr.strings.length - 1] + '}}';
138 return str;
139 } else {
140 throw new Error(`Unsupported type: ${(expr as any).constructor.name}`);
141 }
142}
143
144// Parse an html string to IVY specific info
145export function parseR3(

Callers 1

findExpressionInNodeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected