Skip to content

Commit

Permalink
Properly type imports when parsing deferredFiles from JSON. (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
LorenVS authored and sigmundch committed Jun 22, 2018
1 parent 7247ccf commit 2a7c7f3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
14 changes: 13 additions & 1 deletion lib/json_info_codec.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,20 @@ class JsonToAllInfoConverter extends Converter<Map<String, dynamic>, AllInfo> {
result.program = parseProgram(json['program']);

if (json['deferredFiles'] != null) {
result.deferredFiles =
final deferredFilesMap =
(json['deferredFiles'] as Map).cast<String, Map<String, dynamic>>();
for (final library in deferredFilesMap.values) {
if (library['imports'] != null) {
// The importMap needs to be typed as <String, List<String>>, but the
// json parser produces <String, dynamic>.
final importMap = library['imports'] as Map<String, dynamic>;
importMap.forEach((prefix, files) {
importMap[prefix] = (files as List<dynamic>).cast<String>();
});
library['imports'] = importMap.cast<String, List<String>>();
}
}
result.deferredFiles = deferredFilesMap;
}

// todo: version, etc
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: dart2js_info
version: 0.5.8
version: 0.5.8+1
description: >
Libraries and tools to process data produced when running dart2js with
--dump-info.
Expand Down

0 comments on commit 2a7c7f3

Please sign in to comment.