OLD | NEW |
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:_internal" as _symbol_dev; | 6 import "dart:_internal" as _symbol_dev; |
7 import 'dart:_interceptors'; | 7 import 'dart:_interceptors'; |
8 import 'dart:_js_helper' | 8 import 'dart:_js_helper' |
9 show | 9 show |
10 patch, | 10 patch, |
11 checkInt, | 11 checkInt, |
12 getRuntimeType, | 12 getRuntimeType, |
| 13 getTraceFromException, |
13 jsonEncodeNative, | 14 jsonEncodeNative, |
14 JsLinkedHashMap, | 15 JsLinkedHashMap, |
15 JSSyntaxRegExp, | 16 JSSyntaxRegExp, |
| 17 NoInline, |
| 18 objectHashCode, |
16 Primitives, | 19 Primitives, |
17 stringJoinUnchecked, | 20 stringJoinUnchecked; |
18 objectHashCode, | |
19 getTraceFromException; | |
20 | 21 |
21 import 'dart:_foreign_helper' show JS; | 22 import 'dart:_foreign_helper' show JS; |
22 | 23 |
23 import 'dart:_native_typed_data' show NativeUint8List; | 24 import 'dart:_native_typed_data' show NativeUint8List; |
24 | 25 |
25 String _symbolToString(Symbol symbol) => _symbol_dev.Symbol.getName(symbol); | 26 String _symbolToString(Symbol symbol) => _symbol_dev.Symbol.getName(symbol); |
26 | 27 |
27 @patch | 28 @patch |
28 int identityHashCode(Object object) => objectHashCode(object); | 29 int identityHashCode(Object object) => objectHashCode(object); |
29 | 30 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 125 |
125 @patch | 126 @patch |
126 class int { | 127 class int { |
127 @patch | 128 @patch |
128 static int parse(String source, {int radix, int onError(String source)}) { | 129 static int parse(String source, {int radix, int onError(String source)}) { |
129 return Primitives.parseInt(source, radix, onError); | 130 return Primitives.parseInt(source, radix, onError); |
130 } | 131 } |
131 | 132 |
132 @patch | 133 @patch |
133 factory int.fromEnvironment(String name, {int defaultValue}) { | 134 factory int.fromEnvironment(String name, {int defaultValue}) { |
| 135 // ignore: const_constructor_throws_exception |
134 throw new UnsupportedError( | 136 throw new UnsupportedError( |
135 'int.fromEnvironment can only be used as a const constructor'); | 137 'int.fromEnvironment can only be used as a const constructor'); |
136 } | 138 } |
137 } | 139 } |
138 | 140 |
139 @patch | 141 @patch |
140 class double { | 142 class double { |
141 @patch | 143 @patch |
142 static double parse(String source, [double onError(String source)]) { | 144 static double parse(String source, [double onError(String source)]) { |
143 return Primitives.parseDouble(source, onError); | 145 return Primitives.parseDouble(source, onError); |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 return _stringFromIterable(charCodes, start, end); | 386 return _stringFromIterable(charCodes, start, end); |
385 } | 387 } |
386 | 388 |
387 @patch | 389 @patch |
388 factory String.fromCharCode(int charCode) { | 390 factory String.fromCharCode(int charCode) { |
389 return Primitives.stringFromCharCode(charCode); | 391 return Primitives.stringFromCharCode(charCode); |
390 } | 392 } |
391 | 393 |
392 @patch | 394 @patch |
393 factory String.fromEnvironment(String name, {String defaultValue}) { | 395 factory String.fromEnvironment(String name, {String defaultValue}) { |
| 396 // ignore: const_constructor_throws_exception |
394 throw new UnsupportedError( | 397 throw new UnsupportedError( |
395 'String.fromEnvironment can only be used as a const constructor'); | 398 'String.fromEnvironment can only be used as a const constructor'); |
396 } | 399 } |
397 | 400 |
398 static String _stringFromJSArray( | 401 static String _stringFromJSArray( |
399 /*=JSArray<int>*/ list, | 402 /*=JSArray<int>*/ list, |
400 int start, | 403 int start, |
401 int endOrNull) { | 404 int endOrNull) { |
402 int len = list.length; | 405 int len = list.length; |
403 int end = RangeError.checkValidRange(start, endOrNull, len); | 406 int end = RangeError.checkValidRange(start, endOrNull, len); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 } | 441 } |
439 } | 442 } |
440 return Primitives.stringFromCharCodes(list); | 443 return Primitives.stringFromCharCodes(list); |
441 } | 444 } |
442 } | 445 } |
443 | 446 |
444 @patch | 447 @patch |
445 class bool { | 448 class bool { |
446 @patch | 449 @patch |
447 factory bool.fromEnvironment(String name, {bool defaultValue: false}) { | 450 factory bool.fromEnvironment(String name, {bool defaultValue: false}) { |
| 451 // ignore: const_constructor_throws_exception |
448 throw new UnsupportedError( | 452 throw new UnsupportedError( |
449 'bool.fromEnvironment can only be used as a const constructor'); | 453 'bool.fromEnvironment can only be used as a const constructor'); |
450 } | 454 } |
451 | 455 |
452 @patch | 456 @patch |
453 int get hashCode => super.hashCode; | 457 int get hashCode => super.hashCode; |
454 } | 458 } |
455 | 459 |
456 @patch | 460 @patch |
457 class RegExp { | 461 class RegExp { |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 } | 649 } |
646 | 650 |
647 @patch | 651 @patch |
648 class StackTrace { | 652 class StackTrace { |
649 @patch | 653 @patch |
650 @NoInline() | 654 @NoInline() |
651 static StackTrace get current { | 655 static StackTrace get current { |
652 return getTraceFromException(JS('', 'new Error()')); | 656 return getTraceFromException(JS('', 'new Error()')); |
653 } | 657 } |
654 } | 658 } |
OLD | NEW |