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

Side by Side Diff: lib/json_info_codec.dart

Issue 2380273003: Include more information when deserializing ProgramInfo (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « lib/info.dart ('k') | pubspec.yaml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 /// Converters and codecs for converting between JSON and [Info] classes. 5 /// Converters and codecs for converting between JSON and [Info] classes.
6 part of dart2js_info.info; 6 part of dart2js_info.info;
7 7
8 // TODO(sigmund): add unit tests. 8 // TODO(sigmund): add unit tests.
9 class JsonToAllInfoConverter extends Converter<Map<String, dynamic>, AllInfo> { 9 class JsonToAllInfoConverter extends Converter<Map<String, dynamic>, AllInfo> {
10 Map<String, Info> registry; 10 Map<String, Info> registry;
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 TypedefInfo parseTypedef(Map json) { 138 TypedefInfo parseTypedef(Map json) {
139 TypedefInfo result = parseId(json['id']); 139 TypedefInfo result = parseId(json['id']);
140 return result 140 return result
141 ..name = json['name'] 141 ..name = json['name']
142 ..parent = parseId(json['parent']) 142 ..parent = parseId(json['parent'])
143 ..type = json['type'] 143 ..type = json['type']
144 ..size = 0; 144 ..size = 0;
145 } 145 }
146 146
147 ProgramInfo parseProgram(Map json) => new ProgramInfo() 147 ProgramInfo parseProgram(Map json) => new ProgramInfo()
148 ..entrypoint = parseId(json['entrypoint'])
148 ..size = json['size'] 149 ..size = json['size']
149 ..entrypoint = parseId(json['entrypoint']); 150 ..dart2jsVersion = json['dart2jsVersion']
151 ..compilationMoment = DateTime.parse(json['compilationMoment'])
152 ..compilationDuration =
153 new Duration(microseconds: json['compilationDuration'])
154 ..toJsonDuration = new Duration(microseconds: json['toJsonDuration'])
155 ..dumpInfoDuration = new Duration(microseconds: json['dumpInfoDuration'])
156 ..noSuchMethodEnabled = json['noSuchMethodEnabled']
157 ..minified = json['minified'];
150 158
151 FunctionInfo parseFunction(Map json) { 159 FunctionInfo parseFunction(Map json) {
152 FunctionInfo result = parseId(json['id']); 160 FunctionInfo result = parseId(json['id']);
153 return result 161 return result
154 ..name = json['name'] 162 ..name = json['name']
155 ..parent = parseId(json['parent']) 163 ..parent = parseId(json['parent'])
156 ..coverageId = json['coverageId'] 164 ..coverageId = json['coverageId']
157 ..outputUnit = parseId(json['outputUnit']) 165 ..outputUnit = parseId(json['outputUnit'])
158 ..size = json['size'] 166 ..size = json['size']
159 ..type = json['type'] 167 ..type = json['type']
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 'program': info.program.accept(this) 298 'program': info.program.accept(this)
291 }; 299 };
292 } 300 }
293 301
294 Map visitProgram(ProgramInfo info) { 302 Map visitProgram(ProgramInfo info) {
295 return { 303 return {
296 'entrypoint': info.entrypoint.serializedId, 304 'entrypoint': info.entrypoint.serializedId,
297 'size': info.size, 305 'size': info.size,
298 'dart2jsVersion': info.dart2jsVersion, 306 'dart2jsVersion': info.dart2jsVersion,
299 'compilationMoment': '${info.compilationMoment}', 307 'compilationMoment': '${info.compilationMoment}',
300 'compilationDuration': '${info.compilationDuration}', 308 'compilationDuration': info.compilationDuration.inMicroseconds,
301 'toJsonDuration': info.toJsonDuration, 309 'toJsonDuration': info.toJsonDuration.inMicroseconds,
302 'dumpInfoDuration': '${info.dumpInfoDuration}', 310 'dumpInfoDuration': info.dumpInfoDuration.inMicroseconds,
303 'noSuchMethodEnabled': info.noSuchMethodEnabled, 311 'noSuchMethodEnabled': info.noSuchMethodEnabled,
304 'minified': info.minified, 312 'minified': info.minified,
305 }; 313 };
306 } 314 }
307 315
308 Map _visitBasicInfo(BasicInfo info) { 316 Map _visitBasicInfo(BasicInfo info) {
309 var res = { 317 var res = {
310 'id': info.serializedId, 318 'id': info.serializedId,
311 'kind': kindToString(info.kind), 319 'kind': kindToString(info.kind),
312 'name': info.name, 320 'name': info.name,
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 visitTypedef(TypedefInfo info) => _visitBasicInfo(info)..['type'] = info.type; 436 visitTypedef(TypedefInfo info) => _visitBasicInfo(info)..['type'] = info.type;
429 437
430 visitOutput(OutputUnitInfo info) => 438 visitOutput(OutputUnitInfo info) =>
431 _visitBasicInfo(info)..['imports'] = info.imports; 439 _visitBasicInfo(info)..['imports'] = info.imports;
432 } 440 }
433 441
434 class AllInfoJsonCodec extends Codec<AllInfo, Map> { 442 class AllInfoJsonCodec extends Codec<AllInfo, Map> {
435 final Converter<AllInfo, Map> encoder = new AllInfoToJsonConverter(); 443 final Converter<AllInfo, Map> encoder = new AllInfoToJsonConverter();
436 final Converter<Map, AllInfo> decoder = new JsonToAllInfoConverter(); 444 final Converter<Map, AllInfo> decoder = new JsonToAllInfoConverter();
437 } 445 }
OLDNEW
« no previous file with comments | « lib/info.dart ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698