fix(compiler-cli): avoid producing source mappings for host views (#19965)

The host view doesn't map back to user code so the template compiler
produces a blank `url` for them.

PR Close #19965
This commit is contained in:
Chuck Jazdzewski 2017-10-26 16:58:45 -07:00 committed by Matias Niemelä
parent 00bc80bb37
commit 22c66f0e02
1 changed files with 7 additions and 5 deletions

View File

@ -144,6 +144,7 @@ class _NodeEmitterVisitor implements StatementVisitor, ExpressionVisitor {
const span = node.sourceSpan;
if (span.start.file == span.end.file) {
const file = span.start.file;
if (file.url) {
let source = this._templateSources.get(file);
if (!source) {
source = ts.createSourceMapSource(file.url, file.content, pos => pos);
@ -152,6 +153,7 @@ class _NodeEmitterVisitor implements StatementVisitor, ExpressionVisitor {
return {pos: span.start.offset, end: span.end.offset, source};
}
}
}
return null;
}