Permalink
Browse files

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

…9965)

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

PR Close #19965
  • Loading branch information...
chuckjaz authored and matsko committed Oct 26, 2017
1 parent 4285b6c commit 2d508a3ef0f13c5e11a9565ad993b1d13f7f7443
Showing with 7 additions and 5 deletions.
  1. +7 −5 packages/compiler-cli/src/transformers/node_emitter.ts
@@ -144,12 +144,14 @@ class _NodeEmitterVisitor implements StatementVisitor, ExpressionVisitor {
const span = node.sourceSpan;
if (span.start.file == span.end.file) {
const file = span.start.file;
let source = this._templateSources.get(file);
if (!source) {
source = ts.createSourceMapSource(file.url, file.content, pos => pos);
this._templateSources.set(file, source);
if (file.url) {
let source = this._templateSources.get(file);
if (!source) {
source = ts.createSourceMapSource(file.url, file.content, pos => pos);
this._templateSources.set(file, source);
}
return {pos: span.start.offset, end: span.end.offset, source};
}
return {pos: span.start.offset, end: span.end.offset, source};
}
}
return null;

0 comments on commit 2d508a3

Please sign in to comment.