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

Unified Diff: lib/parser.dart

Issue 2574593004: Rev package version as the extended source map format is a new feature. (Closed)
Patch Set: add small feature to parser.dart 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 492e6cf65030792b5062594ace3b748553f2305b..7721c6765616d46e707f79ecb5ebf5976fba37e4 100644
--- a/lib/parser.dart
+++ b/lib/parser.dart
@@ -205,13 +205,16 @@ class MappingBundle extends Mapping {
if (uri == null) {
throw new ArgumentError.notNull('uri');
}
- if (_mappings.containsKey(uri)) {
- return _mappings[uri].spanFor(line, column, files: files, uri: uri);
- }
- // Fall back to looking up the source map on just the basename.
- var name = path.basename(uri.toString());
- if (_mappings.containsKey(name)) {
- return _mappings[name].spanFor(line, column, files: files, uri: name);
+
+ // Fall back to looking up uri suffixes of decreasing length if the full
Siggi Cherem (dart-lang) 2016/12/14 15:46:10 Let's keep the first `if` from before (where you c
Jacob 2016/12/14 18:49:42 Changed the wording of the comment from fall back
+ // uri does not match a source map.
+ var parts = path.split(uri);
Siggi Cherem (dart-lang) 2016/12/14 15:46:10 do we expect uri to contain any scheme? (do we nee
Jacob 2016/12/14 18:49:42 Good point. path.split doesn't handle package: the
+ for (var i = 0; i < parts.length; ++i) {
+ var candidate = path.joinAll(parts.skip(i));
+ if (_mappings.containsKey(candidate)) {
+ return _mappings[candidate]
+ .spanFor(line, column, files: files, uri: candidate);
+ }
}
// Note: when there is no source map for an uri, this behaves like an
« CHANGELOG.md ('K') | « CHANGELOG.md ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698