OLD | NEW |
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 library dart2js_info.src.util; | 5 library dart2js_info.src.util; |
6 | 6 |
| 7 import 'dart:async'; |
| 8 import 'dart:convert'; |
| 9 import 'dart:io'; |
| 10 |
7 import 'package:dart2js_info/info.dart'; | 11 import 'package:dart2js_info/info.dart'; |
| 12 |
8 import 'graph.dart'; | 13 import 'graph.dart'; |
9 | 14 |
10 /// Computes a graph of dependencies from [info]. | 15 /// Computes a graph of dependencies from [info]. |
11 Graph<Info> graphFromInfo(AllInfo info) { | 16 Graph<Info> graphFromInfo(AllInfo info) { |
12 print(' info: dependency graph information is work in progress and' | 17 print(' info: dependency graph information is work in progress and' |
13 ' might be incomplete'); | 18 ' might be incomplete'); |
14 // Note: we are combining dependency information that is computed in two ways | 19 // Note: we are combining dependency information that is computed in two ways |
15 // (functionInfo.uses vs allInfo.dependencies). | 20 // (functionInfo.uses vs allInfo.dependencies). |
16 // TODO(sigmund): fix inconsistencies between these two ways, stick with one | 21 // TODO(sigmund): fix inconsistencies between these two ways, stick with one |
17 // of them. | 22 // of them. |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 } else { | 122 } else { |
118 sb.write(' + '); | 123 sb.write(' + '); |
119 } | 124 } |
120 helper(sub); | 125 helper(sub); |
121 } | 126 } |
122 sb.write(')'); | 127 sb.write(')'); |
123 } | 128 } |
124 helper(metric); | 129 helper(metric); |
125 return sb.toString(); | 130 return sb.toString(); |
126 } | 131 } |
| 132 |
| 133 Future<AllInfo> infoFromFile(String fileName) async { |
| 134 var file = await new File(fileName).readAsString(); |
| 135 return new AllInfoJsonCodec().decode(JSON.decode(file)); |
| 136 } |
OLD | NEW |