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