(block: html.Block, context: I18nMessageVisitorContext)
| 166 | } |
| 167 | |
| 168 | visitBlock(block: html.Block, context: I18nMessageVisitorContext) { |
| 169 | const children = html.visitAll(this, block.children, context); |
| 170 | |
| 171 | if (block.name === 'switch') { |
| 172 | return new i18n.Container(children, block.sourceSpan); |
| 173 | } |
| 174 | |
| 175 | const parameters = block.parameters.map((param) => param.expression); |
| 176 | const startPhName = context.placeholderRegistry.getStartBlockPlaceholderName( |
| 177 | block.name, |
| 178 | parameters, |
| 179 | ); |
| 180 | const closePhName = context.placeholderRegistry.getCloseBlockPlaceholderName(block.name); |
| 181 | |
| 182 | context.placeholderToContent[startPhName] = { |
| 183 | text: block.startSourceSpan.toString(), |
| 184 | sourceSpan: block.startSourceSpan, |
| 185 | }; |
| 186 | |
| 187 | context.placeholderToContent[closePhName] = { |
| 188 | text: block.endSourceSpan ? block.endSourceSpan.toString() : '}', |
| 189 | sourceSpan: block.endSourceSpan ?? block.sourceSpan, |
| 190 | }; |
| 191 | |
| 192 | const node = new i18n.BlockPlaceholder( |
| 193 | block.name, |
| 194 | parameters, |
| 195 | startPhName, |
| 196 | closePhName, |
| 197 | children, |
| 198 | block.sourceSpan, |
| 199 | block.startSourceSpan, |
| 200 | block.endSourceSpan, |
| 201 | ); |
| 202 | return context.visitNodeFn(block, node); |
| 203 | } |
| 204 | |
| 205 | visitBlockParameter(_parameter: html.BlockParameter, _context: I18nMessageVisitorContext) { |
| 206 | throw new Error('Unreachable code'); |
nothing calls this directly
no test coverage detected