OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 import 'configuration.dart'; | 5 import 'configuration.dart'; |
6 | 6 |
7 typedef String _LookUpFunction(Configuration configuration); | 7 typedef String _LookUpFunction(Configuration configuration); |
8 typedef bool _BoolLookUpFunction(Configuration configuration); | 8 typedef bool _BoolLookUpFunction(Configuration configuration); |
9 | 9 |
10 // TODO(29756): Instead of synthesized negated variables like "unchecked", | 10 // TODO(29756): Instead of synthesized negated variables like "unchecked", |
11 // consider adding support for "!" to status expressions. | 11 // consider adding support for "!" to status expressions. |
12 final _variables = { | 12 final _variables = { |
13 "analyzer": new _Variable.bool((c) => c.compiler == Compiler.dart2analyzer), | 13 "analyzer": new _Variable.bool((c) => c.compiler == Compiler.dart2analyzer), |
14 "arch": new _Variable((c) => c.architecture.name, Architecture.names), | 14 "arch": new _Variable((c) => c.architecture.name, Architecture.names), |
15 "browser": new _Variable.bool((c) => c.runtime.isBrowser), | 15 "browser": new _Variable.bool((c) => c.runtime.isBrowser), |
16 "builder_tag": new _Variable((c) => c.builderTag ?? "", const []), | 16 "builder_tag": new _Variable((c) => c.builderTag ?? "", const []), |
17 "checked": new _Variable.bool((c) => c.isChecked), | 17 "checked": new _Variable.bool((c) => c.isChecked), |
18 "compiler": new _Variable((c) => c.compiler.name, Compiler.names), | 18 "compiler": new _Variable((c) => c.compiler.name, Compiler.names), |
19 "csp": new _Variable.bool((c) => c.isCsp), | 19 "csp": new _Variable.bool((c) => c.isCsp), |
20 "dart2js_with_kernel": new _Variable.bool((c) => c.useDart2JSWithKernel), | 20 "dart2js_with_kernel": new _Variable.bool((c) => c.useDart2JSWithKernel), |
21 "fast_startup": new _Variable.bool((c) => c.useFastStartup), | 21 "fast_startup": new _Variable.bool((c) => c.useFastStartup), |
| 22 "enable_asserts": new _Variable.bool((c) => c.useEnableAsserts), |
22 "host_checked": new _Variable.bool((c) => c.isHostChecked), | 23 "host_checked": new _Variable.bool((c) => c.isHostChecked), |
23 "host_unchecked": new _Variable.bool((c) => !c.isHostChecked), | 24 "host_unchecked": new _Variable.bool((c) => !c.isHostChecked), |
24 "hot_reload": new _Variable.bool((c) => c.hotReload), | 25 "hot_reload": new _Variable.bool((c) => c.hotReload), |
25 "hot_reload_rollback": new _Variable.bool((c) => c.hotReloadRollback), | 26 "hot_reload_rollback": new _Variable.bool((c) => c.hotReloadRollback), |
26 "ie": new _Variable.bool((c) => c.runtime.isIE), | 27 "ie": new _Variable.bool((c) => c.runtime.isIE), |
27 "jscl": new _Variable.bool((c) => c.runtime.isJSCommandLine), | 28 "jscl": new _Variable.bool((c) => c.runtime.isJSCommandLine), |
28 "minified": new _Variable.bool((c) => c.isMinified), | 29 "minified": new _Variable.bool((c) => c.isMinified), |
29 "mode": new _Variable((c) => c.mode.name, Mode.names), | 30 "mode": new _Variable((c) => c.mode.name, Mode.names), |
30 "runtime": new _Variable(_runtimeName, Runtime.names), | 31 "runtime": new _Variable(_runtimeName, Runtime.names), |
31 "strong": new _Variable.bool((c) => c.isStrong), | 32 "strong": new _Variable.bool((c) => c.isStrong), |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 _Variable(this._lookUp, Iterable<String> allowed) | 105 _Variable(this._lookUp, Iterable<String> allowed) |
105 : allowedValues = allowed.toList(); | 106 : allowedValues = allowed.toList(); |
106 | 107 |
107 /// Creates a Boolean variable with allowed values "true" and "false". | 108 /// Creates a Boolean variable with allowed values "true" and "false". |
108 _Variable.bool(_BoolLookUpFunction lookUp) | 109 _Variable.bool(_BoolLookUpFunction lookUp) |
109 : _lookUp = ((configuration) => lookUp(configuration).toString()), | 110 : _lookUp = ((configuration) => lookUp(configuration).toString()), |
110 allowedValues = const ["true", "false"]; | 111 allowedValues = const ["true", "false"]; |
111 | 112 |
112 String lookUp(Configuration configuration) => _lookUp(configuration); | 113 String lookUp(Configuration configuration) => _lookUp(configuration); |
113 } | 114 } |
OLD | NEW |