[DDC-kernel] Deal with null fileUris

When building source maps it is currently assumed that the fileUri is
non-null (or at least that the location extracted from the Uri and
offset is non-null.
That might not always be the case (e.g. see CL 29003).

Bug:
Change-Id: I29c928a0d5fcd2bd5e1d1ef6c6d6ac97d2e7408c
Reviewed-on: https://dart-review.googlesource.com/29120
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
This commit is contained in:
Jens Johansen 2017-12-13 12:37:14 +00:00 committed by commit-bot@chromium.org
parent a37c34b5fb
commit 970e1aabf7

View file

@ -113,8 +113,14 @@ class SourceMapPrintingContext extends JS.SimpleJavaScriptPrintingContext {
FileUriNode fileParent = parentsStack.last;
Program p = fileParent.enclosingProgram;
Uri fileUri = fileParent.fileUri;
while (fileUri == null && fileParent.parent is FileUriNode) {
fileParent = fileParent.parent;
fileUri = fileParent.fileUri;
}
if (fileUri == null) return;
var loc = p.getLocation(fileUri, offset);
if (loc == null) return;
_previousLine = _line;
_previousColumn = adjustedColumn;
sourceMap.addLocation(