Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: sdk/lib/core/bool.dart

Issue 1350053002: Add "environment" parameter to spawnUri for String.fromEnvironment support. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Address comments Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sdk/lib/_internal/js_runtime/lib/isolate_patch.dart ('k') | sdk/lib/isolate/isolate.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 part of dart.core; 5 part of dart.core;
6 6
7 /** 7 /**
8 * The reserved words [:true:] and [:false:] denote objects that are the only 8 * The reserved words [:true:] and [:false:] denote objects that are the only
9 * instances of this class. 9 * instances of this class.
10 * 10 *
11 * It is a compile-time error for a class to attempt to extend or implement 11 * It is a compile-time error for a class to attempt to extend or implement
12 * bool. 12 * bool.
13 */ 13 */
14 class bool { 14 class bool {
15 /** 15 /**
16 * Returns the boolean value of the environment declaration [name]. 16 * Returns the boolean value of the environment declaration [name].
17 * 17 *
18 * The boolean value of the declaration is `true` if the declared value is 18 * The boolean value of the declaration is `true` if the declared value is
19 * the string `"true"`, and `false` if the value is `"false"`. 19 * the string `"true"`, and `false` if the value is `"false"`.
20 * 20 *
21 * In all other cases, including when there is no declaration for `name`, 21 * In all other cases, including when there is no declaration for `name`,
22 * the result is the [defaultValue]. 22 * the result is the [defaultValue].
23 * 23 *
24 * The result is the same as would be returned by:
25 *
26 * (const String.fromEnvironment(name) == "true")
27 * ? true
28 * : (const String.fromEnvironment(name) == "false")
29 * ? false
30 * : defaultValue
31 *
24 * Example: 32 * Example:
25 * 33 *
26 * const loggingFlag = const bool.fromEnvironment("logging"); 34 * const loggingFlag = const bool.fromEnvironment("logging");
27 * 35 *
28 * If you want to use a different truth-string, you can use the 36 * If you want to use a different truth-string than `"true"`, you can use the
floitsch 2015/09/22 09:36:46 no need to codify the "true".
Lasse Reichstein Nielsen 2015/09/22 10:28:09 It's intended as code, so I prefer it codified.
29 * [String.fromEnvironment] constructor directly: 37 * [String.fromEnvironment] constructor directly:
30 * 38 *
31 * const isLoggingOn = (const String.fromEnvironment("logging") == "on"); 39 * const isLoggingOn = (const String.fromEnvironment("logging") == "on");
32 */ 40 */
33 external const factory bool.fromEnvironment(String name, 41 external const factory bool.fromEnvironment(String name,
34 {bool defaultValue: false}); 42 {bool defaultValue: false});
35 43
36 /** 44 /**
37 * Returns [:"true":] if the receiver is [:true:], or [:"false":] if the 45 * Returns [:"true":] if the receiver is [:true:], or [:"false":] if the
38 * receiver is [:false:]. 46 * receiver is [:false:].
39 */ 47 */
40 String toString() { 48 String toString() {
41 return this ? "true" : "false"; 49 return this ? "true" : "false";
42 } 50 }
43 } 51 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/js_runtime/lib/isolate_patch.dart ('k') | sdk/lib/isolate/isolate.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698