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

Side by Side Diff: sdk/lib/_internal/lib/core_patch.dart

Issue 48323003: Implement fromEnvironment on bool, int, String in dart2js. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
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 // Patch file for dart:core classes. 5 // Patch file for dart:core classes.
6 import "dart:_collection-dev" as _symbol_dev; 6 import "dart:_collection-dev" as _symbol_dev;
7 import 'dart:_interceptors'; 7 import 'dart:_interceptors';
8 import 'dart:_js_helper' show checkNull, 8 import 'dart:_js_helper' show checkNull,
9 getRuntimeType, 9 getRuntimeType,
10 JSSyntaxRegExp, 10 JSSyntaxRegExp,
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 static const String _EXPANDO_PROPERTY_NAME = 'expando\$values'; 95 static const String _EXPANDO_PROPERTY_NAME = 'expando\$values';
96 static int _keyCount = 0; 96 static int _keyCount = 0;
97 } 97 }
98 98
99 patch class int { 99 patch class int {
100 patch static int parse(String source, 100 patch static int parse(String source,
101 { int radix, 101 { int radix,
102 int onError(String source) }) { 102 int onError(String source) }) {
103 return Primitives.parseInt(source, radix, onError); 103 return Primitives.parseInt(source, radix, onError);
104 } 104 }
105
106 patch factory int.fromEnvironment(String name, {int defaultValue}) {
107 throw new UnsupportedError(
108 'int.fromEnvironement can only be used as a const constructor');
109 }
105 } 110 }
106 111
107 patch class double { 112 patch class double {
108 patch static double parse(String source, 113 patch static double parse(String source,
109 [double onError(String source)]) { 114 [double onError(String source)]) {
110 return Primitives.parseDouble(source, onError); 115 return Primitives.parseDouble(source, onError);
111 } 116 }
112 } 117 }
113 118
114 patch class Error { 119 patch class Error {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 } 217 }
213 218
214 219
215 patch class String { 220 patch class String {
216 patch factory String.fromCharCodes(Iterable<int> charCodes) { 221 patch factory String.fromCharCodes(Iterable<int> charCodes) {
217 if (charCodes is! JSArray) { 222 if (charCodes is! JSArray) {
218 charCodes = new List.from(charCodes); 223 charCodes = new List.from(charCodes);
219 } 224 }
220 return Primitives.stringFromCharCodes(charCodes); 225 return Primitives.stringFromCharCodes(charCodes);
221 } 226 }
227
228 patch factory String.fromEnvironment(String name, {String defaultValue}) {
229 throw new UnsupportedError(
230 'String.fromEnvironement can only be used as a const constructor');
231 }
232 }
233
234 patch class bool {
235 patch factory bool.fromEnvironment(String name, {bool defaultValue}) {
236 throw new UnsupportedError(
237 'bool.fromEnvironement can only be used as a const constructor');
238 }
222 } 239 }
223 240
224 patch class RegExp { 241 patch class RegExp {
225 patch factory RegExp(String source, 242 patch factory RegExp(String source,
226 {bool multiLine: false, 243 {bool multiLine: false,
227 bool caseSensitive: true}) 244 bool caseSensitive: true})
228 => new JSSyntaxRegExp(source, 245 => new JSSyntaxRegExp(source,
229 multiLine: multiLine, 246 multiLine: multiLine,
230 caseSensitive: caseSensitive); 247 caseSensitive: caseSensitive);
231 } 248 }
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 329
313 patch class Uri { 330 patch class Uri {
314 patch static bool get _isWindows => false; 331 patch static bool get _isWindows => false;
315 332
316 patch static Uri get base { 333 patch static Uri get base {
317 String uri = Primitives.currentUri(); 334 String uri = Primitives.currentUri();
318 if (uri != null) return Uri.parse(uri); 335 if (uri != null) return Uri.parse(uri);
319 throw new UnsupportedError("'Uri.base' is not supported"); 336 throw new UnsupportedError("'Uri.base' is not supported");
320 } 337 }
321 } 338 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698