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