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

Side by Side Diff: lib/json_info_codec.dart

Issue 1420303010: add 'imports' field for OutputUnitInfo (Closed) Base URL: git@github.com:dart-lang/dart2js_info.git@master
Patch Set: Created 5 years, 1 month 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
« lib/info.dart ('K') | « 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, AllInfo> { 9 class JsonToAllInfoConverter extends Converter<Map, AllInfo> {
10 Map<String, Info> registry; 10 Map<String, Info> registry;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 result.program = parseProgram(json['program']); 53 result.program = parseProgram(json['program']);
54 // todo: version, etc 54 // todo: version, etc
55 return result; 55 return result;
56 } 56 }
57 57
58 OutputUnitInfo parseOutputUnit(Map json) { 58 OutputUnitInfo parseOutputUnit(Map json) {
59 OutputUnitInfo result = parseId(json['id']); 59 OutputUnitInfo result = parseId(json['id']);
60 result 60 result
61 ..name = json['name'] 61 ..name = json['name']
62 ..size = json['size']; 62 ..size = json['size'];
63 result.imports.addAll(json['imports'] ?? const []);
63 return result; 64 return result;
64 } 65 }
65 66
66 LibraryInfo parseLibrary(Map json) { 67 LibraryInfo parseLibrary(Map json) {
67 LibraryInfo result = parseId(json['id']); 68 LibraryInfo result = parseId(json['id']);
68 result 69 result
69 ..name = json['name'] 70 ..name = json['name']
70 ..uri = Uri.parse(json['canonicalUri']) 71 ..uri = Uri.parse(json['canonicalUri'])
71 ..outputUnit = parseId(json['outputUnit']) 72 ..outputUnit = parseId(json['outputUnit'])
72 ..size = json['size']; 73 ..size = json['size'];
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 'code': info.code, 410 'code': info.code,
410 'type': info.type, 411 'type': info.type,
411 'measurements': _visitMeasurements(info.measurements), 412 'measurements': _visitMeasurements(info.measurements),
412 // Note: version 3.2 of dump-info serializes `uses` in a section called 413 // Note: version 3.2 of dump-info serializes `uses` in a section called
413 // `holding` at the top-level. 414 // `holding` at the top-level.
414 }); 415 });
415 } 416 }
416 417
417 visitTypedef(TypedefInfo info) => _visitBasicInfo(info)..['type'] = info.type; 418 visitTypedef(TypedefInfo info) => _visitBasicInfo(info)..['type'] = info.type;
418 419
419 visitOutput(OutputUnitInfo info) => _visitBasicInfo(info); 420 visitOutput(OutputUnitInfo info) =>
421 _visitBasicInfo(info)..['imports'] = info.imports;
420 } 422 }
421 423
422 class AllInfoJsonCodec extends Codec<AllInfo, Map> { 424 class AllInfoJsonCodec extends Codec<AllInfo, Map> {
423 final Converter<AllInfo, Map> encoder = new AllInfoToJsonConverter(); 425 final Converter<AllInfo, Map> encoder = new AllInfoToJsonConverter();
424 final Converter<Map, AllInfo> decoder = new JsonToAllInfoConverter(); 426 final Converter<Map, AllInfo> decoder = new JsonToAllInfoConverter();
425 } 427 }
OLDNEW
« lib/info.dart ('K') | « lib/info.dart ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698