(ast: o.LocalizedString, ctx: EmitterVisitorContext)
| 88 | } |
| 89 | |
| 90 | override visitLocalizedString(ast: o.LocalizedString, ctx: EmitterVisitorContext): void { |
| 91 | // The following convoluted piece of code is effectively the downlevelled equivalent of |
| 92 | // ``` |
| 93 | // $localize `...` |
| 94 | // ``` |
| 95 | // which is effectively like: |
| 96 | // ``` |
| 97 | // $localize(__makeTemplateObject(cooked, raw), expression1, expression2, ...); |
| 98 | // ``` |
| 99 | ctx.print(ast, `$localize(${makeTemplateObjectPolyfill}(`); |
| 100 | const parts = [ast.serializeI18nHead()]; |
| 101 | for (let i = 1; i < ast.messageParts.length; i++) { |
| 102 | parts.push(ast.serializeI18nTemplatePart(i)); |
| 103 | } |
| 104 | ctx.print(ast, `[${parts.map((part) => escapeIdentifier(part.cooked)).join(', ')}], `); |
| 105 | ctx.print(ast, `[${parts.map((part) => escapeIdentifier(part.raw)).join(', ')}])`); |
| 106 | ast.expressions.forEach((expression) => { |
| 107 | ctx.print(ast, ', '); |
| 108 | expression.visitExpression(this, ctx); |
| 109 | }); |
| 110 | ctx.print(ast, ')'); |
| 111 | } |
| 112 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…