OLD | NEW |
1 #!/usr/bin/env dart | 1 #!/usr/bin/env dart |
2 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 2 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
3 // for details. All rights reserved. Use of this source code is governed by a | 3 // for details. All rights reserved. Use of this source code is governed by a |
4 // BSD-style license that can be found in the LICENSE file. | 4 // BSD-style license that can be found in the LICENSE file. |
5 | 5 |
6 import 'dart:async'; | 6 import 'dart:async'; |
7 import 'dart:io'; | 7 import 'dart:io'; |
8 | 8 |
9 import 'package:args/args.dart'; | 9 import 'package:args/args.dart'; |
10 import 'package:kernel/checks.dart'; | 10 import 'package:kernel/verifier.dart'; |
11 import 'package:kernel/kernel.dart'; | 11 import 'package:kernel/kernel.dart'; |
12 import 'package:kernel/transformations/continuation.dart' as cont; | 12 import 'package:kernel/transformations/continuation.dart' as cont; |
13 import 'package:kernel/transformations/infer_values.dart' as infer_values; | 13 import 'package:kernel/transformations/infer_values.dart' as infer_values; |
14 import 'package:kernel/transformations/mixin_full_resolution.dart' as mix; | 14 import 'package:kernel/transformations/mixin_full_resolution.dart' as mix; |
15 import 'package:kernel/transformations/treeshaker.dart' as treeshaker; | 15 import 'package:kernel/transformations/treeshaker.dart' as treeshaker; |
16 | 16 |
17 import 'batch_util.dart'; | 17 import 'batch_util.dart'; |
18 | 18 |
19 ArgParser parser = new ArgParser() | 19 ArgParser parser = new ArgParser() |
20 ..addOption('format', | 20 ..addOption('format', |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 case 'resolve-mixins': | 72 case 'resolve-mixins': |
73 program = mix.transformProgram(program); | 73 program = mix.transformProgram(program); |
74 break; | 74 break; |
75 case 'treeshake': | 75 case 'treeshake': |
76 program = treeshaker.transformProgram(program); | 76 program = treeshaker.transformProgram(program); |
77 break; | 77 break; |
78 default: | 78 default: |
79 throw 'Unknown transformation'; | 79 throw 'Unknown transformation'; |
80 } | 80 } |
81 | 81 |
82 runSanityChecks(program); | 82 verifyProgram(program); |
83 | 83 |
84 if (format == 'text') { | 84 if (format == 'text') { |
85 writeProgramToText(program, path: output); | 85 writeProgramToText(program, path: output); |
86 } else { | 86 } else { |
87 assert(format == 'bin'); | 87 assert(format == 'bin'); |
88 await writeProgramToBinary(program, output); | 88 await writeProgramToBinary(program, output); |
89 } | 89 } |
90 | 90 |
91 if (verbose) { | 91 if (verbose) { |
92 writeLibraryToText(program.mainMethod.parent as Library); | 92 writeLibraryToText(program.mainMethod.parent as Library); |
93 } | 93 } |
94 | 94 |
95 return CompilerOutcome.Ok; | 95 return CompilerOutcome.Ok; |
96 } | 96 } |
OLD | NEW |