OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 /// Utility to dump a truncated .dill file generated by the incremental kernel | 5 /// Utility to dump a truncated .dill file generated by the incremental kernel |
6 /// generator or by the VM's kernel service. | 6 /// generator or by the VM's kernel service. |
7 import 'dart:io'; | 7 import 'dart:io'; |
8 import 'package:kernel/kernel.dart'; | 8 import 'package:kernel/kernel.dart'; |
9 import 'package:front_end/src/fasta/kernel/utils.dart'; | 9 import 'package:front_end/src/fasta/kernel/utils.dart'; |
10 | 10 |
11 main(List<String> args) { | 11 main(List<String> args) { |
12 if (args.length == 0) { | 12 if (args.length == 0) { |
13 print('usage: pkg/front_end/tool/fasta dump_partial ' | 13 print('usage: pkg/front_end/tool/fasta dump_partial ' |
14 'partial.dill [extra1.dill] ... [extraN.dill]'); | 14 'partial.dill [extra1.dill] ... [extraN.dill]'); |
15 exitCode = 1; | 15 exitCode = 1; |
| 16 return; |
16 } | 17 } |
17 | 18 |
18 var program = _loadProgram(args); | 19 var program = _loadProgram(args); |
19 writeProgramToText(program); | 20 writeProgramToText(program); |
20 } | 21 } |
21 | 22 |
22 /// Creates a program that contains all of the context code marked as external, | 23 /// Creates a program that contains all of the context code marked as external, |
23 /// and all libraries defined in partial.dill as they are written in that file. | 24 /// and all libraries defined in partial.dill as they are written in that file. |
24 Program _loadProgram(List<String> args) { | 25 Program _loadProgram(List<String> args) { |
25 List<int> partialInput = new File(args[0]).readAsBytesSync(); | 26 List<int> partialInput = new File(args[0]).readAsBytesSync(); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 .where((l) => !l.isExternal) | 64 .where((l) => !l.isExternal) |
64 .map((l) => l.importUri) | 65 .map((l) => l.importUri) |
65 .toSet(); | 66 .toSet(); |
66 _updateIsExternal(context, false); | 67 _updateIsExternal(context, false); |
67 return result; | 68 return result; |
68 } | 69 } |
69 | 70 |
70 void _updateIsExternal(Program program, bool toValue) { | 71 void _updateIsExternal(Program program, bool toValue) { |
71 program.libraries.forEach((lib) => lib.isExternal = toValue); | 72 program.libraries.forEach((lib) => lib.isExternal = toValue); |
72 } | 73 } |
OLD | NEW |