OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 leg_apiimpl; | 5 library leg_apiimpl; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import '../compiler.dart' as api; | 9 import '../compiler.dart' as api; |
10 import 'dart2jslib.dart' as leg; | 10 import 'dart2jslib.dart' as leg; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 "build number could not be determined"), | 77 "build number could not be determined"), |
78 showPackageWarnings: | 78 showPackageWarnings: |
79 hasOption(options, '--show-package-warnings'), | 79 hasOption(options, '--show-package-warnings'), |
80 useContentSecurityPolicy: hasOption(options, '--csp'), | 80 useContentSecurityPolicy: hasOption(options, '--csp'), |
81 hasIncrementalSupport: | 81 hasIncrementalSupport: |
82 forceIncrementalSupport || | 82 forceIncrementalSupport || |
83 hasOption(options, '--incremental-support'), | 83 hasOption(options, '--incremental-support'), |
84 suppressWarnings: hasOption(options, '--suppress-warnings'), | 84 suppressWarnings: hasOption(options, '--suppress-warnings'), |
85 enableExperimentalMirrors: | 85 enableExperimentalMirrors: |
86 hasOption(options, '--enable-experimental-mirrors'), | 86 hasOption(options, '--enable-experimental-mirrors'), |
87 enableAsyncAwait: hasOption(options, '--enable-async'), | |
88 generateCodeWithCompileTimeErrors: | 87 generateCodeWithCompileTimeErrors: |
89 hasOption(options, '--generate-code-with-compile-time-errors'), | 88 hasOption(options, '--generate-code-with-compile-time-errors'), |
90 allowNativeExtensions: | 89 allowNativeExtensions: |
91 hasOption(options, '--allow-native-extensions')) { | 90 hasOption(options, '--allow-native-extensions')) { |
92 tasks.addAll([ | 91 tasks.addAll([ |
93 userHandlerTask = new leg.GenericTask('Diagnostic handler', this), | 92 userHandlerTask = new leg.GenericTask('Diagnostic handler', this), |
94 userProviderTask = new leg.GenericTask('Input provider', this), | 93 userProviderTask = new leg.GenericTask('Input provider', this), |
95 ]); | 94 ]); |
96 if (libraryRoot == null) { | 95 if (libraryRoot == null) { |
97 throw new ArgumentError("[libraryRoot] is null."); | 96 throw new ArgumentError("[libraryRoot] is null."); |
98 } | 97 } |
99 if (!libraryRoot.path.endsWith("/")) { | 98 if (!libraryRoot.path.endsWith("/")) { |
100 throw new ArgumentError("[libraryRoot] must end with a /."); | 99 throw new ArgumentError("[libraryRoot] must end with a /."); |
101 } | 100 } |
102 if (packageRoot == null) { | 101 if (packageRoot == null) { |
103 throw new ArgumentError("[packageRoot] is null."); | 102 throw new ArgumentError("[packageRoot] is null."); |
104 } | 103 } |
105 if (!packageRoot.path.endsWith("/")) { | 104 if (!packageRoot.path.endsWith("/")) { |
106 throw new ArgumentError("[packageRoot] must end with a /."); | 105 throw new ArgumentError("[packageRoot] must end with a /."); |
107 } | 106 } |
108 if (!analyzeOnly) { | 107 if (!analyzeOnly) { |
109 if (enableAsyncAwait && emitJavaScript) { | |
110 throw new ArgumentError( | |
111 "--enable-async is currently only supported with --analyze-only"); | |
112 } | |
113 if (allowNativeExtensions) { | 108 if (allowNativeExtensions) { |
114 throw new ArgumentError( | 109 throw new ArgumentError( |
115 "--allow-native-extensions is only supported in combination with " | 110 "--allow-native-extensions is only supported in combination with " |
116 "--analyze-only"); | 111 "--analyze-only"); |
117 } | 112 } |
118 } | 113 } |
119 } | 114 } |
120 | 115 |
121 static String extractStringOption(List<String> options, | 116 static String extractStringOption(List<String> options, |
122 String prefix, | 117 String prefix, |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 print('$message: ${tryToString(exception)}'); | 400 print('$message: ${tryToString(exception)}'); |
406 print(tryToString(stackTrace)); | 401 print(tryToString(stackTrace)); |
407 } | 402 } |
408 | 403 |
409 fromEnvironment(String name) => environment[name]; | 404 fromEnvironment(String name) => environment[name]; |
410 | 405 |
411 LibraryInfo lookupLibraryInfo(String libraryName) { | 406 LibraryInfo lookupLibraryInfo(String libraryName) { |
412 return library_info.LIBRARIES[libraryName]; | 407 return library_info.LIBRARIES[libraryName]; |
413 } | 408 } |
414 } | 409 } |
OLD | NEW |