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", |
(...skipping 12 matching lines...) Expand all Loading... |
23 "host_unchecked": new _Variable.bool((c) => !c.isHostChecked), | 23 "host_unchecked": new _Variable.bool((c) => !c.isHostChecked), |
24 "hot_reload": new _Variable.bool((c) => c.hotReload), | 24 "hot_reload": new _Variable.bool((c) => c.hotReload), |
25 "hot_reload_rollback": new _Variable.bool((c) => c.hotReloadRollback), | 25 "hot_reload_rollback": new _Variable.bool((c) => c.hotReloadRollback), |
26 "ie": new _Variable.bool((c) => c.runtime.isIE), | 26 "ie": new _Variable.bool((c) => c.runtime.isIE), |
27 "jscl": new _Variable.bool((c) => c.runtime.isJSCommandLine), | 27 "jscl": new _Variable.bool((c) => c.runtime.isJSCommandLine), |
28 "minified": new _Variable.bool((c) => c.isMinified), | 28 "minified": new _Variable.bool((c) => c.isMinified), |
29 "mode": new _Variable((c) => c.mode.name, Mode.names), | 29 "mode": new _Variable((c) => c.mode.name, Mode.names), |
30 "runtime": new _Variable(_runtimeName, Runtime.names), | 30 "runtime": new _Variable(_runtimeName, Runtime.names), |
31 "strong": new _Variable.bool((c) => c.isStrong), | 31 "strong": new _Variable.bool((c) => c.isStrong), |
32 "system": new _Variable((c) => c.system.name, System.names), | 32 "system": new _Variable((c) => c.system.name, System.names), |
33 "unchecked": new _Variable.bool((c) => !c.isChecked), | |
34 "unminified": new _Variable.bool((c) => !c.isMinified), | |
35 "use_sdk": new _Variable.bool((c) => c.useSdk) | 33 "use_sdk": new _Variable.bool((c) => c.useSdk) |
36 }; | 34 }; |
37 | 35 |
38 /// Gets the name of the runtime as it appears in status files. | 36 /// Gets the name of the runtime as it appears in status files. |
39 String _runtimeName(Configuration configuration) { | 37 String _runtimeName(Configuration configuration) { |
40 // TODO(rnystrom): Handle "ff" being used as the name for firefox. We don't | 38 // TODO(rnystrom): Handle "ff" being used as the name for firefox. We don't |
41 // want to make the Runtime itself use that as the name because it appears | 39 // want to make the Runtime itself use that as the name because it appears |
42 // elsewhere in test.dart and we want those other places to show "firefox". | 40 // elsewhere in test.dart and we want those other places to show "firefox". |
43 if (configuration.runtime == Runtime.firefox) return 'ff'; | 41 if (configuration.runtime == Runtime.firefox) return 'ff'; |
44 | 42 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 _Variable(this._lookUp, Iterable<String> allowed) | 104 _Variable(this._lookUp, Iterable<String> allowed) |
107 : allowedValues = allowed.toList(); | 105 : allowedValues = allowed.toList(); |
108 | 106 |
109 /// Creates a Boolean variable with allowed values "true" and "false". | 107 /// Creates a Boolean variable with allowed values "true" and "false". |
110 _Variable.bool(_BoolLookUpFunction lookUp) | 108 _Variable.bool(_BoolLookUpFunction lookUp) |
111 : _lookUp = ((configuration) => lookUp(configuration).toString()), | 109 : _lookUp = ((configuration) => lookUp(configuration).toString()), |
112 allowedValues = const ["true", "false"]; | 110 allowedValues = const ["true", "false"]; |
113 | 111 |
114 String lookUp(Configuration configuration) => _lookUp(configuration); | 112 String lookUp(Configuration configuration) => _lookUp(configuration); |
115 } | 113 } |
OLD | NEW |