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 101 matching lines...) Loading... |
112 bool explicitOut = false; | 112 bool explicitOut = false; |
113 bool wantHelp = false; | 113 bool wantHelp = false; |
114 bool wantVersion = false; | 114 bool wantVersion = false; |
115 String outputLanguage = 'JavaScript'; | 115 String outputLanguage = 'JavaScript'; |
116 bool stripArgumentSet = false; | 116 bool stripArgumentSet = false; |
117 bool analyzeOnly = false; | 117 bool analyzeOnly = false; |
118 bool analyzeAll = false; | 118 bool analyzeAll = false; |
119 bool dumpInfo = false; | 119 bool dumpInfo = false; |
120 bool allowNativeExtensions = false; | 120 bool allowNativeExtensions = false; |
121 bool trustTypeAnnotations = false; | 121 bool trustTypeAnnotations = false; |
| 122 bool trustJSInteropTypeAnnotations = false; |
122 bool checkedMode = false; | 123 bool checkedMode = false; |
123 // List of provided options that imply that output is expected. | 124 // List of provided options that imply that output is expected. |
124 List<String> optionsImplyCompilation = <String>[]; | 125 List<String> optionsImplyCompilation = <String>[]; |
125 bool hasDisallowUnsafeEval = false; | 126 bool hasDisallowUnsafeEval = false; |
126 // TODO(johnniwinther): Measure time for reading files. | 127 // TODO(johnniwinther): Measure time for reading files. |
127 SourceFileProvider inputProvider = new CompilerSourceFileProvider(); | 128 SourceFileProvider inputProvider = new CompilerSourceFileProvider(); |
128 diagnosticHandler = new FormattingDiagnosticHandler(inputProvider); | 129 diagnosticHandler = new FormattingDiagnosticHandler(inputProvider); |
129 Map<String, dynamic> environment = new Map<String, dynamic>(); | 130 Map<String, dynamic> environment = new Map<String, dynamic>(); |
130 | 131 |
131 passThrough(String argument) => options.add(argument); | 132 passThrough(String argument) => options.add(argument); |
(...skipping 88 matching lines...) Loading... |
220 setDumpInfo(String argument) { | 221 setDumpInfo(String argument) { |
221 implyCompilation(argument); | 222 implyCompilation(argument); |
222 dumpInfo = true; | 223 dumpInfo = true; |
223 } | 224 } |
224 | 225 |
225 setTrustTypeAnnotations(String argument) { | 226 setTrustTypeAnnotations(String argument) { |
226 trustTypeAnnotations = true; | 227 trustTypeAnnotations = true; |
227 implyCompilation(argument); | 228 implyCompilation(argument); |
228 } | 229 } |
229 | 230 |
| 231 setTrustJSInteropTypeAnnotations(String argument) { |
| 232 trustJSInteropTypeAnnotations = true; |
| 233 implyCompilation(argument); |
| 234 } |
| 235 |
230 setTrustPrimitives(String argument) { | 236 setTrustPrimitives(String argument) { |
231 implyCompilation(argument); | 237 implyCompilation(argument); |
232 } | 238 } |
233 | 239 |
234 setCheckedMode(String argument) { | 240 setCheckedMode(String argument) { |
235 checkedMode = true; | 241 checkedMode = true; |
236 passThrough(argument); | 242 passThrough(argument); |
237 } | 243 } |
238 | 244 |
239 addInEnvironment(String argument) { | 245 addInEnvironment(String argument) { |
(...skipping 79 matching lines...) Loading... |
319 new OptionHandler(Flags.enableDiagnosticColors, | 325 new OptionHandler(Flags.enableDiagnosticColors, |
320 (_) => diagnosticHandler.enableColors = true), | 326 (_) => diagnosticHandler.enableColors = true), |
321 new OptionHandler('--enable[_-]checked[_-]mode|--checked', | 327 new OptionHandler('--enable[_-]checked[_-]mode|--checked', |
322 (_) => setCheckedMode(Flags.enableCheckedMode)), | 328 (_) => setCheckedMode(Flags.enableCheckedMode)), |
323 new OptionHandler(Flags.trustTypeAnnotations, | 329 new OptionHandler(Flags.trustTypeAnnotations, |
324 (_) => setTrustTypeAnnotations( | 330 (_) => setTrustTypeAnnotations( |
325 Flags.trustTypeAnnotations)), | 331 Flags.trustTypeAnnotations)), |
326 new OptionHandler(Flags.trustPrimitives, | 332 new OptionHandler(Flags.trustPrimitives, |
327 (_) => setTrustPrimitives( | 333 (_) => setTrustPrimitives( |
328 Flags.trustPrimitives)), | 334 Flags.trustPrimitives)), |
| 335 new OptionHandler(Flags.trustJSInteropTypeAnnotations, |
| 336 (_) => setTrustJSInteropTypeAnnotations( |
| 337 Flags.trustJSInteropTypeAnnotations)), |
329 new OptionHandler(r'--help|/\?|/h', (_) => wantHelp = true), | 338 new OptionHandler(r'--help|/\?|/h', (_) => wantHelp = true), |
330 new OptionHandler('--packages=.+', setPackageConfig), | 339 new OptionHandler('--packages=.+', setPackageConfig), |
331 new OptionHandler('--package-root=.+|-p.+', setPackageRoot), | 340 new OptionHandler('--package-root=.+|-p.+', setPackageRoot), |
332 new OptionHandler(Flags.analyzeAll, setAnalyzeAll), | 341 new OptionHandler(Flags.analyzeAll, setAnalyzeAll), |
333 new OptionHandler(Flags.analyzeOnly, setAnalyzeOnly), | 342 new OptionHandler(Flags.analyzeOnly, setAnalyzeOnly), |
334 new OptionHandler(Flags.noSourceMaps, passThrough), | 343 new OptionHandler(Flags.noSourceMaps, passThrough), |
335 new OptionHandler(Flags.analyzeSignaturesOnly, setAnalyzeOnly), | 344 new OptionHandler(Flags.analyzeSignaturesOnly, setAnalyzeOnly), |
336 new OptionHandler(Flags.disableNativeLiveTypeAnalysis, passThrough), | 345 new OptionHandler(Flags.disableNativeLiveTypeAnalysis, passThrough), |
337 new OptionHandler('--categories=.*', setCategories), | 346 new OptionHandler('--categories=.*', setCategories), |
338 new OptionHandler(Flags.disableTypeInference, implyCompilation), | 347 new OptionHandler(Flags.disableTypeInference, implyCompilation), |
(...skipping 418 matching lines...) Loading... |
757 } else if (exitCode == 253) { | 766 } else if (exitCode == 253) { |
758 print(">>> TEST CRASH"); | 767 print(">>> TEST CRASH"); |
759 } else { | 768 } else { |
760 print(">>> TEST FAIL"); | 769 print(">>> TEST FAIL"); |
761 } | 770 } |
762 stderr.writeln(">>> EOF STDERR"); | 771 stderr.writeln(">>> EOF STDERR"); |
763 subscription.resume(); | 772 subscription.resume(); |
764 }); | 773 }); |
765 }); | 774 }); |
766 } | 775 } |
OLD | NEW |