Index: sdk/lib/_internal/js_runtime/lib/core_patch.dart |
diff --git a/sdk/lib/_internal/js_runtime/lib/core_patch.dart b/sdk/lib/_internal/js_runtime/lib/core_patch.dart |
index 45466e3055f79eed78d2b723c51b5bc045688002..b911d3b2868b04a0828f234e5f9e89ec8d828099 100644 |
--- a/sdk/lib/_internal/js_runtime/lib/core_patch.dart |
+++ b/sdk/lib/_internal/js_runtime/lib/core_patch.dart |
@@ -5,23 +5,25 @@ |
// Patch file for dart:core classes. |
import "dart:_internal" as _symbol_dev; |
import 'dart:_interceptors'; |
-import 'dart:_js_helper' show checkInt, |
- Closure, |
- ConstantMap, |
- getRuntimeType, |
- JsLinkedHashMap, |
- jsonEncodeNative, |
- JSSyntaxRegExp, |
- NoInline, |
- objectHashCode, |
- patch, |
- patch_full, |
- patch_lazy, |
- patch_startup, |
- Primitives, |
- stringJoinUnchecked, |
- getTraceFromException, |
- RuntimeError; |
+import 'dart:_js_helper' |
+ show |
+ checkInt, |
+ Closure, |
+ ConstantMap, |
+ getRuntimeType, |
+ JsLinkedHashMap, |
+ jsonEncodeNative, |
+ JSSyntaxRegExp, |
+ NoInline, |
+ objectHashCode, |
+ patch, |
+ patch_full, |
+ patch_lazy, |
+ patch_startup, |
+ Primitives, |
+ stringJoinUnchecked, |
+ getTraceFromException, |
+ RuntimeError; |
import 'dart:_foreign_helper' show JS; |
@@ -47,22 +49,18 @@ int identityHashCode(Object object) => objectHashCode(object); |
@patch |
class Object { |
@patch |
- bool operator==(other) => identical(this, other); |
+ bool operator ==(other) => identical(this, other); |
@patch |
int get hashCode => Primitives.objectHashCode(this); |
- |
@patch |
String toString() => Primitives.objectToHumanReadableString(this); |
@patch |
dynamic noSuchMethod(Invocation invocation) { |
- throw new NoSuchMethodError( |
- this, |
- invocation.memberName, |
- invocation.positionalArguments, |
- invocation.namedArguments); |
+ throw new NoSuchMethodError(this, invocation.memberName, |
+ invocation.positionalArguments, invocation.namedArguments); |
} |
@patch |
@@ -79,26 +77,22 @@ class Null { |
@patch |
class Function { |
@patch_full |
- static apply(Function function, |
- List positionalArguments, |
- [Map<Symbol, dynamic> namedArguments]) { |
- return Primitives.applyFunction( |
- function, positionalArguments, |
+ static apply(Function function, List positionalArguments, |
+ [Map<Symbol, dynamic> namedArguments]) { |
+ return Primitives.applyFunction(function, positionalArguments, |
namedArguments == null ? null : _toMangledNames(namedArguments)); |
} |
@patch_lazy |
- static apply(Function function, |
- List positionalArguments, |
- [Map<Symbol, dynamic> namedArguments]) { |
+ static apply(Function function, List positionalArguments, |
+ [Map<Symbol, dynamic> namedArguments]) { |
return Primitives.applyFunction2(function, positionalArguments, |
namedArguments == null ? null : _symbolMapToStringMap(namedArguments)); |
} |
@patch_startup |
- static apply(Function function, |
- List positionalArguments, |
- [Map<Symbol, dynamic> namedArguments]) { |
+ static apply(Function function, List positionalArguments, |
+ [Map<Symbol, dynamic> namedArguments]) { |
return Primitives.applyFunction2(function, positionalArguments, |
namedArguments == null ? null : _symbolMapToStringMap(namedArguments)); |
} |
@@ -132,16 +126,16 @@ class Expando<T> { |
: _createKey(); |
@patch |
- T operator[](Object object) { |
+ T operator [](Object object) { |
if (_jsWeakMapOrKey is! String) { |
- _checkType(object); // WeakMap doesn't check on reading, only writing. |
+ _checkType(object); // WeakMap doesn't check on reading, only writing. |
return JS('', '#.get(#)', _jsWeakMapOrKey, object); |
} |
return _getFromObject(_jsWeakMapOrKey, object); |
} |
@patch |
- void operator[]=(Object object, T value) { |
+ void operator []=(Object object, T value) { |
if (_jsWeakMapOrKey is! String) { |
JS('void', '#.set(#, #)', _jsWeakMapOrKey, object, value); |
} else { |
@@ -176,9 +170,7 @@ class Expando<T> { |
@patch |
class int { |
@patch |
- static int parse(String source, |
- { int radix, |
- int onError(String source) }) { |
+ static int parse(String source, {int radix, int onError(String source)}) { |
return Primitives.parseInt(source, radix, onError); |
} |
@@ -192,8 +184,7 @@ class int { |
@patch |
class double { |
@patch |
- static double parse(String source, |
- [double onError(String source)]) { |
+ static double parse(String source, [double onError(String source)]) { |
return Primitives.parseDouble(source, onError); |
} |
} |
@@ -233,34 +224,32 @@ class AbstractClassInstantiationError { |
class DateTime { |
@patch |
DateTime.fromMillisecondsSinceEpoch(int millisecondsSinceEpoch, |
- {bool isUtc: false}) |
+ {bool isUtc: false}) |
// `0 + millisecondsSinceEpoch` forces the inferred result to be non-null. |
: this._withValue(0 + millisecondsSinceEpoch, isUtc: isUtc); |
@patch |
DateTime.fromMicrosecondsSinceEpoch(int microsecondsSinceEpoch, |
- {bool isUtc: false}) |
+ {bool isUtc: false}) |
: this._withValue( |
- _microsecondInRoundedMilliseconds(microsecondsSinceEpoch), |
- isUtc: isUtc); |
- |
- @patch |
- DateTime._internal(int year, |
- int month, |
- int day, |
- int hour, |
- int minute, |
- int second, |
- int millisecond, |
- int microsecond, |
- bool isUtc) |
- // checkBool is manually inlined here because dart2js doesn't inline it |
- // and [isUtc] is usually a constant. |
+ _microsecondInRoundedMilliseconds(microsecondsSinceEpoch), |
+ isUtc: isUtc); |
+ |
+ @patch |
+ DateTime._internal(int year, int month, int day, int hour, int minute, |
+ int second, int millisecond, int microsecond, bool isUtc) |
+ // checkBool is manually inlined here because dart2js doesn't inline it |
+ // and [isUtc] is usually a constant. |
: this.isUtc = isUtc is bool |
? isUtc |
: throw new ArgumentError.value(isUtc, 'isUtc'), |
_value = checkInt(Primitives.valueFromDecomposedDate( |
- year, month, day, hour, minute, second, |
+ year, |
+ month, |
+ day, |
+ hour, |
+ minute, |
+ second, |
millisecond + _microsecondInRoundedMilliseconds(microsecond), |
isUtc)); |
@@ -277,11 +266,15 @@ class DateTime { |
} |
@patch |
- static int _brokenDownDateToValue( |
- int year, int month, int day, int hour, int minute, int second, |
- int millisecond, int microsecond, bool isUtc) { |
+ static int _brokenDownDateToValue(int year, int month, int day, int hour, |
+ int minute, int second, int millisecond, int microsecond, bool isUtc) { |
return Primitives.valueFromDecomposedDate( |
- year, month, day, hour, minute, second, |
+ year, |
+ month, |
+ day, |
+ hour, |
+ minute, |
+ second, |
millisecond + _microsecondInRoundedMilliseconds(microsecond), |
isUtc); |
} |
@@ -300,14 +293,14 @@ class DateTime { |
@patch |
DateTime add(Duration duration) { |
- return new DateTime._withValue( |
- _value + duration.inMilliseconds, isUtc: isUtc); |
+ return new DateTime._withValue(_value + duration.inMilliseconds, |
+ isUtc: isUtc); |
} |
@patch |
DateTime subtract(Duration duration) { |
- return new DateTime._withValue( |
- _value - duration.inMilliseconds, isUtc: isUtc); |
+ return new DateTime._withValue(_value - duration.inMilliseconds, |
+ isUtc: isUtc); |
} |
@patch |
@@ -349,7 +342,6 @@ class DateTime { |
int get weekday => Primitives.getWeekday(this); |
} |
- |
// Patch for Stopwatch implementation. |
@patch |
class Stopwatch { |
@@ -371,8 +363,9 @@ class List<E> { |
@patch |
factory List.filled(int length, E fill, {bool growable: false}) { |
- List result = growable ? new JSArray<E>.growable(length) |
- : new JSArray<E>.fixed(length); |
+ List result = growable |
+ ? new JSArray<E>.growable(length) |
+ : new JSArray<E>.fixed(length); |
if (length != 0 && fill != null) { |
for (int i = 0; i < result.length; i++) { |
result[i] = fill; |
@@ -382,7 +375,7 @@ class List<E> { |
} |
@patch |
- factory List.from(Iterable elements, { bool growable: true }) { |
+ factory List.from(Iterable elements, {bool growable: true}) { |
List<E> list = new List<E>(); |
for (E e in elements) { |
list.add(e); |
@@ -411,8 +404,7 @@ class Map<K, V> { |
class String { |
@patch |
factory String.fromCharCodes(Iterable<int> charCodes, |
- [int start = 0, int end]) { |
- |
+ [int start = 0, int end]) { |
if (charCodes is JSArray) { |
return _stringFromJSArray(charCodes, start, end); |
} |
@@ -449,8 +441,8 @@ class String { |
return Primitives.stringFromNativeUint8List(charCodes, start, end); |
} |
- static String _stringFromIterable(Iterable<int> charCodes, |
- int start, int end) { |
+ static String _stringFromIterable( |
+ Iterable<int> charCodes, int start, int end) { |
if (start < 0) throw new RangeError.range(start, 0, charCodes.length); |
if (end != null && end < start) { |
throw new RangeError.range(end, start, charCodes.length); |
@@ -493,11 +485,9 @@ class RegExp { |
@NoInline() |
@patch |
factory RegExp(String source, |
- {bool multiLine: false, |
- bool caseSensitive: true}) |
- => new JSSyntaxRegExp(source, |
- multiLine: multiLine, |
- caseSensitive: caseSensitive); |
+ {bool multiLine: false, bool caseSensitive: true}) => |
+ new JSSyntaxRegExp(source, |
+ multiLine: multiLine, caseSensitive: caseSensitive); |
} |
// Patch for 'identical' function. |
@@ -574,11 +564,9 @@ class StringBuffer { |
@patch |
class NoSuchMethodError { |
@patch |
- NoSuchMethodError(Object receiver, |
- Symbol memberName, |
- List positionalArguments, |
- Map<Symbol, dynamic> namedArguments, |
- [List existingArgumentNames = null]) |
+ NoSuchMethodError(Object receiver, Symbol memberName, |
+ List positionalArguments, Map<Symbol, dynamic> namedArguments, |
+ [List existingArgumentNames = null]) |
: _receiver = receiver, |
_memberName = memberName, |
_arguments = positionalArguments, |
@@ -649,10 +637,8 @@ class _Uri { |
* that appear in [canonicalTable], and returns the escaped string. |
*/ |
@patch |
- static String _uriEncode(List<int> canonicalTable, |
- String text, |
- Encoding encoding, |
- bool spaceToPlus) { |
+ static String _uriEncode(List<int> canonicalTable, String text, |
+ Encoding encoding, bool spaceToPlus) { |
if (identical(encoding, UTF8) && _needsNoEncoding.hasMatch(text)) { |
return text; |
} |
@@ -715,10 +701,7 @@ _malformedTypeError(message) => new RuntimeError(message); |
_genericNoSuchMethod(receiver, memberName, positionalArguments, namedArguments, |
existingArguments) { |
return new NoSuchMethodError( |
- receiver, |
- memberName, |
- positionalArguments, |
- namedArguments); |
+ receiver, memberName, positionalArguments, namedArguments); |
} |
// Called from kernel generated code. |
@@ -729,10 +712,7 @@ _unresolvedConstructorError(receiver, memberName, positionalArguments, |
// No constructor '$memberName' declared in class '$receiver'. |
return new NoSuchMethodError( |
- receiver, |
- memberName, |
- positionalArguments, |
- namedArguments); |
+ receiver, memberName, positionalArguments, namedArguments); |
} |
// Called from kernel generated code. |
@@ -740,10 +720,7 @@ _unresolvedStaticGetterError(receiver, memberName, positionalArguments, |
namedArguments, existingArguments) { |
// TODO(sra): Generate customized message. |
return new NoSuchMethodError( |
- receiver, |
- memberName, |
- positionalArguments, |
- namedArguments); |
+ receiver, memberName, positionalArguments, namedArguments); |
} |
// Called from kernel generated code. |
@@ -751,10 +728,7 @@ _unresolvedStaticSetterError(receiver, memberName, positionalArguments, |
namedArguments, existingArguments) { |
// TODO(sra): Generate customized message. |
return new NoSuchMethodError( |
- receiver, |
- memberName, |
- positionalArguments, |
- namedArguments); |
+ receiver, memberName, positionalArguments, namedArguments); |
} |
// Called from kernel generated code. |
@@ -762,10 +736,7 @@ _unresolvedStaticMethodError(receiver, memberName, positionalArguments, |
namedArguments, existingArguments) { |
// TODO(sra): Generate customized message. |
return new NoSuchMethodError( |
- receiver, |
- memberName, |
- positionalArguments, |
- namedArguments); |
+ receiver, memberName, positionalArguments, namedArguments); |
} |
// Called from kernel generated code. |
@@ -773,10 +744,7 @@ _unresolvedTopLevelGetterError(receiver, memberName, positionalArguments, |
namedArguments, existingArguments) { |
// TODO(sra): Generate customized message. |
return new NoSuchMethodError( |
- receiver, |
- memberName, |
- positionalArguments, |
- namedArguments); |
+ receiver, memberName, positionalArguments, namedArguments); |
} |
// Called from kernel generated code. |
@@ -784,10 +752,7 @@ _unresolvedTopLevelSetterError(receiver, memberName, positionalArguments, |
namedArguments, existingArguments) { |
// TODO(sra): Generate customized message. |
return new NoSuchMethodError( |
- receiver, |
- memberName, |
- positionalArguments, |
- namedArguments); |
+ receiver, memberName, positionalArguments, namedArguments); |
} |
// Called from kernel generated code. |
@@ -795,8 +760,5 @@ _unresolvedTopLevelMethodError(receiver, memberName, positionalArguments, |
namedArguments, existingArguments) { |
// TODO(sra): Generate customized message. |
return new NoSuchMethodError( |
- receiver, |
- memberName, |
- positionalArguments, |
- namedArguments); |
+ receiver, memberName, positionalArguments, namedArguments); |
} |