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

Unified Diff: sdk/lib/_internal/lib/core_patch.dart

Issue 50983002: Implement fromEnvironment on bool, int and String (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed comments Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/lib/core_patch.dart
diff --git a/sdk/lib/_internal/lib/core_patch.dart b/sdk/lib/_internal/lib/core_patch.dart
index cb844e0410fa7469d2a2f24e8b1a0ccdbcfc8840..8e5bec02c81cd96fb813f3328a2c64e52a228ba1 100644
--- a/sdk/lib/_internal/lib/core_patch.dart
+++ b/sdk/lib/_internal/lib/core_patch.dart
@@ -102,6 +102,11 @@ patch class int {
int onError(String source) }) {
return Primitives.parseInt(source, radix, onError);
}
+
+ patch factory int.fromEnvironment(String name, {int defaultValue}) {
+ throw new UnsupportedError(
+ 'int.fromEnvironement can only be used as a const constructor');
+ }
}
patch class double {
@@ -219,6 +224,18 @@ patch class String {
}
return Primitives.stringFromCharCodes(charCodes);
}
+
+ patch factory String.fromEnvironment(String name, {String defaultValue}) {
+ throw new UnsupportedError(
+ 'String.fromEnvironement can only be used as a const constructor');
+ }
+}
+
+patch class bool {
+ patch factory bool.fromEnvironment(String name, {bool defaultValue}) {
+ throw new UnsupportedError(
+ 'bool.fromEnvironement can only be used as a const constructor');
+ }
}
patch class RegExp {
« no previous file with comments | « runtime/vm/parser.cc ('k') | sdk/lib/core/bool.dart » ('j') | sdk/lib/core/bool.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698