Skip to content
This repository has been archived by the owner on Sep 16, 2022. It is now read-only.

Commit

Permalink
chore(i18n): replace unimplemented error with an explicit error message
Browse files Browse the repository at this point in the history
Note we intentionally want this error to be reported as a compiler bug (rather
than a build error), since we don't expect to ever reach this state.

PiperOrigin-RevId: 208545165
  • Loading branch information
leonsenft authored and matanlurey committed Aug 14, 2018
1 parent 746d571 commit e756114
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions angular/lib/src/compiler/i18n.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,13 @@ List<ng.TemplateAst> internationalize(
];
}

// TODO(leonsenft): verify if we can rely on file spans.
SourceSpan _spanWithin(ast.StandaloneTemplateAst parent) {
var firstSpan = parent.childNodes.first.sourceSpan;
var lastSpan = parent.childNodes.last.sourceSpan;
final firstSpan = parent.childNodes.first.sourceSpan;
final lastSpan = parent.childNodes.last.sourceSpan;
if (firstSpan is FileSpan && lastSpan is FileSpan) {
return firstSpan.expand(lastSpan);
}
throw UnimplementedError();
// We shouldn't ever reach this state, but if we do somehow, we want it
// reported as a compiler bug with an explicit error message.
throw StateError("Couldn't compute source span of internationalized node");
}

0 comments on commit e756114

Please sign in to comment.