fix(compiler): ensure that placeholders have the correct sourceSpan (… · angular/angular@8ec7156 · GitHub
Skip to content

Commit 8ec7156

Browse files
petebacondarwinAndrewKushnir
authored andcommitted
fix(compiler): ensure that placeholders have the correct sourceSpan (#39717)
When the `preserveWhitespaces` is not true, the template parser will process the parsed AST nodes to remove excess whitespace. Since the generated `goog.getMsg()` statements rely upon the AST nodes after this whitespace is removed, the i18n extraction must make a second pass. Previously this resulted in innacurrate source-spans for the i18n text and placeholder nodes that were extracted in the second pass. This commit fixes this by reusing the source-spans from the first pass when extracting the nodes in the second pass. Fixes #39671 PR Close #39717
1 parent d172882 commit 8ec7156

2 files changed

Lines changed: 132 additions & 3 deletions

File tree

packages/compiler-cli/test/ngtsc/template_mapping_spec.ts

Lines changed: 89 additions & 0 deletions

packages/compiler/src/i18n/i18n_parser.ts

Lines changed: 43 additions & 3 deletions

0 commit comments

Comments
 (0)