| 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 bool explicitOut = false; | 110 bool explicitOut = false; |
| 111 bool wantHelp = false; | 111 bool wantHelp = false; |
| 112 bool wantVersion = false; | 112 bool wantVersion = false; |
| 113 String outputLanguage = 'JavaScript'; | 113 String outputLanguage = 'JavaScript'; |
| 114 bool stripArgumentSet = false; | 114 bool stripArgumentSet = false; |
| 115 bool analyzeOnly = false; | 115 bool analyzeOnly = false; |
| 116 bool analyzeAll = false; | 116 bool analyzeAll = false; |
| 117 bool dumpInfo = false; | 117 bool dumpInfo = false; |
| 118 bool allowNativeExtensions = false; | 118 bool allowNativeExtensions = false; |
| 119 bool trustTypeAnnotations = false; | 119 bool trustTypeAnnotations = false; |
| 120 bool trustPrimitives = false; | |
| 121 bool checkedMode = false; | 120 bool checkedMode = false; |
| 122 // List of provided options that imply that output is expected. | 121 // List of provided options that imply that output is expected. |
| 123 List<String> optionsImplyCompilation = <String>[]; | 122 List<String> optionsImplyCompilation = <String>[]; |
| 124 bool hasDisallowUnsafeEval = false; | 123 bool hasDisallowUnsafeEval = false; |
| 125 // TODO(johnniwinther): Measure time for reading files. | 124 // TODO(johnniwinther): Measure time for reading files. |
| 126 SourceFileProvider inputProvider = new CompilerSourceFileProvider(); | 125 SourceFileProvider inputProvider = new CompilerSourceFileProvider(); |
| 127 diagnosticHandler = new FormattingDiagnosticHandler(inputProvider); | 126 diagnosticHandler = new FormattingDiagnosticHandler(inputProvider); |
| 128 Map<String, dynamic> environment = new Map<String, dynamic>(); | 127 Map<String, dynamic> environment = new Map<String, dynamic>(); |
| 129 | 128 |
| 130 passThrough(String argument) => options.add(argument); | 129 passThrough(String argument) => options.add(argument); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 implyCompilation(argument); | 210 implyCompilation(argument); |
| 212 dumpInfo = true; | 211 dumpInfo = true; |
| 213 } | 212 } |
| 214 | 213 |
| 215 setTrustTypeAnnotations(String argument) { | 214 setTrustTypeAnnotations(String argument) { |
| 216 trustTypeAnnotations = true; | 215 trustTypeAnnotations = true; |
| 217 implyCompilation(argument); | 216 implyCompilation(argument); |
| 218 } | 217 } |
| 219 | 218 |
| 220 setTrustPrimitives(String argument) { | 219 setTrustPrimitives(String argument) { |
| 221 trustPrimitives = true; | |
| 222 implyCompilation(argument); | 220 implyCompilation(argument); |
| 223 } | 221 } |
| 224 | 222 |
| 225 setCheckedMode(String argument) { | 223 setCheckedMode(String argument) { |
| 226 checkedMode = true; | 224 checkedMode = true; |
| 227 passThrough(argument); | 225 passThrough(argument); |
| 228 } | 226 } |
| 229 | 227 |
| 230 addInEnvironment(String argument) { | 228 addInEnvironment(String argument) { |
| 231 int eqIndex = argument.indexOf('='); | 229 int eqIndex = argument.indexOf('='); |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 all categories, use --categories=all. | 616 all categories, use --categories=all. |
| 619 | 617 |
| 620 --deferred-map=<file> | 618 --deferred-map=<file> |
| 621 Generates a json file with a mapping from each deferred import to a list of | 619 Generates a json file with a mapping from each deferred import to a list of |
| 622 the part.js files that will be loaded. | 620 the part.js files that will be loaded. |
| 623 | 621 |
| 624 --dump-info | 622 --dump-info |
| 625 Generates an out.info.json file with information about the generated code. | 623 Generates an out.info.json file with information about the generated code. |
| 626 You can inspect the generated file with the viewer at: | 624 You can inspect the generated file with the viewer at: |
| 627 https://dart-lang.github.io/dump-info-visualizer/ | 625 https://dart-lang.github.io/dump-info-visualizer/ |
| 628 This feature is currently not supported in combination with the | 626 This feature is currently not supported in combination with the |
| 629 '--output-type=dart' option. | 627 '--output-type=dart' option. |
| 630 | 628 |
| 631 --generate-code-with-compile-time-errors | 629 --generate-code-with-compile-time-errors |
| 632 Generates output even if the program contains compile-time errors. Use the | 630 Generates output even if the program contains compile-time errors. Use the |
| 633 exit code to determine if compilation failed. | 631 exit code to determine if compilation failed. |
| 634 | 632 |
| 635 --use-cps-ir | 633 --use-cps-ir |
| 636 Experimental. Use the new CPS based backend for code generation. | 634 Experimental. Use the new CPS based backend for code generation. |
| 637 '''.trim()); | 635 '''.trim()); |
| 638 } | 636 } |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 } else if (exitCode == 253) { | 739 } else if (exitCode == 253) { |
| 742 print(">>> TEST CRASH"); | 740 print(">>> TEST CRASH"); |
| 743 } else { | 741 } else { |
| 744 print(">>> TEST FAIL"); | 742 print(">>> TEST FAIL"); |
| 745 } | 743 } |
| 746 stderr.writeln(">>> EOF STDERR"); | 744 stderr.writeln(">>> EOF STDERR"); |
| 747 subscription.resume(); | 745 subscription.resume(); |
| 748 }); | 746 }); |
| 749 }); | 747 }); |
| 750 } | 748 } |
| OLD | NEW |