Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Unified Diff: lib/parser.dart

Issue 2564683003: Improve handling of locations not from the uris the source map is for. (Closed)
Patch Set: Improve handling of locations not from the uris the source map is for. Make `MappingBundle` disting… Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« CHANGELOG.md ('K') | « CHANGELOG.md ('k') | pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/parser.dart
diff --git a/lib/parser.dart b/lib/parser.dart
index c651f89ff11748fbe954655495274cc0885c767e..3ae25967d462fffa1943bd8a97a3d64684d3a7ab 100644
--- a/lib/parser.dart
+++ b/lib/parser.dart
@@ -213,7 +213,14 @@ class MappingBundle extends Mapping {
if (_mappings.containsKey(name)) {
return _mappings[name].spanFor(line, column, files: files, uri: name);
}
- return null;
+ // The uri doesn't have a source map so create a SourceMapSpan matching
+ // the input location as well as possible. Fake the file offset because
Siggi Cherem (dart-lang) 2016/12/09 16:38:38 nits: - input and output is a bit confusing here.
Jacob 2016/12/09 17:18:03 Done.
+ // we don't really know it. This fake offset avoids locations with the
+ // same offset but different lines and columns.
+ var offset = line * 1000000000 + column;
Siggi Cherem (dart-lang) 2016/12/09 16:38:38 wow, 1 billion! that's a very long line :) Can we
Jacob 2016/12/09 17:18:03 Switched to a million. Note that SourceMapSpan doe
+ var location = new SourceLocation(offset,
+ line: line, column: column, sourceUrl: Uri.parse(uri));
+ return new SourceMapSpan(location, location, "");
}
}
« CHANGELOG.md ('K') | « CHANGELOG.md ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698