Chromium Code Reviews| 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 |