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

Side by Side Diff: tests/compiler/dart2js/sourcemaps/save.dart

Issue 2939063002: Strong mode cleaning of many dart2js tests. (Closed)
Patch Set: Use ClassElement. Created 3 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /// Loads a human-readable source map and outputs the source map file for it. 5 /// Loads a human-readable source map and outputs the source map file for it.
6 6
7 library save; 7 library save;
8 8
9 import 'dart:convert'; 9 import 'dart:convert';
10 import 'dart:io'; 10 import 'dart:io';
(...skipping 26 matching lines...) Expand all
37 37
38 if (sourceMapFile != null) { 38 if (sourceMapFile != null) {
39 sourceMapFile.writeAsStringSync(JSON.encoder.convert(mapping.toJson())); 39 sourceMapFile.writeAsStringSync(JSON.encoder.convert(mapping.toJson()));
40 } else { 40 } else {
41 print(new JsonEncoder.withIndent(' ').convert(mapping.toJson())); 41 print(new JsonEncoder.withIndent(' ').convert(mapping.toJson()));
42 } 42 }
43 } 43 }
44 44
45 SingleMapping convertFromHumanReadableSourceMap(String json) { 45 SingleMapping convertFromHumanReadableSourceMap(String json) {
46 Map inputMap = lazon.decode(json); 46 Map inputMap = lazon.decode(json);
47 String file = inputMap['file'];
48 Map urls = inputMap['sources']; 47 Map urls = inputMap['sources'];
49 List<String> sources = new List<String>.filled(urls.length, null); 48 List<String> sources = new List<String>.filled(urls.length, null);
50 urls.forEach((String index, String url) { 49 urls.forEach((String index, String url) {
51 int i = int.parse(index); 50 int i = int.parse(index);
52 assert(sources[i] == null); 51 assert(sources[i] == null);
53 sources[i] = url; 52 sources[i] = url;
54 }); 53 });
55 List lines = inputMap['lines']; 54 List lines = inputMap['lines'];
56 Map<String, int> names = <String, int>{}; 55 Map<String, int> names = <String, int>{};
57 Map<int, TargetLineEntry> lineEntryMap = {}; 56 Map<int, TargetLineEntry> lineEntryMap = {};
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 'file': inputMap['file'], 131 'file': inputMap['file'],
133 'sources': sources, 132 'sources': sources,
134 'names': names.keys.toList(), 133 'names': names.keys.toList(),
135 'mappings': '', 134 'mappings': '',
136 }; 135 };
137 136
138 SingleMapping mapping = new SingleMapping.fromJson(outputMap); 137 SingleMapping mapping = new SingleMapping.fromJson(outputMap);
139 mapping.lines.addAll(lineEntries); 138 mapping.lines.addAll(lineEntries);
140 return mapping; 139 return mapping;
141 } 140 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698