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

Issue 50983002: Implement fromEnvironment on bool, int and String (Closed)

Created:
7 years, 1 month ago by Søren Gjesse
Modified:
7 years, 1 month ago
CC:
reviews_dartlang.org, vm-dev_dartlang.org
Visibility:
Public.

Description

Implement fromEnvironment on bool, int and String This implements const constructor fromEnvironment on bool, int and String. The VM have the added -Dname=value option to define the value for the properties. All values are provided by using the -D - nothing is read from the environment. If the resulting value is null or - in the case of int.fromEnvironment - not a number an ArgumentError is thrown. This CL does not have any implementation for dart2js. This is a continuation of the change https://chromiumcodereview.appspot.com/24975002 by iposva@ BUG= R=iposva@google.com Committed: https://code.google.com/p/dart/source/detail?r=29642

Patch Set 1 #

Total comments: 32

Patch Set 2 : Updated the corelib interface, re-arranged tests, initial fixes #

Patch Set 3 : Addressed review comments #

Patch Set 4 : Rebased to r29529 #

Patch Set 5 : Add support for negative ints. Add more tests. #

Total comments: 2

Patch Set 6 : Added defaultValue for bool.fromEnvironment #

Patch Set 7 : Re-arrange the tests #

Patch Set 8 : Updated tests #

Patch Set 9 : Make un-parsable integers return the defult value #

Patch Set 10 : Fix compilation on Mac OS and update status file #

Total comments: 10

Patch Set 11 : Update to make all tests run #

Patch Set 12 : rebased to r29571 #

Patch Set 13 : Renamed config to environment in the code #

Patch Set 14 : Change tests from VMOptions to SharedOptions in preparation for the dart2js change #

Patch Set 15 : Addressed more review comments #

Total comments: 3

Patch Set 16 : Addressed comments #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+493 lines, -38 lines) Patch
M runtime/bin/main.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 7 chunks +92 lines, -0 lines 0 comments Download
M runtime/include/dart_api.h View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +27 lines, -1 line 0 comments Download
A runtime/lib/bool.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +46 lines, -0 lines 0 comments Download
M runtime/lib/bool_patch.dart View 1 2 3 4 5 1 chunk +4 lines, -0 lines 0 comments Download
M runtime/lib/corelib_sources.gypi View 1 chunk +1 line, -0 lines 0 comments Download
M runtime/lib/integers.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 2 chunks +58 lines, -0 lines 0 comments Download
M runtime/lib/integers_patch.dart View 1 1 chunk +4 lines, -0 lines 0 comments Download
M runtime/lib/string.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 2 chunks +29 lines, -0 lines 0 comments Download
M runtime/lib/string_patch.dart View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +4 lines, -0 lines 0 comments Download
M runtime/platform/hashmap.h View 1 2 3 4 1 chunk +21 lines, -0 lines 0 comments Download
M runtime/vm/bootstrap_natives.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 2 chunks +3 lines, -0 lines 0 comments Download
M runtime/vm/dart_api_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +11 lines, -0 lines 0 comments Download
M runtime/vm/isolate.h View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +8 lines, -0 lines 0 comments Download
M runtime/vm/isolate.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +1 line, -0 lines 0 comments Download
M runtime/vm/parser.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 5 chunks +33 lines, -15 lines 0 comments Download
M sdk/lib/_internal/lib/core_patch.dart View 1 2 3 4 5 6 7 8 9 10 2 chunks +17 lines, -0 lines 0 comments Download
M sdk/lib/core/bool.dart View 1 2 3 4 5 1 chunk +5 lines, -4 lines 1 comment Download
M sdk/lib/core/int.dart View 1 1 chunk +8 lines, -0 lines 1 comment Download
M sdk/lib/core/string.dart View 1 1 chunk +7 lines, -0 lines 0 comments Download
A tests/corelib/bool_from_environment2_test.dart View 1 2 3 4 5 6 7 8 9 10 1 chunk +11 lines, -0 lines 0 comments Download
A tests/corelib/bool_from_environment_default_value_test.dart View 1 2 3 4 5 6 7 8 9 10 1 chunk +12 lines, -0 lines 0 comments Download
A + tests/corelib/bool_from_environment_test.dart View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +3 lines, -4 lines 0 comments Download
M tests/corelib/corelib.status View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +27 lines, -0 lines 0 comments Download
A + tests/corelib/int_from_environment2_test.dart View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +4 lines, -3 lines 0 comments Download
A tests/corelib/int_from_environment3_test.dart View 1 2 3 4 5 6 7 8 9 10 1 chunk +11 lines, -0 lines 0 comments Download
A + tests/corelib/int_from_environment_default_value_test.dart View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +2 lines, -4 lines 0 comments Download
A tests/corelib/int_from_environment_test.dart View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +13 lines, -0 lines 0 comments Download
A + tests/corelib/string_from_environment2_test.dart View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +4 lines, -3 lines 0 comments Download
A tests/corelib/string_from_environment3_test.dart View 1 2 3 4 5 6 7 8 9 10 1 chunk +11 lines, -0 lines 0 comments Download
A + tests/corelib/string_from_environment_default_value.dart View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +3 lines, -4 lines 0 comments Download
A tests/corelib/string_from_environment_test.dart View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +13 lines, -0 lines 0 comments Download

