OLD | NEW |
1 #!/usr/bin/env dart | 1 #!/usr/bin/env dart |
2 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 2 // Copyright (c) 2015, 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 /// Command line tool to run the checker on a Dart program. | 6 /// Command line tool to run the checker on a Dart program. |
7 library ddc.bin.checker; | 7 library ddc.bin.checker; |
8 | 8 |
9 import 'dart:io'; | 9 import 'dart:io'; |
10 | 10 |
11 import 'package:args/args.dart'; | 11 import 'package:args/args.dart'; |
12 import 'package:cli_util/cli_util.dart' show getSdkDir; | 12 import 'package:cli_util/cli_util.dart' show getSdkDir; |
13 import 'package:logging/logging.dart' show Logger, Level; | 13 import 'package:logging/logging.dart' show Logger, Level; |
14 | 14 |
15 import 'package:ddc/config.dart'; | 15 import 'package:dev_compiler/config.dart'; |
16 import 'package:ddc/devc.dart'; | 16 import 'package:dev_compiler/devc.dart'; |
17 import 'package:ddc/src/checker/dart_sdk.dart' show mockSdkSources; | 17 import 'package:dev_compiler/src/checker/dart_sdk.dart' show mockSdkSources; |
18 import 'package:ddc/src/checker/resolver.dart' show TypeResolver; | 18 import 'package:dev_compiler/src/checker/resolver.dart' show TypeResolver; |
19 import 'package:ddc/src/options.dart'; | 19 import 'package:dev_compiler/src/options.dart'; |
20 | 20 |
21 final ArgParser argParser = new ArgParser() | 21 final ArgParser argParser = new ArgParser() |
22 ..addFlag( | 22 ..addFlag( |
23 'covariant-generics', help: 'Use covariant generics', defaultsTo: true) | 23 'covariant-generics', help: 'Use covariant generics', defaultsTo: true) |
24 ..addOption('dart-sdk', help: 'Dart SDK Path', defaultsTo: null) | 24 ..addOption('dart-sdk', help: 'Dart SDK Path', defaultsTo: null) |
25 ..addFlag('dart-gen', | 25 ..addFlag('dart-gen', |
26 abbr: 'd', help: 'Generate dart output', defaultsTo: false) | 26 abbr: 'd', help: 'Generate dart output', defaultsTo: false) |
27 ..addFlag('dart-gen-fmt', | 27 ..addFlag('dart-gen-fmt', |
28 help: 'Generate readable dart output', defaultsTo: true) | 28 help: 'Generate readable dart output', defaultsTo: true) |
29 ..addFlag('dump-info', | 29 ..addFlag('dump-info', |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 nonnullableTypes: optionsToList(args['nonnullable'], | 130 nonnullableTypes: optionsToList(args['nonnullable'], |
131 defaultValue: TypeOptions.NONNULLABLE_TYPES)); | 131 defaultValue: TypeOptions.NONNULLABLE_TYPES)); |
132 | 132 |
133 var typeResolver = shouldMockSdk | 133 var typeResolver = shouldMockSdk |
134 ? new TypeResolver.fromMock(mockSdkSources, options) | 134 ? new TypeResolver.fromMock(mockSdkSources, options) |
135 : new TypeResolver.fromDir(dartSdkPath, options); | 135 : new TypeResolver.fromDir(dartSdkPath, options); |
136 var filename = args.rest.first; | 136 var filename = args.rest.first; |
137 var result = compile(filename, typeResolver, options); | 137 var result = compile(filename, typeResolver, options); |
138 exit(result.failure ? 1 : 0); | 138 exit(result.failure ? 1 : 0); |
139 } | 139 } |
OLD | NEW |