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

Unified Diff: lib/parser.dart

Issue 2736983002: Enabling adding and querying for source maps in a MappingBundle. (Closed)
Patch Set: Enabling adding and querying for source maps in a MappingBundle. Created 3 years, 9 months 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
« no previous file with comments | « 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 1c2318774a2c5691d68c74f258096cf6d322243a..3b65e89109d63a388ad7e7e4e7656899286f701b 100644
--- a/lib/parser.dart
+++ b/lib/parser.dart
@@ -180,16 +180,20 @@ class MultiSectionMapping extends Mapping {
class MappingBundle extends Mapping {
Map<String, SingleMapping> _mappings = {};
+ MappingBundle() {}
+
MappingBundle.fromJson(List json, {String mapUrl}) {
for (var map in json) {
- var mapping = parseJson(map, mapUrl: mapUrl) as SingleMapping;
- var targetUrl = mapping.targetUrl;
- // TODO(jacobr): verify that targetUrl is valid uri instead of a windows
- // path.
- _mappings[targetUrl] = mapping;
+ addMapping(parseJson(map, mapUrl: mapUrl) as SingleMapping);
}
}
+ addMapping(SingleMapping mapping) {
+ // TODO(jacobr): verify that targetUrl is valid uri instead of a windows
+ // path.
+ _mappings[mapping.targetUrl] = mapping;
+ }
+
/// Encodes the Mapping mappings as a json map.
List toJson() => _mappings.values.map((v) => v.toJson()).toList();
@@ -201,6 +205,8 @@ class MappingBundle extends Mapping {
return buff.toString();
}
+ bool containsMapping(String url) => _mappings.containsKey(url);
+
SourceMapSpan spanFor(int line, int column,
{Map<String, SourceFile> files, String uri}) {
if (uri == null) {
« no previous file with comments | « CHANGELOG.md ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698