Messages

Total messages: 22 (0 generated)
Søren Gjesse
There are still some outstanding questions: Is ArgumentError the correct error? Should we support hex ...
7 years, 1 month ago (2013-10-29 16:54:36 UTC) #1
siva
DBC. How is this supposed to work in dartium? I don't think these can be ...
7 years, 1 month ago (2013-10-29 20:50:22 UTC) #2
Lasse Reichstein Nielsen
On 2013/10/29 20:50:22, siva wrote: > DBC. > > How is this supposed to work ...
7 years, 1 month ago (2013-10-29 21:05:34 UTC) #3
siva
I find the design process to be completely broken were in APIs which depend on ...
7 years, 1 month ago (2013-10-29 21:23:41 UTC) #4
Ivan Posva
Needs a lot more work. -Ivan https://codereview.chromium.org/50983002/diff/1/runtime/bin/main.cc File runtime/bin/main.cc (right): https://codereview.chromium.org/50983002/diff/1/runtime/bin/main.cc#newcode76 runtime/bin/main.cc:76: static HashMap* configuration ...
7 years, 1 month ago (2013-10-29 21:42:58 UTC) #5
Søren Gjesse
An initial clarifying question https://codereview.chromium.org/50983002/diff/1/runtime/lib/bool.cc File runtime/lib/bool.cc (right): https://codereview.chromium.org/50983002/diff/1/runtime/lib/bool.cc#newcode31 runtime/lib/bool.cc:31: return (strcmp("false", chars) != 0) ...
7 years, 1 month ago (2013-10-29 22:44:38 UTC) #6
Ivan Posva
https://codereview.chromium.org/50983002/diff/1/runtime/lib/bool.cc File runtime/lib/bool.cc (right): https://codereview.chromium.org/50983002/diff/1/runtime/lib/bool.cc#newcode31 runtime/lib/bool.cc:31: return (strcmp("false", chars) != 0) On 2013/10/29 22:44:39, Søren ...
7 years, 1 month ago (2013-10-30 05:08:20 UTC) #7
Søren Gjesse
PTAL Addressed all comments. https://codereview.chromium.org/50983002/diff/1/runtime/bin/main.cc File runtime/bin/main.cc (right): https://codereview.chromium.org/50983002/diff/1/runtime/bin/main.cc#newcode76 runtime/bin/main.cc:76: static HashMap* configuration = NULL; ...
7 years, 1 month ago (2013-10-30 11:44:01 UTC) #8
kasperl
https://codereview.chromium.org/50983002/diff/230001/sdk/lib/core/bool.dart File sdk/lib/core/bool.dart (right): https://codereview.chromium.org/50983002/diff/230001/sdk/lib/core/bool.dart#newcode17 sdk/lib/core/bool.dart:17: * [defaultValue] if [name] is not present. Shouldn't this ...
7 years, 1 month ago (2013-10-30 13:32:48 UTC) #9
kasperl
So what's the status of this when it comes to wrong values from the environment? ...
7 years, 1 month ago (2013-10-30 13:47:02 UTC) #10
Søren Gjesse
https://codereview.chromium.org/50983002/diff/230001/sdk/lib/core/bool.dart File sdk/lib/core/bool.dart (right): https://codereview.chromium.org/50983002/diff/230001/sdk/lib/core/bool.dart#newcode17 sdk/lib/core/bool.dart:17: * [defaultValue] if [name] is not present. On 2013/10/30 ...
7 years, 1 month ago (2013-10-30 13:59:29 UTC) #11
kasperl
On 2013/10/30 13:59:29, Søren Gjesse wrote: > https://codereview.chromium.org/50983002/diff/230001/sdk/lib/core/bool.dart > File sdk/lib/core/bool.dart (right): > > https://codereview.chromium.org/50983002/diff/230001/sdk/lib/core/bool.dart#newcode17 ...
7 years, 1 month ago (2013-10-30 14:05:23 UTC) #12
Lasse Reichstein Nielsen
> I understand that users will always get the default value if they mistype the ...
7 years, 1 month ago (2013-10-30 18:28:55 UTC) #13
Søren Gjesse
On 2013/10/30 13:47:02, kasperl wrote: > So what's the status of this when it comes ...
7 years, 1 month ago (2013-10-30 20:21:48 UTC) #14
Søren Gjesse
On 2013/10/30 18:28:55, Lasse Reichstein Nielsen wrote: > > I understand that users will always ...
7 years, 1 month ago (2013-10-30 20:28:54 UTC) #15
Ivan Posva
-Ivan https://codereview.chromium.org/50983002/diff/400001/runtime/bin/main.cc File runtime/bin/main.cc (right): https://codereview.chromium.org/50983002/diff/400001/runtime/bin/main.cc#newcode76 runtime/bin/main.cc:76: // The configuration provided through the command line ...
7 years, 1 month ago (2013-10-30 20:44:42 UTC) #16
Søren Gjesse
Addressed comments. Also added freeing of environment at shutdown. https://codereview.chromium.org/50983002/diff/400001/runtime/bin/main.cc File runtime/bin/main.cc (right): https://codereview.chromium.org/50983002/diff/400001/runtime/bin/main.cc#newcode76 runtime/bin/main.cc:76: ...
7 years, 1 month ago (2013-10-30 21:24:33 UTC) #17
Ivan Posva
LGTM for the VM changes. -Ivan https://codereview.chromium.org/50983002/diff/510002/runtime/lib/integers.cc File runtime/lib/integers.cc (right): https://codereview.chromium.org/50983002/diff/510002/runtime/lib/integers.cc#newcode252 runtime/lib/integers.cc:252: if (*digits == ...
7 years, 1 month ago (2013-10-31 05:32:59 UTC) #18
Søren Gjesse
Committed patchset #16 manually as r29642 (presubmit successful).
7 years, 1 month ago (2013-10-31 05:47:22 UTC) #19
Lasse Reichstein Nielsen
https://codereview.chromium.org/50983002/diff/1290001/sdk/lib/core/bool.dart File sdk/lib/core/bool.dart (right): https://codereview.chromium.org/50983002/diff/1290001/sdk/lib/core/bool.dart#newcode19 sdk/lib/core/bool.dart:19: external const factory bool.fromEnvironment(String name, {bool defaultValue}); I still ...
7 years, 1 month ago (2013-10-31 06:55:37 UTC) #20
Søren Gjesse
https://codereview.chromium.org/50983002/diff/510002/runtime/lib/integers.cc File runtime/lib/integers.cc (right): https://codereview.chromium.org/50983002/diff/510002/runtime/lib/integers.cc#newcode252 runtime/lib/integers.cc:252: if (*digits == '-') { On 2013/10/31 05:33:00, Ivan ...
7 years, 1 month ago (2013-10-31 07:05:10 UTC) #21
Lasse Reichstein Nielsen
7 years, 1 month ago (2013-10-31 07:15:30 UTC) #22
Message was sent while issue was closed.
https://codereview.chromium.org/50983002/diff/510002/runtime/lib/integers.cc
File runtime/lib/integers.cc (right):

https://codereview.chromium.org/50983002/diff/510002/runtime/lib/integers.cc#...
runtime/lib/integers.cc:252: if (*digits == '-') {
This does not allow leading whitespace or a leading '+', which int.parse does.
We should match int.parse with no radix supplied.

Powered by Google App Engine
This is Rietveld 408576698