| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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.cmdline; | 5 library dart2js.cmdline; |
| 6 | 6 |
| 7 import 'dart:async' show Future; | 7 import 'dart:async' show Future; |
| 8 import 'dart:convert' show UTF8, LineSplitter; | 8 import 'dart:convert' show UTF8, LineSplitter; |
| 9 import 'dart:io' show exit, File, FileMode, Platform, stdin, stderr; | 9 import 'dart:io' show exit, File, FileMode, Platform, stdin, stderr; |
| 10 | 10 |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 for (String category in categories) { | 271 for (String category in categories) { |
| 272 if (!["Client", "Server"].contains(category)) { | 272 if (!["Client", "Server"].contains(category)) { |
| 273 fail('Unsupported library category "$category", ' | 273 fail('Unsupported library category "$category", ' |
| 274 'supported categories are: Client, Server, all'); | 274 'supported categories are: Client, Server, all'); |
| 275 } | 275 } |
| 276 } | 276 } |
| 277 } | 277 } |
| 278 passThrough('--categories=${categories.join(",")}'); | 278 passThrough('--categories=${categories.join(",")}'); |
| 279 } | 279 } |
| 280 | 280 |
| 281 void setPreviewDart2(String argument) { | 281 void setUseKernel(String argument) { |
| 282 useKernel = true; | 282 useKernel = true; |
| 283 // TODO(sigmund): remove once we support inlining and type-inference |
| 284 // with `useKernel`. |
| 285 options.add(Flags.disableInlining); |
| 286 options.add(Flags.disableTypeInference); |
| 283 passThrough(argument); | 287 passThrough(argument); |
| 284 } | 288 } |
| 285 | 289 |
| 286 void handleThrowOnError(String argument) { | 290 void handleThrowOnError(String argument) { |
| 287 throwOnError = true; | 291 throwOnError = true; |
| 288 String parameter = extractParameter(argument, isOptionalArgument: true); | 292 String parameter = extractParameter(argument, isOptionalArgument: true); |
| 289 if (parameter != null) { | 293 if (parameter != null) { |
| 290 var count = int.parse(parameter); | 294 var count = int.parse(parameter); |
| 291 throwOnErrorCount = count; | 295 throwOnErrorCount = count; |
| 292 } | 296 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 showHints = false; | 332 showHints = false; |
| 329 }), | 333 }), |
| 330 // TODO(sigmund): remove entirely after Dart 1.20 | 334 // TODO(sigmund): remove entirely after Dart 1.20 |
| 331 new OptionHandler( | 335 new OptionHandler( |
| 332 '--output-type=dart|--output-type=dart-multi|--output-type=js', | 336 '--output-type=dart|--output-type=dart-multi|--output-type=js', |
| 333 setOutputType), | 337 setOutputType), |
| 334 // TODO(efortuna): Remove this once kernel global inference is fully | 338 // TODO(efortuna): Remove this once kernel global inference is fully |
| 335 // implemented. | 339 // implemented. |
| 336 new OptionHandler(Flags.kernelGlobalInference, passThrough), | 340 new OptionHandler(Flags.kernelGlobalInference, passThrough), |
| 337 new OptionHandler(Flags.useKernelInSsa, passThrough), | 341 new OptionHandler(Flags.useKernelInSsa, passThrough), |
| 338 new OptionHandler(Flags.useKernel, setPreviewDart2), | 342 new OptionHandler(Flags.useKernel, setUseKernel), |
| 339 new OptionHandler(Flags.noFrequencyBasedMinification, passThrough), | 343 new OptionHandler(Flags.noFrequencyBasedMinification, passThrough), |
| 340 new OptionHandler(Flags.verbose, setVerbose), | 344 new OptionHandler(Flags.verbose, setVerbose), |
| 341 new OptionHandler(Flags.version, (_) => wantVersion = true), | 345 new OptionHandler(Flags.version, (_) => wantVersion = true), |
| 342 new OptionHandler('--library-root=.+', setLibraryRoot), | 346 new OptionHandler('--library-root=.+', setLibraryRoot), |
| 343 new OptionHandler('--out=.+|-o.*', setOutput, multipleArguments: true), | 347 new OptionHandler('--out=.+|-o.*', setOutput, multipleArguments: true), |
| 344 new OptionHandler(Flags.allowMockCompilation, passThrough), | 348 new OptionHandler(Flags.allowMockCompilation, passThrough), |
| 345 new OptionHandler(Flags.fastStartup, passThrough), | 349 new OptionHandler(Flags.fastStartup, passThrough), |
| 346 new OptionHandler(Flags.genericMethodSyntax, ignoreOption), | 350 new OptionHandler(Flags.genericMethodSyntax, ignoreOption), |
| 347 new OptionHandler(Flags.initializingFormalAccess, ignoreOption), | 351 new OptionHandler(Flags.initializingFormalAccess, ignoreOption), |
| 348 new OptionHandler('${Flags.minify}|-m', implyCompilation), | 352 new OptionHandler('${Flags.minify}|-m', implyCompilation), |
| (...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1112 @override | 1116 @override |
| 1113 void add(String event) { | 1117 void add(String event) { |
| 1114 sb.write(event); | 1118 sb.write(event); |
| 1115 } | 1119 } |
| 1116 | 1120 |
| 1117 @override | 1121 @override |
| 1118 void close() { | 1122 void close() { |
| 1119 // Do nothing. | 1123 // Do nothing. |
| 1120 } | 1124 } |
| 1121 } | 1125 } |
| OLD | NEW |