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' | 7 import 'dart:async' |
8 show Future, EventSink; | 8 show Future, EventSink; |
9 import 'dart:convert' show UTF8, LineSplitter; | 9 import 'dart:convert' show UTF8, LineSplitter; |
10 import 'dart:io' | 10 import 'dart:io' |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 new OptionHandler('--deferred-map=.+', implyCompilation), | 336 new OptionHandler('--deferred-map=.+', implyCompilation), |
337 new OptionHandler('--dump-info', implyCompilation), | 337 new OptionHandler('--dump-info', implyCompilation), |
338 new OptionHandler('--disallow-unsafe-eval', | 338 new OptionHandler('--disallow-unsafe-eval', |
339 (_) => hasDisallowUnsafeEval = true), | 339 (_) => hasDisallowUnsafeEval = true), |
340 new OptionHandler('--show-package-warnings', passThrough), | 340 new OptionHandler('--show-package-warnings', passThrough), |
341 new OptionHandler('--csp', passThrough), | 341 new OptionHandler('--csp', passThrough), |
342 new OptionHandler('--enable-experimental-mirrors', passThrough), | 342 new OptionHandler('--enable-experimental-mirrors', passThrough), |
343 new OptionHandler('--enable-async', setEnableAsync), | 343 new OptionHandler('--enable-async', setEnableAsync), |
344 new OptionHandler('--enable-enum', passThrough), | 344 new OptionHandler('--enable-enum', passThrough), |
345 new OptionHandler('--allow-native-extensions', setAllowNativeExtensions), | 345 new OptionHandler('--allow-native-extensions', setAllowNativeExtensions), |
| 346 new OptionHandler('--generate-code-with-compile-time-errors', passThrough), |
| 347 |
| 348 // The following three options must come last. |
346 new OptionHandler('-D.+=.*', addInEnvironment), | 349 new OptionHandler('-D.+=.*', addInEnvironment), |
347 | |
348 // The following two options must come last. | |
349 new OptionHandler('-.*', (String argument) { | 350 new OptionHandler('-.*', (String argument) { |
350 helpAndFail("Unknown option '$argument'."); | 351 helpAndFail("Unknown option '$argument'."); |
351 }), | 352 }), |
352 new OptionHandler('.*', (String argument) { | 353 new OptionHandler('.*', (String argument) { |
353 arguments.add(nativeToUriPath(argument)); | 354 arguments.add(nativeToUriPath(argument)); |
354 }) | 355 }) |
355 ]; | 356 ]; |
356 | 357 |
357 parseCommandLine(handlers, argv); | 358 parseCommandLine(handlers, argv); |
358 if (wantHelp || wantVersion) { | 359 if (wantHelp || wantVersion) { |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 | 603 |
603 --deferred-map=<file> | 604 --deferred-map=<file> |
604 Generates a json file with a mapping from each deferred import to a list of | 605 Generates a json file with a mapping from each deferred import to a list of |
605 the part.js files that will be loaded. | 606 the part.js files that will be loaded. |
606 | 607 |
607 --dump-info | 608 --dump-info |
608 Generates an out.info.json file with information about the generated code. | 609 Generates an out.info.json file with information about the generated code. |
609 You can inspect the generated file with the viewer at: | 610 You can inspect the generated file with the viewer at: |
610 https://dart-lang.github.io/dump-info-visualizer/ | 611 https://dart-lang.github.io/dump-info-visualizer/ |
611 | 612 |
| 613 --generate-code-with-compile-time-errors |
| 614 Generates output even if the program contains compile-time errors. Use the |
| 615 exit code to determine if compilation failed. |
612 '''.trim()); | 616 '''.trim()); |
613 } | 617 } |
614 | 618 |
615 void helpAndExit(bool wantHelp, bool wantVersion, bool verbose) { | 619 void helpAndExit(bool wantHelp, bool wantVersion, bool verbose) { |
616 if (wantVersion) { | 620 if (wantVersion) { |
617 var version = (BUILD_ID == null) | 621 var version = (BUILD_ID == null) |
618 ? '<non-SDK build>' | 622 ? '<non-SDK build>' |
619 : BUILD_ID; | 623 : BUILD_ID; |
620 print('Dart-to-JavaScript compiler (dart2js) version: $version'); | 624 print('Dart-to-JavaScript compiler (dart2js) version: $version'); |
621 } | 625 } |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
713 } else if (exitCode == 253) { | 717 } else if (exitCode == 253) { |
714 print(">>> TEST CRASH"); | 718 print(">>> TEST CRASH"); |
715 } else { | 719 } else { |
716 print(">>> TEST FAIL"); | 720 print(">>> TEST FAIL"); |
717 } | 721 } |
718 stderr.writeln(">>> EOF STDERR"); | 722 stderr.writeln(">>> EOF STDERR"); |
719 subscription.resume(); | 723 subscription.resume(); |
720 }); | 724 }); |
721 }); | 725 }); |
722 } | 726 } |
OLD | NEW |