mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 16:55:08 +00:00
[js_runtime] dart format --fix
Update js_runtime formatting. Almost entirely dropping unnecessary `new`. Change-Id: I8016c77f405972abd17d2242497a400994e15be5 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/348860 Commit-Queue: Stephen Adams <sra@google.com> Reviewed-by: Mayank Patke <fishythefish@google.com>
This commit is contained in:
parent
f0e2f96a5c
commit
0a0e9fb713
|
@ -96,7 +96,7 @@ class Timer {
|
|||
static Timer _createTimer(Duration duration, void callback()) {
|
||||
int milliseconds = duration.inMilliseconds;
|
||||
if (milliseconds < 0) milliseconds = 0;
|
||||
return new _TimerImpl(milliseconds, callback);
|
||||
return _TimerImpl(milliseconds, callback);
|
||||
}
|
||||
|
||||
@patch
|
||||
|
@ -104,7 +104,7 @@ class Timer {
|
|||
Duration duration, void callback(Timer timer)) {
|
||||
int milliseconds = duration.inMilliseconds;
|
||||
if (milliseconds < 0) milliseconds = 0;
|
||||
return new _TimerImpl.periodic(milliseconds, callback);
|
||||
return _TimerImpl.periodic(milliseconds, callback);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,7 @@ class _TimerImpl implements Timer {
|
|||
_handle = JS('int', 'self.setTimeout(#, #)',
|
||||
convertDartClosureToJS(internalCallback, 0), milliseconds);
|
||||
} else {
|
||||
throw new UnsupportedError('`setTimeout()` not found.');
|
||||
throw UnsupportedError('`setTimeout()` not found.');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ class _TimerImpl implements Timer {
|
|||
}, 0),
|
||||
milliseconds);
|
||||
} else {
|
||||
throw new UnsupportedError('Periodic timer.');
|
||||
throw UnsupportedError('Periodic timer.');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -170,7 +170,7 @@ class _TimerImpl implements Timer {
|
|||
}
|
||||
_handle = null;
|
||||
} else {
|
||||
throw new UnsupportedError('Canceling a timer.');
|
||||
throw UnsupportedError('Canceling a timer.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -181,7 +181,7 @@ bool _hasTimer() {
|
|||
}
|
||||
|
||||
class _AsyncAwaitCompleter<T> implements Completer<T> {
|
||||
final _future = new _Future<T>();
|
||||
final _future = _Future<T>();
|
||||
bool isSync;
|
||||
|
||||
_AsyncAwaitCompleter() : isSync = false;
|
||||
|
@ -217,7 +217,7 @@ class _AsyncAwaitCompleter<T> implements Completer<T> {
|
|||
/// Used as part of the runtime support for the async/await transformation.
|
||||
@pragma('dart2js:assumeDynamic') // Global type inference can't see call site.
|
||||
Completer<T> _makeAsyncAwaitCompleter<T>() {
|
||||
return new _AsyncAwaitCompleter<T>();
|
||||
return _AsyncAwaitCompleter<T>();
|
||||
}
|
||||
|
||||
/// Initiates the computation of an `async` function and starts the body
|
||||
|
@ -280,7 +280,7 @@ void _awaitOnObject(object, _WrappedAsyncBody bodyFunction) {
|
|||
|
||||
Function errorCallback = (dynamic error, StackTrace stackTrace) {
|
||||
ExceptionAndStackTrace wrappedException =
|
||||
new ExceptionAndStackTrace(error, stackTrace);
|
||||
ExceptionAndStackTrace(error, stackTrace);
|
||||
bodyFunction(async_status_codes.ERROR, wrappedException);
|
||||
};
|
||||
|
||||
|
@ -291,14 +291,14 @@ void _awaitOnObject(object, _WrappedAsyncBody bodyFunction) {
|
|||
} else if (object is Future) {
|
||||
object.then(thenCallback, onError: errorCallback);
|
||||
} else {
|
||||
_Future future = new _Future().._setValue(object);
|
||||
_Future future = _Future().._setValue(object);
|
||||
// We can skip the zone registration, since the bodyFunction is already
|
||||
// registered (see [_wrapJsFunctionForAsync]).
|
||||
future._thenAwait(thenCallback, errorCallback);
|
||||
}
|
||||
}
|
||||
|
||||
typedef void _WrappedAsyncBody(int errorCode, dynamic result);
|
||||
typedef _WrappedAsyncBody = void Function(int errorCode, dynamic result);
|
||||
|
||||
_WrappedAsyncBody _wrapJsFunctionForAsync(dynamic /* js function */ function) {
|
||||
var protected = JS(
|
||||
|
@ -482,7 +482,7 @@ class _AsyncStarStreamController<T> {
|
|||
});
|
||||
}
|
||||
|
||||
controller = new StreamController<T>(onListen: () {
|
||||
controller = StreamController<T>(onListen: () {
|
||||
_resumeBody();
|
||||
}, onResume: () {
|
||||
// Only schedule again if the async* function actually is suspended.
|
||||
|
@ -495,7 +495,7 @@ class _AsyncStarStreamController<T> {
|
|||
}, onCancel: () {
|
||||
// If the async* is finished we ignore cancel events.
|
||||
if (!controller.isClosed) {
|
||||
cancelationFuture = new _Future();
|
||||
cancelationFuture = _Future();
|
||||
if (isSuspended) {
|
||||
// Resume the suspended async* function to run finalizers.
|
||||
isSuspended = false;
|
||||
|
@ -514,7 +514,7 @@ class _AsyncStarStreamController<T> {
|
|||
/// Used as part of the runtime support for the async/await transformation.
|
||||
@pragma('dart2js:assumeDynamic') // Global type inference can't see call site.
|
||||
_makeAsyncStarStreamController<T>(_WrappedAsyncBody body) {
|
||||
return new _AsyncStarStreamController<T>(body);
|
||||
return _AsyncStarStreamController<T>(body);
|
||||
}
|
||||
|
||||
class _IterationMarker {
|
||||
|
@ -529,7 +529,7 @@ class _IterationMarker {
|
|||
const _IterationMarker._(this.state, this.value);
|
||||
|
||||
static yieldStar(dynamic /* Iterable or Stream */ values) {
|
||||
return new _IterationMarker._(YIELD_STAR, values);
|
||||
return _IterationMarker._(YIELD_STAR, values);
|
||||
}
|
||||
|
||||
static endOfIteration() {
|
||||
|
@ -537,11 +537,11 @@ class _IterationMarker {
|
|||
}
|
||||
|
||||
static yieldSingle(dynamic value) {
|
||||
return new _IterationMarker._(YIELD_SINGLE, value);
|
||||
return _IterationMarker._(YIELD_SINGLE, value);
|
||||
}
|
||||
|
||||
static uncaughtError(dynamic error) {
|
||||
return new _IterationMarker._(UNCAUGHT_ERROR, error);
|
||||
return _IterationMarker._(UNCAUGHT_ERROR, error);
|
||||
}
|
||||
|
||||
toString() => "IterationMarker($state, $value)";
|
||||
|
@ -711,7 +711,7 @@ class _SyncStarIterator<T> implements Iterator<T> {
|
|||
/// Used as part of the runtime support for the async/await transformation.
|
||||
@pragma('dart2js:assumeDynamic') // Global type inference can't see call site.
|
||||
_SyncStarIterable<T> _makeSyncStarIterable<T>(body) {
|
||||
return new _SyncStarIterable<T>(body);
|
||||
return _SyncStarIterable<T>(body);
|
||||
}
|
||||
|
||||
/// An Iterable corresponding to a sync* method.
|
||||
|
@ -728,7 +728,7 @@ class _SyncStarIterable<T> extends Iterable<T> {
|
|||
|
||||
@pragma('dart2js:prefer-inline')
|
||||
_SyncStarIterator<T> get iterator =>
|
||||
new _SyncStarIterator<T>(JS('', '#()', _outerHelper));
|
||||
_SyncStarIterator<T>(JS('', '#()', _outerHelper));
|
||||
}
|
||||
|
||||
/// Wraps an `await`ed expression in [Future.value] if needed.
|
||||
|
|
|
@ -29,7 +29,7 @@ int _max(int a, int b) => a > b ? a : b;
|
|||
int _min(int a, int b) => a < b ? a : b;
|
||||
|
||||
/// Empty list used as an initializer for local variables in the `_BigIntImpl`.
|
||||
final _dummyList = new Uint16List(0);
|
||||
final _dummyList = Uint16List(0);
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003-2005 Tom Wu
|
||||
|
@ -73,12 +73,12 @@ class _BigIntImpl implements BigInt {
|
|||
static const int _digitBase = 1 << _digitBits;
|
||||
static const int _digitMask = (1 << _digitBits) - 1;
|
||||
|
||||
static final _BigIntImpl zero = new _BigIntImpl._fromInt(0);
|
||||
static final _BigIntImpl one = new _BigIntImpl._fromInt(1);
|
||||
static final _BigIntImpl two = new _BigIntImpl._fromInt(2);
|
||||
static final _BigIntImpl zero = _BigIntImpl._fromInt(0);
|
||||
static final _BigIntImpl one = _BigIntImpl._fromInt(1);
|
||||
static final _BigIntImpl two = _BigIntImpl._fromInt(2);
|
||||
|
||||
static final _BigIntImpl _minusOne = -one;
|
||||
static final _BigIntImpl _bigInt10000 = new _BigIntImpl._fromInt(10000);
|
||||
static final _BigIntImpl _bigInt10000 = _BigIntImpl._fromInt(10000);
|
||||
|
||||
// Result cache for last _divRem call.
|
||||
// Result cache for last _divRem call.
|
||||
|
@ -131,7 +131,7 @@ class _BigIntImpl implements BigInt {
|
|||
static _BigIntImpl parse(String source, {int? radix}) {
|
||||
var result = _tryParse(source, radix: radix);
|
||||
if (result == null) {
|
||||
throw new FormatException("Could not parse BigInt", source);
|
||||
throw FormatException("Could not parse BigInt", source);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ class _BigIntImpl implements BigInt {
|
|||
for (int i = 0; i < source.length; i++) {
|
||||
part = part * 10 + source.codeUnitAt(i) - _0;
|
||||
if (++digitInPartCount == 4) {
|
||||
result = result * _bigInt10000 + new _BigIntImpl._fromInt(part);
|
||||
result = result * _bigInt10000 + _BigIntImpl._fromInt(part);
|
||||
part = 0;
|
||||
digitInPartCount = 0;
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ class _BigIntImpl implements BigInt {
|
|||
int hexDigitsPerChunk = _digitBits ~/ 4;
|
||||
int sourceLength = source.length - startPos;
|
||||
int chunkCount = (sourceLength / hexDigitsPerChunk).ceil();
|
||||
var digits = new Uint16List(chunkCount);
|
||||
var digits = Uint16List(chunkCount);
|
||||
|
||||
int lastDigitLength = sourceLength - (chunkCount - 1) * hexDigitsPerChunk;
|
||||
int digitIndex = digits.length - 1;
|
||||
|
@ -216,7 +216,7 @@ class _BigIntImpl implements BigInt {
|
|||
digits[digitIndex--] = chunk;
|
||||
}
|
||||
if (digits.length == 1 && digits[0] == 0) return zero;
|
||||
return new _BigIntImpl._(isNegative, digits.length, digits);
|
||||
return _BigIntImpl._(isNegative, digits.length, digits);
|
||||
}
|
||||
|
||||
/// Parses the given [source] as a [radix] literal.
|
||||
|
@ -225,11 +225,11 @@ class _BigIntImpl implements BigInt {
|
|||
/// this function returns `null`.
|
||||
static _BigIntImpl? _parseRadix(String source, int radix, bool isNegative) {
|
||||
var result = zero;
|
||||
var base = new _BigIntImpl._fromInt(radix);
|
||||
var base = _BigIntImpl._fromInt(radix);
|
||||
for (int i = 0; i < source.length; i++) {
|
||||
var digitValue = _codeUnitToRadixValue(source.codeUnitAt(i));
|
||||
if (digitValue >= radix) return null;
|
||||
result = result * base + new _BigIntImpl._fromInt(digitValue);
|
||||
result = result * base + _BigIntImpl._fromInt(digitValue);
|
||||
}
|
||||
if (isNegative) return -result;
|
||||
return result;
|
||||
|
@ -269,10 +269,10 @@ class _BigIntImpl implements BigInt {
|
|||
}
|
||||
|
||||
if (radix is! int) {
|
||||
throw new ArgumentError.value(radix, 'radix', 'is not an integer');
|
||||
throw ArgumentError.value(radix, 'radix', 'is not an integer');
|
||||
}
|
||||
if (radix < 2 || radix > 36) {
|
||||
throw new RangeError.range(radix, 2, 36, 'radix');
|
||||
throw RangeError.range(radix, 2, 36, 'radix');
|
||||
}
|
||||
if (radix == 10 && decimalMatch != null) {
|
||||
return _parseDecimal(decimalMatch, isNegative);
|
||||
|
@ -312,7 +312,7 @@ class _BigIntImpl implements BigInt {
|
|||
/// digits.
|
||||
static Uint16List _cloneDigits(
|
||||
Uint16List digits, int from, int to, int length) {
|
||||
var resultDigits = new Uint16List(length);
|
||||
var resultDigits = Uint16List(length);
|
||||
var n = to - from;
|
||||
for (var i = 0; i < n; i++) {
|
||||
resultDigits[i] = digits[from + i];
|
||||
|
@ -328,10 +328,9 @@ class _BigIntImpl implements BigInt {
|
|||
|
||||
// Given this order dart2js will use the `_fromInt` for smaller value and
|
||||
// then use the bit-manipulating `_fromDouble` for all other values.
|
||||
if (value.abs() < 0x100000000)
|
||||
return new _BigIntImpl._fromInt(value.toInt());
|
||||
if (value is double) return new _BigIntImpl._fromDouble(value);
|
||||
return new _BigIntImpl._fromInt(value as int);
|
||||
if (value.abs() < 0x100000000) return _BigIntImpl._fromInt(value.toInt());
|
||||
if (value is double) return _BigIntImpl._fromDouble(value);
|
||||
return _BigIntImpl._fromInt(value as int);
|
||||
}
|
||||
|
||||
factory _BigIntImpl._fromInt(int value) {
|
||||
|
@ -342,43 +341,43 @@ class _BigIntImpl implements BigInt {
|
|||
// positive.
|
||||
const int minInt64 = -0x80000000 * 0x100000000;
|
||||
if (value == minInt64) {
|
||||
var digits = new Uint16List(4);
|
||||
var digits = Uint16List(4);
|
||||
digits[3] = 0x8000;
|
||||
return new _BigIntImpl._(true, 4, digits);
|
||||
return _BigIntImpl._(true, 4, digits);
|
||||
}
|
||||
value = -value;
|
||||
}
|
||||
if (value < _digitBase) {
|
||||
var digits = new Uint16List(1);
|
||||
var digits = Uint16List(1);
|
||||
digits[0] = value;
|
||||
return new _BigIntImpl._(isNegative, 1, digits);
|
||||
return _BigIntImpl._(isNegative, 1, digits);
|
||||
}
|
||||
if (value <= 0xFFFFFFFF) {
|
||||
var digits = new Uint16List(2);
|
||||
var digits = Uint16List(2);
|
||||
digits[0] = value & _digitMask;
|
||||
digits[1] = value >> _digitBits;
|
||||
return new _BigIntImpl._(isNegative, 2, digits);
|
||||
return _BigIntImpl._(isNegative, 2, digits);
|
||||
}
|
||||
|
||||
var bits = value.bitLength;
|
||||
var digits = new Uint16List((bits - 1) ~/ _digitBits + 1);
|
||||
var digits = Uint16List((bits - 1) ~/ _digitBits + 1);
|
||||
var i = 0;
|
||||
while (value != 0) {
|
||||
digits[i++] = value & _digitMask;
|
||||
value = value ~/ _digitBase;
|
||||
}
|
||||
return new _BigIntImpl._(isNegative, digits.length, digits);
|
||||
return _BigIntImpl._(isNegative, digits.length, digits);
|
||||
}
|
||||
|
||||
/// An 8-byte Uint8List we can reuse for [_fromDouble] to avoid generating
|
||||
/// garbage.
|
||||
static final Uint8List _bitsForFromDouble = new Uint8List(8);
|
||||
static final Uint8List _bitsForFromDouble = Uint8List(8);
|
||||
|
||||
factory _BigIntImpl._fromDouble(double value) {
|
||||
const int exponentBias = 1075;
|
||||
|
||||
if (value.isNaN || value.isInfinite) {
|
||||
throw new ArgumentError("Value must be finite: $value");
|
||||
throw ArgumentError("Value must be finite: $value");
|
||||
}
|
||||
bool isNegative = value < 0;
|
||||
if (isNegative) value = -value;
|
||||
|
@ -397,14 +396,14 @@ class _BigIntImpl implements BigInt {
|
|||
|
||||
assert(_digitBits == 16);
|
||||
// The significant bits are in 0 .. 52.
|
||||
var unshiftedDigits = new Uint16List(4);
|
||||
var unshiftedDigits = Uint16List(4);
|
||||
unshiftedDigits[0] = (bits[1] << 8) + bits[0];
|
||||
unshiftedDigits[1] = (bits[3] << 8) + bits[2];
|
||||
unshiftedDigits[2] = (bits[5] << 8) + bits[4];
|
||||
// Don't forget to add the hidden bit.
|
||||
unshiftedDigits[3] = 0x10 | (bits[6] & 0xF);
|
||||
|
||||
var unshiftedBig = new _BigIntImpl._normalized(false, 4, unshiftedDigits);
|
||||
var unshiftedBig = _BigIntImpl._normalized(false, 4, unshiftedDigits);
|
||||
_BigIntImpl absResult = unshiftedBig;
|
||||
if (exponent < 0) {
|
||||
absResult = unshiftedBig >> -exponent;
|
||||
|
@ -421,7 +420,7 @@ class _BigIntImpl implements BigInt {
|
|||
/// for zero, which is its own negation.
|
||||
_BigIntImpl operator -() {
|
||||
if (_used == 0) return this;
|
||||
return new _BigIntImpl._(!_isNegative, _used, _digits);
|
||||
return _BigIntImpl._(!_isNegative, _used, _digits);
|
||||
}
|
||||
|
||||
/// Returns the absolute value of this integer.
|
||||
|
@ -437,11 +436,11 @@ class _BigIntImpl implements BigInt {
|
|||
}
|
||||
final resultUsed = used + n;
|
||||
final digits = _digits;
|
||||
final resultDigits = new Uint16List(resultUsed);
|
||||
final resultDigits = Uint16List(resultUsed);
|
||||
for (int i = used - 1; i >= 0; i--) {
|
||||
resultDigits[i + n] = digits[i];
|
||||
}
|
||||
return new _BigIntImpl._(_isNegative, resultUsed, resultDigits);
|
||||
return _BigIntImpl._(_isNegative, resultUsed, resultDigits);
|
||||
}
|
||||
|
||||
/// Same as [_dlShift] but works on the decomposed big integers.
|
||||
|
@ -478,11 +477,11 @@ class _BigIntImpl implements BigInt {
|
|||
return _isNegative ? _minusOne : zero;
|
||||
}
|
||||
final digits = _digits;
|
||||
final resultDigits = new Uint16List(resultUsed);
|
||||
final resultDigits = Uint16List(resultUsed);
|
||||
for (var i = n; i < used; i++) {
|
||||
resultDigits[i - n] = digits[i];
|
||||
}
|
||||
final result = new _BigIntImpl._(_isNegative, resultUsed, resultDigits);
|
||||
final result = _BigIntImpl._(_isNegative, resultUsed, resultDigits);
|
||||
if (_isNegative) {
|
||||
// Round down if any bit was shifted out.
|
||||
for (var i = 0; i < n; i++) {
|
||||
|
@ -528,7 +527,7 @@ class _BigIntImpl implements BigInt {
|
|||
/// It is an error if [shiftAmount] is negative.
|
||||
_BigIntImpl operator <<(int shiftAmount) {
|
||||
if (shiftAmount < 0) {
|
||||
throw new ArgumentError("shift-amount must be posititve $shiftAmount");
|
||||
throw ArgumentError("shift-amount must be posititve $shiftAmount");
|
||||
}
|
||||
if (_isZero) return this;
|
||||
final digitShift = shiftAmount ~/ _digitBits;
|
||||
|
@ -537,9 +536,9 @@ class _BigIntImpl implements BigInt {
|
|||
return _dlShift(digitShift);
|
||||
}
|
||||
var resultUsed = _used + digitShift + 1;
|
||||
var resultDigits = new Uint16List(resultUsed);
|
||||
var resultDigits = Uint16List(resultUsed);
|
||||
_lsh(_digits, _used, shiftAmount, resultDigits);
|
||||
return new _BigIntImpl._(_isNegative, resultUsed, resultDigits);
|
||||
return _BigIntImpl._(_isNegative, resultUsed, resultDigits);
|
||||
}
|
||||
|
||||
// resultDigits[0..resultUsed-1] = xDigits[0..xUsed-1] << n.
|
||||
|
@ -590,7 +589,7 @@ class _BigIntImpl implements BigInt {
|
|||
/// It is an error if [shiftAmount] is negative.
|
||||
_BigIntImpl operator >>(int shiftAmount) {
|
||||
if (shiftAmount < 0) {
|
||||
throw new ArgumentError("shift-amount must be posititve $shiftAmount");
|
||||
throw ArgumentError("shift-amount must be posititve $shiftAmount");
|
||||
}
|
||||
if (_isZero) return this;
|
||||
final digitShift = shiftAmount ~/ _digitBits;
|
||||
|
@ -604,9 +603,9 @@ class _BigIntImpl implements BigInt {
|
|||
return _isNegative ? _minusOne : zero;
|
||||
}
|
||||
final digits = _digits;
|
||||
final resultDigits = new Uint16List(resultUsed);
|
||||
final resultDigits = Uint16List(resultUsed);
|
||||
_rsh(digits, used, shiftAmount, resultDigits);
|
||||
final result = new _BigIntImpl._(_isNegative, resultUsed, resultDigits);
|
||||
final result = _BigIntImpl._(_isNegative, resultUsed, resultDigits);
|
||||
if (_isNegative) {
|
||||
// Round down if any bit was shifted out.
|
||||
if ((digits[digitShift] & ((1 << bitShift) - 1)) != 0) {
|
||||
|
@ -715,9 +714,9 @@ class _BigIntImpl implements BigInt {
|
|||
return _isNegative == isNegative ? this : -this;
|
||||
}
|
||||
var resultUsed = used + 1;
|
||||
var resultDigits = new Uint16List(resultUsed);
|
||||
var resultDigits = Uint16List(resultUsed);
|
||||
_absAdd(_digits, used, other._digits, otherUsed, resultDigits);
|
||||
return new _BigIntImpl._(isNegative, resultUsed, resultDigits);
|
||||
return _BigIntImpl._(isNegative, resultUsed, resultDigits);
|
||||
}
|
||||
|
||||
/// Returns `abs(this) - abs(other)` with sign set according to [isNegative].
|
||||
|
@ -734,9 +733,9 @@ class _BigIntImpl implements BigInt {
|
|||
if (otherUsed == 0) {
|
||||
return _isNegative == isNegative ? this : -this;
|
||||
}
|
||||
var resultDigits = new Uint16List(used);
|
||||
var resultDigits = Uint16List(used);
|
||||
_absSub(_digits, used, other._digits, otherUsed, resultDigits);
|
||||
return new _BigIntImpl._(isNegative, used, resultDigits);
|
||||
return _BigIntImpl._(isNegative, used, resultDigits);
|
||||
}
|
||||
|
||||
/// Returns `abs(this) & abs(other)` with sign set according to [isNegative].
|
||||
|
@ -744,11 +743,11 @@ class _BigIntImpl implements BigInt {
|
|||
var resultUsed = _min(_used, other._used);
|
||||
var digits = _digits;
|
||||
var otherDigits = other._digits;
|
||||
var resultDigits = new Uint16List(resultUsed);
|
||||
var resultDigits = Uint16List(resultUsed);
|
||||
for (var i = 0; i < resultUsed; i++) {
|
||||
resultDigits[i] = digits[i] & otherDigits[i];
|
||||
}
|
||||
return new _BigIntImpl._(isNegative, resultUsed, resultDigits);
|
||||
return _BigIntImpl._(isNegative, resultUsed, resultDigits);
|
||||
}
|
||||
|
||||
/// Returns `abs(this) &~ abs(other)` with sign set according to [isNegative].
|
||||
|
@ -756,7 +755,7 @@ class _BigIntImpl implements BigInt {
|
|||
var resultUsed = _used;
|
||||
var digits = _digits;
|
||||
var otherDigits = other._digits;
|
||||
var resultDigits = new Uint16List(resultUsed);
|
||||
var resultDigits = Uint16List(resultUsed);
|
||||
var m = _min(resultUsed, other._used);
|
||||
for (var i = 0; i < m; i++) {
|
||||
resultDigits[i] = digits[i] & ~otherDigits[i];
|
||||
|
@ -764,7 +763,7 @@ class _BigIntImpl implements BigInt {
|
|||
for (var i = m; i < resultUsed; i++) {
|
||||
resultDigits[i] = digits[i];
|
||||
}
|
||||
return new _BigIntImpl._(isNegative, resultUsed, resultDigits);
|
||||
return _BigIntImpl._(isNegative, resultUsed, resultDigits);
|
||||
}
|
||||
|
||||
/// Returns `abs(this) | abs(other)` with sign set according to [isNegative].
|
||||
|
@ -774,7 +773,7 @@ class _BigIntImpl implements BigInt {
|
|||
var resultUsed = _max(used, otherUsed);
|
||||
var digits = _digits;
|
||||
var otherDigits = other._digits;
|
||||
var resultDigits = new Uint16List(resultUsed);
|
||||
var resultDigits = Uint16List(resultUsed);
|
||||
_BigIntImpl l;
|
||||
int m;
|
||||
if (used < otherUsed) {
|
||||
|
@ -791,7 +790,7 @@ class _BigIntImpl implements BigInt {
|
|||
for (var i = m; i < resultUsed; i++) {
|
||||
resultDigits[i] = lDigits[i];
|
||||
}
|
||||
return new _BigIntImpl._(isNegative, resultUsed, resultDigits);
|
||||
return _BigIntImpl._(isNegative, resultUsed, resultDigits);
|
||||
}
|
||||
|
||||
/// Returns `abs(this) ^ abs(other)` with sign set according to [isNegative].
|
||||
|
@ -801,7 +800,7 @@ class _BigIntImpl implements BigInt {
|
|||
var resultUsed = _max(used, otherUsed);
|
||||
var digits = _digits;
|
||||
var otherDigits = other._digits;
|
||||
var resultDigits = new Uint16List(resultUsed);
|
||||
var resultDigits = Uint16List(resultUsed);
|
||||
_BigIntImpl l;
|
||||
int m;
|
||||
if (used < otherUsed) {
|
||||
|
@ -818,7 +817,7 @@ class _BigIntImpl implements BigInt {
|
|||
for (var i = m; i < resultUsed; i++) {
|
||||
resultDigits[i] = lDigits[i];
|
||||
}
|
||||
return new _BigIntImpl._(isNegative, resultUsed, resultDigits);
|
||||
return _BigIntImpl._(isNegative, resultUsed, resultDigits);
|
||||
}
|
||||
|
||||
/// Bit-wise and operator.
|
||||
|
@ -1030,13 +1029,13 @@ class _BigIntImpl implements BigInt {
|
|||
var resultUsed = used + otherUsed;
|
||||
var digits = _digits;
|
||||
var otherDigits = other._digits;
|
||||
var resultDigits = new Uint16List(resultUsed);
|
||||
var resultDigits = Uint16List(resultUsed);
|
||||
var i = 0;
|
||||
while (i < otherUsed) {
|
||||
_mulAdd(otherDigits[i], digits, 0, resultDigits, i, used);
|
||||
i++;
|
||||
}
|
||||
return new _BigIntImpl._(
|
||||
return _BigIntImpl._(
|
||||
_isNegative != other._isNegative, resultUsed, resultDigits);
|
||||
}
|
||||
|
||||
|
@ -1080,7 +1079,7 @@ class _BigIntImpl implements BigInt {
|
|||
var lastQuo_used = _lastQuoRemUsed - _lastRemUsed;
|
||||
var quo_digits = _cloneDigits(
|
||||
_lastQuoRemDigits, _lastRemUsed, _lastQuoRemUsed, lastQuo_used);
|
||||
var quo = new _BigIntImpl._(false, lastQuo_used, quo_digits);
|
||||
var quo = _BigIntImpl._(false, lastQuo_used, quo_digits);
|
||||
if ((_isNegative != other._isNegative) && (quo._used > 0)) {
|
||||
quo = -quo;
|
||||
}
|
||||
|
@ -1098,7 +1097,7 @@ class _BigIntImpl implements BigInt {
|
|||
// denormalized _lastQuoRem_digits[0.._lastRem_used-1] with proper sign.
|
||||
var remDigits =
|
||||
_cloneDigits(_lastQuoRemDigits, 0, _lastRemUsed, _lastRemUsed);
|
||||
var rem = new _BigIntImpl._(false, _lastRemUsed, remDigits);
|
||||
var rem = _BigIntImpl._(false, _lastRemUsed, remDigits);
|
||||
if (_lastRem_nsh > 0) {
|
||||
rem = rem >> _lastRem_nsh; // Denormalize remainder.
|
||||
}
|
||||
|
@ -1138,9 +1137,9 @@ class _BigIntImpl implements BigInt {
|
|||
Uint16List yDigits;
|
||||
int yUsed;
|
||||
if (nsh > 0) {
|
||||
yDigits = new Uint16List(other._used + 5);
|
||||
yDigits = Uint16List(other._used + 5);
|
||||
yUsed = _lShiftDigits(other._digits, other._used, nsh, yDigits);
|
||||
resultDigits = new Uint16List(_used + 5);
|
||||
resultDigits = Uint16List(_used + 5);
|
||||
resultUsed = _lShiftDigits(_digits, _used, nsh, resultDigits);
|
||||
} else {
|
||||
yDigits = other._digits;
|
||||
|
@ -1152,7 +1151,7 @@ class _BigIntImpl implements BigInt {
|
|||
var i = resultUsed;
|
||||
var j = i - yUsed;
|
||||
// tmpDigits is a temporary array of i (resultUsed) digits.
|
||||
var tmpDigits = new Uint16List(i);
|
||||
var tmpDigits = Uint16List(i);
|
||||
var tmpUsed = _dlShiftDigits(yDigits, yUsed, j, tmpDigits);
|
||||
// Explicit first division step in case normalized dividend is larger or
|
||||
// equal to shifted normalized divisor.
|
||||
|
@ -1167,7 +1166,7 @@ class _BigIntImpl implements BigInt {
|
|||
}
|
||||
|
||||
// Negate y so we can later use _mulAdd instead of non-existent _mulSub.
|
||||
var nyDigits = new Uint16List(yUsed + 2);
|
||||
var nyDigits = Uint16List(yUsed + 2);
|
||||
nyDigits[yUsed] = 1;
|
||||
_absSub(nyDigits, yUsed + 1, yDigits, yUsed, nyDigits);
|
||||
// nyDigits is read-only and has yUsed digits (possibly including several
|
||||
|
@ -1377,7 +1376,7 @@ class _BigIntImpl implements BigInt {
|
|||
|
||||
_BigIntImpl pow(int exponent) {
|
||||
if (exponent < 0) {
|
||||
throw new ArgumentError("Exponent must not be negative: $exponent");
|
||||
throw ArgumentError("Exponent must not be negative: $exponent");
|
||||
}
|
||||
if (exponent == 0) return one;
|
||||
|
||||
|
@ -1404,10 +1403,10 @@ class _BigIntImpl implements BigInt {
|
|||
_BigIntImpl modPow(
|
||||
covariant _BigIntImpl exponent, covariant _BigIntImpl modulus) {
|
||||
if (exponent._isNegative) {
|
||||
throw new ArgumentError("exponent must be positive: $exponent");
|
||||
throw ArgumentError("exponent must be positive: $exponent");
|
||||
}
|
||||
if (modulus <= zero) {
|
||||
throw new ArgumentError("modulus must be strictly positive: $modulus");
|
||||
throw ArgumentError("modulus must be strictly positive: $modulus");
|
||||
}
|
||||
if (exponent._isZero) return one;
|
||||
|
||||
|
@ -1415,10 +1414,10 @@ class _BigIntImpl implements BigInt {
|
|||
final modulusUsed2p4 = 2 * modulusUsed + 4;
|
||||
final exponentBitlen = exponent.bitLength;
|
||||
if (exponentBitlen <= 0) return one;
|
||||
_BigIntReduction z = new _BigIntClassic(modulus);
|
||||
var resultDigits = new Uint16List(modulusUsed2p4);
|
||||
var result2Digits = new Uint16List(modulusUsed2p4);
|
||||
var gDigits = new Uint16List(modulusUsed);
|
||||
_BigIntReduction z = _BigIntClassic(modulus);
|
||||
var resultDigits = Uint16List(modulusUsed2p4);
|
||||
var result2Digits = Uint16List(modulusUsed2p4);
|
||||
var gDigits = Uint16List(modulusUsed);
|
||||
var gUsed = z.convert(this, gDigits);
|
||||
// Initialize result with g.
|
||||
// Copy leading zero if any.
|
||||
|
@ -1461,14 +1460,14 @@ class _BigIntImpl implements BigInt {
|
|||
if (inv) {
|
||||
if ((yUsed == 1) && (yDigits[0] == 1)) return one;
|
||||
if ((yUsed == 0) || (yDigits[0].isEven && xDigits[0].isEven)) {
|
||||
throw new Exception("Not coprime");
|
||||
throw Exception("Not coprime");
|
||||
}
|
||||
} else {
|
||||
if (x._isZero) {
|
||||
throw new ArgumentError.value(0, "this", "must not be zero");
|
||||
throw ArgumentError.value(0, "this", "must not be zero");
|
||||
}
|
||||
if (y._isZero) {
|
||||
throw new ArgumentError.value(0, "other", "must not be zero");
|
||||
throw ArgumentError.value(0, "other", "must not be zero");
|
||||
}
|
||||
if (((xUsed == 1) && (xDigits[0] == 1)) ||
|
||||
((yUsed == 1) && (yDigits[0] == 1))) return one;
|
||||
|
@ -1506,13 +1505,13 @@ class _BigIntImpl implements BigInt {
|
|||
var cDigits = _dummyList;
|
||||
var cIsNegative = false;
|
||||
if (ac) {
|
||||
aDigits = new Uint16List(abcdLen);
|
||||
aDigits = Uint16List(abcdLen);
|
||||
aDigits[0] = 1;
|
||||
cDigits = new Uint16List(abcdLen);
|
||||
cDigits = Uint16List(abcdLen);
|
||||
}
|
||||
var bDigits = new Uint16List(abcdLen);
|
||||
var bDigits = Uint16List(abcdLen);
|
||||
var bIsNegative = false;
|
||||
var dDigits = new Uint16List(abcdLen);
|
||||
var dDigits = Uint16List(abcdLen);
|
||||
var dIsNegative = false;
|
||||
dDigits[0] = 1;
|
||||
|
||||
|
@ -1669,13 +1668,13 @@ class _BigIntImpl implements BigInt {
|
|||
if (shiftAmount > 0) {
|
||||
maxUsed = _lShiftDigits(vDigits, maxUsed, shiftAmount, vDigits);
|
||||
}
|
||||
return new _BigIntImpl._(false, maxUsed, vDigits);
|
||||
return _BigIntImpl._(false, maxUsed, vDigits);
|
||||
}
|
||||
// No inverse if v != 1.
|
||||
var i = maxUsed - 1;
|
||||
while ((i > 0) && (vDigits[i] == 0)) --i;
|
||||
if ((i != 0) || (vDigits[0] != 1)) {
|
||||
throw new Exception("Not coprime");
|
||||
throw Exception("Not coprime");
|
||||
}
|
||||
|
||||
if (dIsNegative) {
|
||||
|
@ -1694,7 +1693,7 @@ class _BigIntImpl implements BigInt {
|
|||
_absSub(dDigits, abcdUsed, xDigits, maxUsed, dDigits);
|
||||
}
|
||||
}
|
||||
return new _BigIntImpl._(false, maxUsed, dDigits);
|
||||
return _BigIntImpl._(false, maxUsed, dDigits);
|
||||
}
|
||||
|
||||
/// Returns the modular multiplicative inverse of this big integer
|
||||
|
@ -1706,7 +1705,7 @@ class _BigIntImpl implements BigInt {
|
|||
// Returns 1/this % modulus, with modulus > 0.
|
||||
_BigIntImpl modInverse(covariant _BigIntImpl modulus) {
|
||||
if (modulus <= zero) {
|
||||
throw new ArgumentError("Modulus must be strictly positive: $modulus");
|
||||
throw ArgumentError("Modulus must be strictly positive: $modulus");
|
||||
}
|
||||
if (modulus == one) return zero;
|
||||
var tmp = this;
|
||||
|
@ -1811,7 +1810,7 @@ class _BigIntImpl implements BigInt {
|
|||
if (_used <= _simpleValidIntDigits) return true;
|
||||
var asInt = toInt();
|
||||
if (!asInt.toDouble().isFinite) return false;
|
||||
return this == new _BigIntImpl._fromInt(asInt);
|
||||
return this == _BigIntImpl._fromInt(asInt);
|
||||
}
|
||||
|
||||
int toInt() {
|
||||
|
@ -1837,7 +1836,7 @@ class _BigIntImpl implements BigInt {
|
|||
if (_isZero) return 0.0;
|
||||
|
||||
// We fill the 53 bits little-endian.
|
||||
var resultBits = new Uint8List(8);
|
||||
var resultBits = Uint8List(8);
|
||||
|
||||
var length = _digitBits * (_used - 1) + _digits[_used - 1].bitLength;
|
||||
if (length > maxDoubleExponent + 53) {
|
||||
|
@ -1979,7 +1978,7 @@ class _BigIntImpl implements BigInt {
|
|||
|
||||
if (radix == 16) return _toHexString();
|
||||
|
||||
var base = new _BigIntImpl._fromInt(radix);
|
||||
var base = _BigIntImpl._fromInt(radix);
|
||||
var reversedDigitCodeUnits = <int>[];
|
||||
var rest = this.abs();
|
||||
while (!rest._isZero) {
|
||||
|
@ -1987,7 +1986,7 @@ class _BigIntImpl implements BigInt {
|
|||
rest = rest ~/ base;
|
||||
reversedDigitCodeUnits.add(_toRadixCodeUnit(digit));
|
||||
}
|
||||
var digitString = new String.fromCharCodes(reversedDigitCodeUnits.reversed);
|
||||
var digitString = String.fromCharCodes(reversedDigitCodeUnits.reversed);
|
||||
if (_isNegative) return "-" + digitString;
|
||||
return digitString;
|
||||
}
|
||||
|
@ -2010,7 +2009,7 @@ class _BigIntImpl implements BigInt {
|
|||
const _dash = 45;
|
||||
chars.add(_dash);
|
||||
}
|
||||
return new String.fromCharCodes(chars.reversed);
|
||||
return String.fromCharCodes(chars.reversed);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2060,7 +2059,7 @@ class _BigIntClassic implements _BigIntReduction {
|
|||
}
|
||||
|
||||
_BigIntImpl revert(Uint16List xDigits, int xUsed) {
|
||||
return new _BigIntImpl._(false, xUsed, xDigits);
|
||||
return _BigIntImpl._(false, xUsed, xDigits);
|
||||
}
|
||||
|
||||
int _reduce(Uint16List xDigits, int xUsed) {
|
||||
|
@ -2073,7 +2072,7 @@ class _BigIntClassic implements _BigIntReduction {
|
|||
}
|
||||
|
||||
int sqr(Uint16List xDigits, int xUsed, Uint16List resultDigits) {
|
||||
var b = new _BigIntImpl._(false, xUsed, xDigits);
|
||||
var b = _BigIntImpl._(false, xUsed, xDigits);
|
||||
var b2 = b * b;
|
||||
for (int i = 0; i < b2._used; i++) {
|
||||
resultDigits[i] = b2._digits[i];
|
||||
|
|
|
@ -30,13 +30,13 @@ class HashMap<K, V> {
|
|||
if (isValidKey == null) {
|
||||
if (hashCode == null) {
|
||||
if (equals == null) {
|
||||
return new _HashMap<K, V>();
|
||||
return _HashMap<K, V>();
|
||||
}
|
||||
hashCode = _defaultHashCode;
|
||||
} else {
|
||||
if (identical(identityHashCode, hashCode) &&
|
||||
identical(identical, equals)) {
|
||||
return new _IdentityHashMap<K, V>();
|
||||
return _IdentityHashMap<K, V>();
|
||||
}
|
||||
if (equals == null) {
|
||||
equals = _defaultEquals;
|
||||
|
@ -50,7 +50,7 @@ class HashMap<K, V> {
|
|||
equals = _defaultEquals;
|
||||
}
|
||||
}
|
||||
return new _CustomHashMap<K, V>(equals, hashCode, isValidKey);
|
||||
return _CustomHashMap<K, V>(equals, hashCode, isValidKey);
|
||||
}
|
||||
|
||||
@patch
|
||||
|
@ -85,11 +85,11 @@ base class _HashMap<K, V> extends MapBase<K, V> implements HashMap<K, V> {
|
|||
bool get isNotEmpty => !isEmpty;
|
||||
|
||||
Iterable<K> get keys {
|
||||
return new _HashMapKeyIterable<K>(this);
|
||||
return _HashMapKeyIterable<K>(this);
|
||||
}
|
||||
|
||||
Iterable<V> get values {
|
||||
return new MappedIterable<K, V>(keys, (each) => this[each] as V);
|
||||
return MappedIterable<K, V>(keys, (each) => this[each] as V);
|
||||
}
|
||||
|
||||
bool containsKey(Object? key) {
|
||||
|
@ -224,7 +224,7 @@ base class _HashMap<K, V> extends MapBase<K, V> implements HashMap<K, V> {
|
|||
var key = JS('var', '#[#]', keys, i);
|
||||
action(key, this[key] as V);
|
||||
if (JS('bool', '# !== #', keys, _keys)) {
|
||||
throw new ConcurrentModificationError(this);
|
||||
throw ConcurrentModificationError(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -453,7 +453,7 @@ class _HashMapKeyIterable<E> extends EfficientLengthIterable<E>
|
|||
bool get isNotEmpty => _map._length != 0;
|
||||
|
||||
Iterator<E> get iterator {
|
||||
return new _HashMapKeyIterator<E>(_map, _map._computeKeys());
|
||||
return _HashMapKeyIterator<E>(_map, _map._computeKeys());
|
||||
}
|
||||
|
||||
bool contains(Object? element) {
|
||||
|
@ -465,7 +465,7 @@ class _HashMapKeyIterable<E> extends EfficientLengthIterable<E>
|
|||
for (int i = 0, length = JS('int', '#.length', keys); i < length; i++) {
|
||||
f(JS('var', '#[#]', keys, i));
|
||||
if (JS('bool', '# !== #', keys, _map._keys)) {
|
||||
throw new ConcurrentModificationError(_map);
|
||||
throw ConcurrentModificationError(_map);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -485,7 +485,7 @@ class _HashMapKeyIterator<E> implements Iterator<E> {
|
|||
var keys = _keys;
|
||||
int offset = _offset;
|
||||
if (JS('bool', '# !== #', keys, _map._keys)) {
|
||||
throw new ConcurrentModificationError(_map);
|
||||
throw ConcurrentModificationError(_map);
|
||||
} else if (offset >= JS('int', '#.length', keys)) {
|
||||
_current = null;
|
||||
return false;
|
||||
|
@ -510,7 +510,7 @@ class LinkedHashMap<K, V> {
|
|||
if (isValidKey == null) {
|
||||
if (hashCode == null) {
|
||||
if (equals == null) {
|
||||
return new JsLinkedHashMap<K, V>();
|
||||
return JsLinkedHashMap<K, V>();
|
||||
}
|
||||
hashCode = _defaultHashCode;
|
||||
} else {
|
||||
|
@ -530,7 +530,7 @@ class LinkedHashMap<K, V> {
|
|||
equals = _defaultEquals;
|
||||
}
|
||||
}
|
||||
return new _LinkedCustomHashMap<K, V>(equals, hashCode, isValidKey);
|
||||
return _LinkedCustomHashMap<K, V>(equals, hashCode, isValidKey);
|
||||
}
|
||||
|
||||
@patch
|
||||
|
@ -539,7 +539,7 @@ class LinkedHashMap<K, V> {
|
|||
// Private factory constructor called by generated code for map literals.
|
||||
@pragma('dart2js:noInline')
|
||||
factory LinkedHashMap._literal(List keyValuePairs) {
|
||||
return fillLiteralMap(keyValuePairs, new JsLinkedHashMap<K, V>());
|
||||
return fillLiteralMap(keyValuePairs, JsLinkedHashMap<K, V>());
|
||||
}
|
||||
|
||||
// Private factory constructor called by generated code for map literals.
|
||||
|
@ -547,7 +547,7 @@ class LinkedHashMap<K, V> {
|
|||
@pragma('dart2js:noInline')
|
||||
@pragma('dart2js:noSideEffects')
|
||||
factory LinkedHashMap._empty() {
|
||||
return new JsLinkedHashMap<K, V>();
|
||||
return JsLinkedHashMap<K, V>();
|
||||
}
|
||||
|
||||
// Private factory static function called by generated code for map literals.
|
||||
|
@ -555,13 +555,13 @@ class LinkedHashMap<K, V> {
|
|||
@pragma('dart2js:noThrows')
|
||||
@pragma('dart2js:noInline')
|
||||
@pragma('dart2js:noSideEffects')
|
||||
static _makeEmpty() => new JsLinkedHashMap();
|
||||
static _makeEmpty() => JsLinkedHashMap();
|
||||
|
||||
// Private factory static function called by generated code for map literals.
|
||||
// This version is for map literals without type parameters.
|
||||
@pragma('dart2js:noInline')
|
||||
static _makeLiteral(keyValuePairs) =>
|
||||
fillLiteralMap(keyValuePairs, new JsLinkedHashMap());
|
||||
fillLiteralMap(keyValuePairs, JsLinkedHashMap());
|
||||
}
|
||||
|
||||
// TODO(sra): Move to same library as JsLinkedHashMap and make the `internalXXX`
|
||||
|
@ -622,13 +622,13 @@ class HashSet<E> {
|
|||
if (isValidKey == null) {
|
||||
if (hashCode == null) {
|
||||
if (equals == null) {
|
||||
return new _HashSet<E>();
|
||||
return _HashSet<E>();
|
||||
}
|
||||
hashCode = _defaultHashCode;
|
||||
} else {
|
||||
if (identical(identityHashCode, hashCode) &&
|
||||
identical(identical, equals)) {
|
||||
return new _IdentityHashSet<E>();
|
||||
return _IdentityHashSet<E>();
|
||||
}
|
||||
if (equals == null) {
|
||||
equals = _defaultEquals;
|
||||
|
@ -642,7 +642,7 @@ class HashSet<E> {
|
|||
equals = _defaultEquals;
|
||||
}
|
||||
}
|
||||
return new _CustomHashSet<E>(equals, hashCode, isValidKey);
|
||||
return _CustomHashSet<E>(equals, hashCode, isValidKey);
|
||||
}
|
||||
|
||||
@patch
|
||||
|
@ -673,12 +673,12 @@ base class _HashSet<E> extends _SetBase<E> implements HashSet<E> {
|
|||
|
||||
_HashSet();
|
||||
|
||||
Set<E> _newSet() => new _HashSet<E>();
|
||||
Set<R> _newSimilarSet<R>() => new _HashSet<R>();
|
||||
Set<E> _newSet() => _HashSet<E>();
|
||||
Set<R> _newSimilarSet<R>() => _HashSet<R>();
|
||||
|
||||
// Iterable.
|
||||
Iterator<E> get iterator {
|
||||
return new _HashSetIterator<E>(this, _computeElements());
|
||||
return _HashSetIterator<E>(this, _computeElements());
|
||||
}
|
||||
|
||||
int get length => _length;
|
||||
|
@ -932,8 +932,8 @@ base class _HashSet<E> extends _SetBase<E> implements HashSet<E> {
|
|||
}
|
||||
|
||||
base class _IdentityHashSet<E> extends _HashSet<E> {
|
||||
Set<E> _newSet() => new _IdentityHashSet<E>();
|
||||
Set<R> _newSimilarSet<R>() => new _IdentityHashSet<R>();
|
||||
Set<E> _newSet() => _IdentityHashSet<E>();
|
||||
Set<R> _newSimilarSet<R>() => _IdentityHashSet<R>();
|
||||
|
||||
int _computeHashCode(var key) {
|
||||
// We force the hash codes to be unsigned 30-bit integers to avoid
|
||||
|
@ -959,8 +959,8 @@ base class _CustomHashSet<E> extends _HashSet<E> {
|
|||
_CustomHashSet(this._equality, this._hasher, bool validKey(potentialKey)?)
|
||||
: _validKey = (validKey != null) ? validKey : ((x) => x is E);
|
||||
|
||||
Set<E> _newSet() => new _CustomHashSet<E>(_equality, _hasher, _validKey);
|
||||
Set<R> _newSimilarSet<R>() => new _HashSet<R>();
|
||||
Set<E> _newSet() => _CustomHashSet<E>(_equality, _hasher, _validKey);
|
||||
Set<R> _newSimilarSet<R>() => _HashSet<R>();
|
||||
|
||||
int _findBucketIndex(var bucket, var element) {
|
||||
if (bucket == null) return -1;
|
||||
|
@ -1012,7 +1012,7 @@ class _HashSetIterator<E> implements Iterator<E> {
|
|||
var elements = _elements;
|
||||
int offset = _offset;
|
||||
if (JS('bool', '# !== #', elements, _set._elements)) {
|
||||
throw new ConcurrentModificationError(_set);
|
||||
throw ConcurrentModificationError(_set);
|
||||
} else if (offset >= JS('int', '#.length', elements)) {
|
||||
_current = null;
|
||||
return false;
|
||||
|
@ -1037,13 +1037,13 @@ class LinkedHashSet<E> {
|
|||
if (isValidKey == null) {
|
||||
if (hashCode == null) {
|
||||
if (equals == null) {
|
||||
return new _LinkedHashSet<E>();
|
||||
return _LinkedHashSet<E>();
|
||||
}
|
||||
hashCode = _defaultHashCode;
|
||||
} else {
|
||||
if (identical(identityHashCode, hashCode) &&
|
||||
identical(identical, equals)) {
|
||||
return new _LinkedIdentityHashSet<E>();
|
||||
return _LinkedIdentityHashSet<E>();
|
||||
}
|
||||
if (equals == null) {
|
||||
equals = _defaultEquals;
|
||||
|
@ -1057,7 +1057,7 @@ class LinkedHashSet<E> {
|
|||
equals = _defaultEquals;
|
||||
}
|
||||
}
|
||||
return new _LinkedCustomHashSet<E>(equals, hashCode, isValidKey);
|
||||
return _LinkedCustomHashSet<E>(equals, hashCode, isValidKey);
|
||||
}
|
||||
|
||||
@patch
|
||||
|
@ -1067,25 +1067,24 @@ class LinkedHashSet<E> {
|
|||
@pragma('dart2js:noThrows')
|
||||
@pragma('dart2js:noInline')
|
||||
@pragma('dart2js:noSideEffects')
|
||||
factory LinkedHashSet._empty() => new _LinkedHashSet<E>();
|
||||
factory LinkedHashSet._empty() => _LinkedHashSet<E>();
|
||||
|
||||
// Private factory constructor called by generated code for set literals.
|
||||
@pragma('dart2js:noInline')
|
||||
factory LinkedHashSet._literal(List values) =>
|
||||
fillLiteralSet(values, new _LinkedHashSet<E>());
|
||||
fillLiteralSet(values, _LinkedHashSet<E>());
|
||||
|
||||
// Private factory static function called by generated code for set literals.
|
||||
// This version is for set literals without type parameters.
|
||||
@pragma('dart2js:noThrows')
|
||||
@pragma('dart2js:noInline')
|
||||
@pragma('dart2js:noSideEffects')
|
||||
static _makeEmpty() => new _LinkedHashSet();
|
||||
static _makeEmpty() => _LinkedHashSet();
|
||||
|
||||
// Private factory static function called by generated code for set literals.
|
||||
// This version is for set literals without type parameters.
|
||||
@pragma('dart2js:noInline')
|
||||
static _makeLiteral(List values) =>
|
||||
fillLiteralSet(values, new _LinkedHashSet());
|
||||
static _makeLiteral(List values) => fillLiteralSet(values, _LinkedHashSet());
|
||||
}
|
||||
|
||||
base class _LinkedHashSet<E> extends _SetBase<E> implements LinkedHashSet<E> {
|
||||
|
@ -1116,8 +1115,8 @@ base class _LinkedHashSet<E> extends _SetBase<E> implements LinkedHashSet<E> {
|
|||
|
||||
_LinkedHashSet();
|
||||
|
||||
Set<E> _newSet() => new _LinkedHashSet<E>();
|
||||
Set<R> _newSimilarSet<R>() => new _LinkedHashSet<R>();
|
||||
Set<E> _newSet() => _LinkedHashSet<E>();
|
||||
Set<R> _newSimilarSet<R>() => _LinkedHashSet<R>();
|
||||
|
||||
void _unsupported(String operation) {
|
||||
throw 'LinkedHashSet: unsupported $operation';
|
||||
|
@ -1125,7 +1124,7 @@ base class _LinkedHashSet<E> extends _SetBase<E> implements LinkedHashSet<E> {
|
|||
|
||||
// Iterable.
|
||||
Iterator<E> get iterator {
|
||||
return new _LinkedHashSetIterator(this, _modifications);
|
||||
return _LinkedHashSetIterator(this, _modifications);
|
||||
}
|
||||
|
||||
int get length => _length;
|
||||
|
@ -1178,7 +1177,7 @@ base class _LinkedHashSet<E> extends _SetBase<E> implements LinkedHashSet<E> {
|
|||
while (cell != null) {
|
||||
action(cell._element);
|
||||
if (modifications != _modifications) {
|
||||
throw new ConcurrentModificationError(this);
|
||||
throw ConcurrentModificationError(this);
|
||||
}
|
||||
cell = cell._next;
|
||||
}
|
||||
|
@ -1186,13 +1185,13 @@ base class _LinkedHashSet<E> extends _SetBase<E> implements LinkedHashSet<E> {
|
|||
|
||||
E get first {
|
||||
var first = _first;
|
||||
if (first == null) throw new StateError("No elements");
|
||||
if (first == null) throw StateError("No elements");
|
||||
return first._element;
|
||||
}
|
||||
|
||||
E get last {
|
||||
var last = _last;
|
||||
if (last == null) throw new StateError("No elements");
|
||||
if (last == null) throw StateError("No elements");
|
||||
return last._element;
|
||||
}
|
||||
|
||||
|
@ -1270,7 +1269,7 @@ base class _LinkedHashSet<E> extends _SetBase<E> implements LinkedHashSet<E> {
|
|||
int modifications = _modifications;
|
||||
bool shouldRemove = (removeMatching == test(element));
|
||||
if (modifications != _modifications) {
|
||||
throw new ConcurrentModificationError(this);
|
||||
throw ConcurrentModificationError(this);
|
||||
}
|
||||
if (shouldRemove) remove(element);
|
||||
cell = next;
|
||||
|
@ -1310,7 +1309,7 @@ base class _LinkedHashSet<E> extends _SetBase<E> implements LinkedHashSet<E> {
|
|||
|
||||
// Create a new cell and link it in as the last one in the list.
|
||||
_LinkedHashSetCell _newLinkedCell(E element) {
|
||||
_LinkedHashSetCell cell = new _LinkedHashSetCell(element);
|
||||
_LinkedHashSetCell cell = _LinkedHashSetCell(element);
|
||||
if (_first == null) {
|
||||
_first = _last = cell;
|
||||
} else {
|
||||
|
@ -1406,8 +1405,8 @@ base class _LinkedHashSet<E> extends _SetBase<E> implements LinkedHashSet<E> {
|
|||
}
|
||||
|
||||
base class _LinkedIdentityHashSet<E> extends _LinkedHashSet<E> {
|
||||
Set<E> _newSet() => new _LinkedIdentityHashSet<E>();
|
||||
Set<R> _newSimilarSet<R>() => new _LinkedIdentityHashSet<R>();
|
||||
Set<E> _newSet() => _LinkedIdentityHashSet<E>();
|
||||
Set<R> _newSimilarSet<R>() => _LinkedIdentityHashSet<R>();
|
||||
|
||||
int _computeHashCode(var key) {
|
||||
// We force the hash codes to be unsigned 30-bit integers to avoid
|
||||
|
@ -1435,9 +1434,8 @@ base class _LinkedCustomHashSet<E> extends _LinkedHashSet<E> {
|
|||
this._equality, this._hasher, bool validKey(potentialKey)?)
|
||||
: _validKey = (validKey != null) ? validKey : ((x) => x is E);
|
||||
|
||||
Set<E> _newSet() =>
|
||||
new _LinkedCustomHashSet<E>(_equality, _hasher, _validKey);
|
||||
Set<R> _newSimilarSet<R>() => new _LinkedHashSet<R>();
|
||||
Set<E> _newSet() => _LinkedCustomHashSet<E>(_equality, _hasher, _validKey);
|
||||
Set<R> _newSimilarSet<R>() => _LinkedHashSet<R>();
|
||||
|
||||
int _findBucketIndex(var bucket, var element) {
|
||||
if (bucket == null) return -1;
|
||||
|
@ -1515,7 +1513,7 @@ class _LinkedHashSetIterator<E> implements Iterator<E> {
|
|||
bool moveNext() {
|
||||
var cell = _cell;
|
||||
if (_modifications != _set._modifications) {
|
||||
throw new ConcurrentModificationError(_set);
|
||||
throw ConcurrentModificationError(_set);
|
||||
} else if (cell == null) {
|
||||
_current = null;
|
||||
return false;
|
||||
|
|
|
@ -270,7 +270,7 @@ class _JsonMap extends MapBase<String, dynamic> {
|
|||
assert(!_isUpgraded);
|
||||
List? keys = _data;
|
||||
if (keys == null) {
|
||||
keys = _data = new JSArray<String>.typed(_getPropertyNames(_original));
|
||||
keys = _data = JSArray<String>.typed(_getPropertyNames(_original));
|
||||
}
|
||||
return JS('JSExtendableArray', '#', keys);
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ String _symbolToString(Symbol symbol) =>
|
|||
|
||||
Map<String, dynamic>? _symbolMapToStringMap(Map<Symbol, dynamic>? map) {
|
||||
if (map == null) return null;
|
||||
var result = new Map<String, dynamic>();
|
||||
var result = Map<String, dynamic>();
|
||||
map.forEach((Symbol key, value) {
|
||||
result[_symbolToString(key)] = value;
|
||||
});
|
||||
|
@ -66,7 +66,7 @@ class Object {
|
|||
|
||||
@patch
|
||||
dynamic noSuchMethod(Invocation invocation) {
|
||||
throw new NoSuchMethodError.withInvocation(this, invocation);
|
||||
throw NoSuchMethodError.withInvocation(this, invocation);
|
||||
}
|
||||
|
||||
@patch
|
||||
|
@ -231,7 +231,7 @@ class int {
|
|||
int? value = tryParse(source, radix: radix);
|
||||
if (value != null) return value;
|
||||
if (onError != null) return onError(source);
|
||||
throw new FormatException(source);
|
||||
throw FormatException(source);
|
||||
}
|
||||
|
||||
@patch
|
||||
|
@ -248,7 +248,7 @@ class double {
|
|||
double? value = tryParse(source);
|
||||
if (value != null) return value;
|
||||
if (onError != null) return onError(source);
|
||||
throw new FormatException('Invalid double', source);
|
||||
throw FormatException('Invalid double', source);
|
||||
}
|
||||
|
||||
@patch
|
||||
|
@ -302,9 +302,8 @@ class DateTime {
|
|||
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'),
|
||||
: this.isUtc =
|
||||
isUtc is bool ? isUtc : throw ArgumentError.value(isUtc, 'isUtc'),
|
||||
_value = checkInt(Primitives.valueFromDecomposedDate(
|
||||
year,
|
||||
month,
|
||||
|
@ -354,25 +353,23 @@ class DateTime {
|
|||
|
||||
@patch
|
||||
Duration get timeZoneOffset {
|
||||
if (isUtc) return new Duration();
|
||||
return new Duration(minutes: Primitives.getTimeZoneOffsetInMinutes(this));
|
||||
if (isUtc) return Duration();
|
||||
return Duration(minutes: Primitives.getTimeZoneOffsetInMinutes(this));
|
||||
}
|
||||
|
||||
@patch
|
||||
DateTime add(Duration duration) {
|
||||
return new DateTime._withValue(_value + duration.inMilliseconds,
|
||||
isUtc: isUtc);
|
||||
return DateTime._withValue(_value + duration.inMilliseconds, isUtc: isUtc);
|
||||
}
|
||||
|
||||
@patch
|
||||
DateTime subtract(Duration duration) {
|
||||
return new DateTime._withValue(_value - duration.inMilliseconds,
|
||||
isUtc: isUtc);
|
||||
return DateTime._withValue(_value - duration.inMilliseconds, isUtc: isUtc);
|
||||
}
|
||||
|
||||
@patch
|
||||
Duration difference(DateTime other) {
|
||||
return new Duration(milliseconds: _value - other.millisecondsSinceEpoch);
|
||||
return Duration(milliseconds: _value - other.millisecondsSinceEpoch);
|
||||
}
|
||||
|
||||
@patch
|
||||
|
@ -463,9 +460,8 @@ class Stopwatch {
|
|||
class List<E> {
|
||||
@patch
|
||||
factory List.filled(int length, E fill, {bool growable = false}) {
|
||||
var result = growable
|
||||
? new JSArray<E>.growable(length)
|
||||
: new JSArray<E>.fixed(length);
|
||||
var result =
|
||||
growable ? JSArray<E>.growable(length) : JSArray<E>.fixed(length);
|
||||
if (length != 0 && fill != null) {
|
||||
// TODO(sra): Consider using `Array.fill`.
|
||||
for (int i = 0; i < result.length; i++) {
|
||||
|
@ -479,7 +475,7 @@ class List<E> {
|
|||
|
||||
@patch
|
||||
factory List.empty({bool growable = false}) {
|
||||
return growable ? new JSArray<E>.growable(0) : new JSArray<E>.fixed(0);
|
||||
return growable ? JSArray<E>.growable(0) : JSArray<E>.fixed(0);
|
||||
}
|
||||
|
||||
@patch
|
||||
|
@ -526,9 +522,8 @@ class List<E> {
|
|||
@patch
|
||||
factory List.generate(int length, E generator(int index),
|
||||
{bool growable = true}) {
|
||||
final result = growable
|
||||
? new JSArray<E>.growable(length)
|
||||
: new JSArray<E>.fixed(length);
|
||||
final result =
|
||||
growable ? JSArray<E>.growable(length) : JSArray<E>.fixed(length);
|
||||
for (int i = 0; i < length; i++) {
|
||||
result[i] = generator(i);
|
||||
}
|
||||
|
@ -639,7 +634,7 @@ class RegExp {
|
|||
bool caseSensitive = true,
|
||||
bool unicode = false,
|
||||
bool dotAll = false}) =>
|
||||
new JSSyntaxRegExp(source,
|
||||
JSSyntaxRegExp(source,
|
||||
multiLine: multiLine,
|
||||
caseSensitive: caseSensitive,
|
||||
unicode: unicode,
|
||||
|
@ -674,7 +669,7 @@ class StringBuffer {
|
|||
|
||||
@patch
|
||||
void writeCharCode(int charCode) {
|
||||
_writeString(new String.fromCharCode(charCode));
|
||||
_writeString(String.fromCharCode(charCode));
|
||||
}
|
||||
|
||||
@patch
|
||||
|
@ -836,7 +831,7 @@ class _Uri {
|
|||
// Matches a String that _uriEncodes to itself regardless of the kind of
|
||||
// component. This corresponds to [_unreservedTable], i.e. characters that
|
||||
// are not encoded by any encoding table.
|
||||
static final RegExp _needsNoEncoding = new RegExp(r'^[\-\.0-9A-Z_a-z~]*$');
|
||||
static final RegExp _needsNoEncoding = RegExp(r'^[\-\.0-9A-Z_a-z~]*$');
|
||||
|
||||
/// This is the internal implementation of JavaScript's encodeURI function.
|
||||
/// It encodes all characters in the string [text] except for those
|
||||
|
@ -850,7 +845,7 @@ class _Uri {
|
|||
|
||||
// Encode the string into bytes then generate an ASCII only string
|
||||
// by percent encoding selected bytes.
|
||||
StringBuffer result = new StringBuffer('');
|
||||
StringBuffer result = StringBuffer('');
|
||||
var bytes = encoding.encode(text);
|
||||
for (int i = 0; i < bytes.length; i++) {
|
||||
int byte = bytes[i];
|
||||
|
|
|
@ -243,7 +243,7 @@ final class _FakeUserTag implements UserTag {
|
|||
return old;
|
||||
}
|
||||
|
||||
static final UserTag _defaultTag = new _FakeUserTag('Default');
|
||||
static final UserTag _defaultTag = _FakeUserTag('Default');
|
||||
}
|
||||
|
||||
var _currentTag = _FakeUserTag._defaultTag;
|
||||
|
|
|
@ -237,103 +237,102 @@ final class Instantiation20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
|
|||
}
|
||||
|
||||
Instantiation instantiate1<T1>(Closure f) {
|
||||
return new Instantiation1<T1>(f);
|
||||
return Instantiation1<T1>(f);
|
||||
}
|
||||
|
||||
Instantiation instantiate2<T1, T2>(Closure f) {
|
||||
return new Instantiation2<T1, T2>(f);
|
||||
return Instantiation2<T1, T2>(f);
|
||||
}
|
||||
|
||||
Instantiation instantiate3<T1, T2, T3>(Closure f) {
|
||||
return new Instantiation3<T1, T2, T3>(f);
|
||||
return Instantiation3<T1, T2, T3>(f);
|
||||
}
|
||||
|
||||
Instantiation instantiate4<T1, T2, T3, T4>(Closure f) {
|
||||
return new Instantiation4<T1, T2, T3, T4>(f);
|
||||
return Instantiation4<T1, T2, T3, T4>(f);
|
||||
}
|
||||
|
||||
Instantiation instantiate5<T1, T2, T3, T4, T5>(Closure f) {
|
||||
return new Instantiation5<T1, T2, T3, T4, T5>(f);
|
||||
return Instantiation5<T1, T2, T3, T4, T5>(f);
|
||||
}
|
||||
|
||||
Instantiation instantiate6<T1, T2, T3, T4, T5, T6>(Closure f) {
|
||||
return new Instantiation6<T1, T2, T3, T4, T5, T6>(f);
|
||||
return Instantiation6<T1, T2, T3, T4, T5, T6>(f);
|
||||
}
|
||||
|
||||
Instantiation instantiate7<T1, T2, T3, T4, T5, T6, T7>(Closure f) {
|
||||
return new Instantiation7<T1, T2, T3, T4, T5, T6, T7>(f);
|
||||
return Instantiation7<T1, T2, T3, T4, T5, T6, T7>(f);
|
||||
}
|
||||
|
||||
Instantiation instantiate8<T1, T2, T3, T4, T5, T6, T7, T8>(Closure f) {
|
||||
return new Instantiation8<T1, T2, T3, T4, T5, T6, T7, T8>(f);
|
||||
return Instantiation8<T1, T2, T3, T4, T5, T6, T7, T8>(f);
|
||||
}
|
||||
|
||||
Instantiation instantiate9<T1, T2, T3, T4, T5, T6, T7, T8, T9>(Closure f) {
|
||||
return new Instantiation9<T1, T2, T3, T4, T5, T6, T7, T8, T9>(f);
|
||||
return Instantiation9<T1, T2, T3, T4, T5, T6, T7, T8, T9>(f);
|
||||
}
|
||||
|
||||
Instantiation instantiate10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(
|
||||
Closure f) {
|
||||
return new Instantiation10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(f);
|
||||
return Instantiation10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(f);
|
||||
}
|
||||
|
||||
Instantiation instantiate11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(
|
||||
Closure f) {
|
||||
return new Instantiation11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(f);
|
||||
return Instantiation11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(f);
|
||||
}
|
||||
|
||||
Instantiation instantiate12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(
|
||||
Closure f) {
|
||||
return new Instantiation12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(
|
||||
f);
|
||||
return Instantiation12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(f);
|
||||
}
|
||||
|
||||
Instantiation
|
||||
instantiate13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(
|
||||
Closure f) {
|
||||
return new Instantiation13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
|
||||
return Instantiation13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
|
||||
T13>(f);
|
||||
}
|
||||
|
||||
Instantiation
|
||||
instantiate14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(
|
||||
Closure f) {
|
||||
return new Instantiation14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
|
||||
T13, T14>(f);
|
||||
return Instantiation14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
|
||||
T14>(f);
|
||||
}
|
||||
|
||||
Instantiation instantiate15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
|
||||
T13, T14, T15>(Closure f) {
|
||||
return new Instantiation15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
|
||||
T13, T14, T15>(f);
|
||||
return Instantiation15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
|
||||
T14, T15>(f);
|
||||
}
|
||||
|
||||
Instantiation instantiate16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
|
||||
T13, T14, T15, T16>(Closure f) {
|
||||
return new Instantiation16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
|
||||
T13, T14, T15, T16>(f);
|
||||
return Instantiation16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
|
||||
T14, T15, T16>(f);
|
||||
}
|
||||
|
||||
Instantiation instantiate17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
|
||||
T13, T14, T15, T16, T17>(Closure f) {
|
||||
return new Instantiation17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
|
||||
T13, T14, T15, T16, T17>(f);
|
||||
return Instantiation17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
|
||||
T14, T15, T16, T17>(f);
|
||||
}
|
||||
|
||||
Instantiation instantiate18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
|
||||
T13, T14, T15, T16, T17, T18>(Closure f) {
|
||||
return new Instantiation18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
|
||||
T13, T14, T15, T16, T17, T18>(f);
|
||||
return Instantiation18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
|
||||
T14, T15, T16, T17, T18>(f);
|
||||
}
|
||||
|
||||
Instantiation instantiate19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
|
||||
T13, T14, T15, T16, T17, T18, T19>(Closure f) {
|
||||
return new Instantiation19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
|
||||
T13, T14, T15, T16, T17, T18, T19>(f);
|
||||
return Instantiation19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
|
||||
T14, T15, T16, T17, T18, T19>(f);
|
||||
}
|
||||
|
||||
Instantiation instantiate20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
|
||||
T13, T14, T15, T16, T17, T18, T19, T20>(Closure f) {
|
||||
return new Instantiation20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
|
||||
T13, T14, T15, T16, T17, T18, T19, T20>(f);
|
||||
return Instantiation20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
|
||||
T14, T15, T16, T17, T18, T19, T20>(f);
|
||||
}
|
||||
|
|
|
@ -147,7 +147,7 @@ getNativeInterceptor(object) {
|
|||
// instance-cached tag, defaulting to instance-cached if caching
|
||||
// unspecified.
|
||||
var discriminatedTag = JS('', '(#)(#, #)', proto, object, record);
|
||||
throw new UnimplementedError('Return interceptor for $discriminatedTag');
|
||||
throw UnimplementedError('Return interceptor for $discriminatedTag');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -341,7 +341,7 @@ abstract class Interceptor {
|
|||
// calls to use interceptor calling convention). If we did allow it, the
|
||||
// interceptor context would select the correct `this`.
|
||||
dynamic noSuchMethod(Invocation invocation) {
|
||||
throw new NoSuchMethodError.withInvocation(this, invocation);
|
||||
throw NoSuchMethodError.withInvocation(this, invocation);
|
||||
}
|
||||
|
||||
Type get runtimeType =>
|
||||
|
|
|
@ -12,42 +12,42 @@ import 'dart:typed_data';
|
|||
class _Directory {
|
||||
@patch
|
||||
static _current(_Namespace namespace) {
|
||||
throw new UnsupportedError("Directory._current");
|
||||
throw UnsupportedError("Directory._current");
|
||||
}
|
||||
|
||||
@patch
|
||||
static _setCurrent(_Namespace namespace, Uint8List path) {
|
||||
throw new UnsupportedError("Directory_SetCurrent");
|
||||
throw UnsupportedError("Directory_SetCurrent");
|
||||
}
|
||||
|
||||
@patch
|
||||
static _createTemp(_Namespace namespace, Uint8List path) {
|
||||
throw new UnsupportedError("Directory._createTemp");
|
||||
throw UnsupportedError("Directory._createTemp");
|
||||
}
|
||||
|
||||
@patch
|
||||
static String _systemTemp(_Namespace namespace) {
|
||||
throw new UnsupportedError("Directory._systemTemp");
|
||||
throw UnsupportedError("Directory._systemTemp");
|
||||
}
|
||||
|
||||
@patch
|
||||
static _exists(_Namespace namespace, Uint8List path) {
|
||||
throw new UnsupportedError("Directory._exists");
|
||||
throw UnsupportedError("Directory._exists");
|
||||
}
|
||||
|
||||
@patch
|
||||
static _create(_Namespace namespace, Uint8List path) {
|
||||
throw new UnsupportedError("Directory._create");
|
||||
throw UnsupportedError("Directory._create");
|
||||
}
|
||||
|
||||
@patch
|
||||
static _deleteNative(_Namespace namespace, Uint8List path, bool recursive) {
|
||||
throw new UnsupportedError("Directory._deleteNative");
|
||||
throw UnsupportedError("Directory._deleteNative");
|
||||
}
|
||||
|
||||
@patch
|
||||
static _rename(_Namespace namespace, Uint8List path, String newPath) {
|
||||
throw new UnsupportedError("Directory._rename");
|
||||
throw UnsupportedError("Directory._rename");
|
||||
}
|
||||
|
||||
@patch
|
||||
|
@ -57,7 +57,7 @@ class _Directory {
|
|||
Uint8List path,
|
||||
bool recursive,
|
||||
bool followLinks) {
|
||||
throw new UnsupportedError("Directory._fillWithDirectoryListing");
|
||||
throw UnsupportedError("Directory._fillWithDirectoryListing");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ class _Directory {
|
|||
class _AsyncDirectoryListerOps {
|
||||
@patch
|
||||
factory _AsyncDirectoryListerOps(int pointer) {
|
||||
throw new UnsupportedError("Directory._list");
|
||||
throw UnsupportedError("Directory._list");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ class _AsyncDirectoryListerOps {
|
|||
class _EventHandler {
|
||||
@patch
|
||||
static void _sendData(Object? sender, SendPort sendPort, int data) {
|
||||
throw new UnsupportedError("EventHandler._sendData");
|
||||
throw UnsupportedError("EventHandler._sendData");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ class _EventHandler {
|
|||
class FileStat {
|
||||
@patch
|
||||
static _statSync(_Namespace namespace, String path) {
|
||||
throw new UnsupportedError("FileStat.stat");
|
||||
throw UnsupportedError("FileStat.stat");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -90,17 +90,17 @@ class FileSystemEntity {
|
|||
@patch
|
||||
static _getTypeNative(
|
||||
_Namespace namespace, Uint8List path, bool followLinks) {
|
||||
throw new UnsupportedError("FileSystemEntity._getType");
|
||||
throw UnsupportedError("FileSystemEntity._getType");
|
||||
}
|
||||
|
||||
@patch
|
||||
static _identicalNative(_Namespace namespace, String path1, String path2) {
|
||||
throw new UnsupportedError("FileSystemEntity._identical");
|
||||
throw UnsupportedError("FileSystemEntity._identical");
|
||||
}
|
||||
|
||||
@patch
|
||||
static _resolveSymbolicLinks(_Namespace namespace, Uint8List path) {
|
||||
throw new UnsupportedError("FileSystemEntity._resolveSymbolicLinks");
|
||||
throw UnsupportedError("FileSystemEntity._resolveSymbolicLinks");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -108,17 +108,17 @@ class FileSystemEntity {
|
|||
class _File {
|
||||
@patch
|
||||
static _exists(_Namespace namespace, Uint8List path) {
|
||||
throw new UnsupportedError("File._exists");
|
||||
throw UnsupportedError("File._exists");
|
||||
}
|
||||
|
||||
@patch
|
||||
static _create(_Namespace namespace, Uint8List path, bool exclusive) {
|
||||
throw new UnsupportedError("File._create");
|
||||
throw UnsupportedError("File._create");
|
||||
}
|
||||
|
||||
@patch
|
||||
static _createLink(_Namespace namespace, Uint8List path, String target) {
|
||||
throw new UnsupportedError("File._createLink");
|
||||
throw UnsupportedError("File._createLink");
|
||||
}
|
||||
|
||||
@patch
|
||||
|
@ -128,67 +128,67 @@ class _File {
|
|||
|
||||
@patch
|
||||
static _linkTarget(_Namespace namespace, Uint8List path) {
|
||||
throw new UnsupportedError("File._linkTarget");
|
||||
throw UnsupportedError("File._linkTarget");
|
||||
}
|
||||
|
||||
@patch
|
||||
static _deleteNative(_Namespace namespace, Uint8List path) {
|
||||
throw new UnsupportedError("File._deleteNative");
|
||||
throw UnsupportedError("File._deleteNative");
|
||||
}
|
||||
|
||||
@patch
|
||||
static _deleteLinkNative(_Namespace namespace, Uint8List path) {
|
||||
throw new UnsupportedError("File._deleteLinkNative");
|
||||
throw UnsupportedError("File._deleteLinkNative");
|
||||
}
|
||||
|
||||
@patch
|
||||
static _rename(_Namespace namespace, Uint8List oldPath, String newPath) {
|
||||
throw new UnsupportedError("File._rename");
|
||||
throw UnsupportedError("File._rename");
|
||||
}
|
||||
|
||||
@patch
|
||||
static _renameLink(_Namespace namespace, Uint8List oldPath, String newPath) {
|
||||
throw new UnsupportedError("File._renameLink");
|
||||
throw UnsupportedError("File._renameLink");
|
||||
}
|
||||
|
||||
@patch
|
||||
static _copy(_Namespace namespace, Uint8List oldPath, String newPath) {
|
||||
throw new UnsupportedError("File._copy");
|
||||
throw UnsupportedError("File._copy");
|
||||
}
|
||||
|
||||
@patch
|
||||
static _lengthFromPath(_Namespace namespace, Uint8List path) {
|
||||
throw new UnsupportedError("File._lengthFromPath");
|
||||
throw UnsupportedError("File._lengthFromPath");
|
||||
}
|
||||
|
||||
@patch
|
||||
static _lastModified(_Namespace namespace, Uint8List path) {
|
||||
throw new UnsupportedError("File._lastModified");
|
||||
throw UnsupportedError("File._lastModified");
|
||||
}
|
||||
|
||||
@patch
|
||||
static _lastAccessed(_Namespace namespace, Uint8List path) {
|
||||
throw new UnsupportedError("File._lastAccessed");
|
||||
throw UnsupportedError("File._lastAccessed");
|
||||
}
|
||||
|
||||
@patch
|
||||
static _setLastModified(_Namespace namespace, Uint8List path, int millis) {
|
||||
throw new UnsupportedError("File._setLastModified");
|
||||
throw UnsupportedError("File._setLastModified");
|
||||
}
|
||||
|
||||
@patch
|
||||
static _setLastAccessed(_Namespace namespace, Uint8List path, int millis) {
|
||||
throw new UnsupportedError("File._setLastAccessed");
|
||||
throw UnsupportedError("File._setLastAccessed");
|
||||
}
|
||||
|
||||
@patch
|
||||
static _open(_Namespace namespace, Uint8List path, int mode) {
|
||||
throw new UnsupportedError("File._open");
|
||||
throw UnsupportedError("File._open");
|
||||
}
|
||||
|
||||
@patch
|
||||
static int _openStdio(int fd) {
|
||||
throw new UnsupportedError("File._openStdio");
|
||||
throw UnsupportedError("File._openStdio");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -196,17 +196,17 @@ class _File {
|
|||
class _Namespace {
|
||||
@patch
|
||||
static void _setupNamespace(var namespace) {
|
||||
throw new UnsupportedError("_Namespace");
|
||||
throw UnsupportedError("_Namespace");
|
||||
}
|
||||
|
||||
@patch
|
||||
static _Namespace get _namespace {
|
||||
throw new UnsupportedError("_Namespace");
|
||||
throw UnsupportedError("_Namespace");
|
||||
}
|
||||
|
||||
@patch
|
||||
static int get _namespacePointer {
|
||||
throw new UnsupportedError("_Namespace");
|
||||
throw UnsupportedError("_Namespace");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -214,7 +214,7 @@ class _Namespace {
|
|||
class _RandomAccessFileOps {
|
||||
@patch
|
||||
factory _RandomAccessFileOps(int pointer) {
|
||||
throw new UnsupportedError("RandomAccessFile");
|
||||
throw UnsupportedError("RandomAccessFile");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -222,7 +222,7 @@ class _RandomAccessFileOps {
|
|||
class _IOCrypto {
|
||||
@patch
|
||||
static Uint8List getRandomBytes(int count) {
|
||||
throw new UnsupportedError("_IOCrypto.getRandomBytes");
|
||||
throw UnsupportedError("_IOCrypto.getRandomBytes");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -230,67 +230,67 @@ class _IOCrypto {
|
|||
class _Platform {
|
||||
@patch
|
||||
static int _numberOfProcessors() {
|
||||
throw new UnsupportedError("Platform._numberOfProcessors");
|
||||
throw UnsupportedError("Platform._numberOfProcessors");
|
||||
}
|
||||
|
||||
@patch
|
||||
static String _pathSeparator() {
|
||||
throw new UnsupportedError("Platform._pathSeparator");
|
||||
throw UnsupportedError("Platform._pathSeparator");
|
||||
}
|
||||
|
||||
@patch
|
||||
static String _operatingSystem() {
|
||||
throw new UnsupportedError("Platform._operatingSystem");
|
||||
throw UnsupportedError("Platform._operatingSystem");
|
||||
}
|
||||
|
||||
@patch
|
||||
static _operatingSystemVersion() {
|
||||
throw new UnsupportedError("Platform._operatingSystemVersion");
|
||||
throw UnsupportedError("Platform._operatingSystemVersion");
|
||||
}
|
||||
|
||||
@patch
|
||||
static _localHostname() {
|
||||
throw new UnsupportedError("Platform._localHostname");
|
||||
throw UnsupportedError("Platform._localHostname");
|
||||
}
|
||||
|
||||
@patch
|
||||
static _executable() {
|
||||
throw new UnsupportedError("Platform._executable");
|
||||
throw UnsupportedError("Platform._executable");
|
||||
}
|
||||
|
||||
@patch
|
||||
static _resolvedExecutable() {
|
||||
throw new UnsupportedError("Platform._resolvedExecutable");
|
||||
throw UnsupportedError("Platform._resolvedExecutable");
|
||||
}
|
||||
|
||||
@patch
|
||||
static List<String> _executableArguments() {
|
||||
throw new UnsupportedError("Platform._executableArguments");
|
||||
throw UnsupportedError("Platform._executableArguments");
|
||||
}
|
||||
|
||||
@patch
|
||||
static String _packageConfig() {
|
||||
throw new UnsupportedError("Platform._packageConfig");
|
||||
throw UnsupportedError("Platform._packageConfig");
|
||||
}
|
||||
|
||||
@patch
|
||||
static _environment() {
|
||||
throw new UnsupportedError("Platform._environment");
|
||||
throw UnsupportedError("Platform._environment");
|
||||
}
|
||||
|
||||
@patch
|
||||
static String _version() {
|
||||
throw new UnsupportedError("Platform._version");
|
||||
throw UnsupportedError("Platform._version");
|
||||
}
|
||||
|
||||
@patch
|
||||
static String _localeName() {
|
||||
throw new UnsupportedError("Platform._localeName");
|
||||
throw UnsupportedError("Platform._localeName");
|
||||
}
|
||||
|
||||
@patch
|
||||
static Uri _script() {
|
||||
throw new UnsupportedError("Platform._script");
|
||||
throw UnsupportedError("Platform._script");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -298,32 +298,32 @@ class _Platform {
|
|||
class _ProcessUtils {
|
||||
@patch
|
||||
static Never _exit(int status) {
|
||||
throw new UnsupportedError("ProcessUtils._exit");
|
||||
throw UnsupportedError("ProcessUtils._exit");
|
||||
}
|
||||
|
||||
@patch
|
||||
static void _setExitCode(int status) {
|
||||
throw new UnsupportedError("ProcessUtils._setExitCode");
|
||||
throw UnsupportedError("ProcessUtils._setExitCode");
|
||||
}
|
||||
|
||||
@patch
|
||||
static int _getExitCode() {
|
||||
throw new UnsupportedError("ProcessUtils._getExitCode");
|
||||
throw UnsupportedError("ProcessUtils._getExitCode");
|
||||
}
|
||||
|
||||
@patch
|
||||
static void _sleep(int millis) {
|
||||
throw new UnsupportedError("ProcessUtils._sleep");
|
||||
throw UnsupportedError("ProcessUtils._sleep");
|
||||
}
|
||||
|
||||
@patch
|
||||
static int _pid(Process? process) {
|
||||
throw new UnsupportedError("ProcessUtils._pid");
|
||||
throw UnsupportedError("ProcessUtils._pid");
|
||||
}
|
||||
|
||||
@patch
|
||||
static Stream<ProcessSignal> _watchSignal(ProcessSignal signal) {
|
||||
throw new UnsupportedError("ProcessUtils._watchSignal");
|
||||
throw UnsupportedError("ProcessUtils._watchSignal");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -331,12 +331,12 @@ class _ProcessUtils {
|
|||
class ProcessInfo {
|
||||
@patch
|
||||
static int get currentRss {
|
||||
throw new UnsupportedError("ProcessInfo.currentRss");
|
||||
throw UnsupportedError("ProcessInfo.currentRss");
|
||||
}
|
||||
|
||||
@patch
|
||||
static int get maxRss {
|
||||
throw new UnsupportedError("ProcessInfo.maxRss");
|
||||
throw UnsupportedError("ProcessInfo.maxRss");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -349,7 +349,7 @@ class Process {
|
|||
bool includeParentEnvironment = true,
|
||||
bool runInShell = false,
|
||||
ProcessStartMode mode = ProcessStartMode.normal}) {
|
||||
throw new UnsupportedError("Process.start");
|
||||
throw UnsupportedError("Process.start");
|
||||
}
|
||||
|
||||
@patch
|
||||
|
@ -360,7 +360,7 @@ class Process {
|
|||
bool runInShell = false,
|
||||
Encoding? stdoutEncoding = systemEncoding,
|
||||
Encoding? stderrEncoding = systemEncoding}) {
|
||||
throw new UnsupportedError("Process.run");
|
||||
throw UnsupportedError("Process.run");
|
||||
}
|
||||
|
||||
@patch
|
||||
|
@ -371,12 +371,12 @@ class Process {
|
|||
bool runInShell = false,
|
||||
Encoding? stdoutEncoding = systemEncoding,
|
||||
Encoding? stderrEncoding = systemEncoding}) {
|
||||
throw new UnsupportedError("Process.runSync");
|
||||
throw UnsupportedError("Process.runSync");
|
||||
}
|
||||
|
||||
@patch
|
||||
static bool killPid(int pid, [ProcessSignal signal = ProcessSignal.sigterm]) {
|
||||
throw new UnsupportedError("Process.killPid");
|
||||
throw UnsupportedError("Process.killPid");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -384,45 +384,45 @@ class Process {
|
|||
class InternetAddress {
|
||||
@patch
|
||||
static InternetAddress get loopbackIPv4 {
|
||||
throw new UnsupportedError("InternetAddress.loopbackIPv4");
|
||||
throw UnsupportedError("InternetAddress.loopbackIPv4");
|
||||
}
|
||||
|
||||
@patch
|
||||
static InternetAddress get loopbackIPv6 {
|
||||
throw new UnsupportedError("InternetAddress.loopbackIPv6");
|
||||
throw UnsupportedError("InternetAddress.loopbackIPv6");
|
||||
}
|
||||
|
||||
@patch
|
||||
static InternetAddress get anyIPv4 {
|
||||
throw new UnsupportedError("InternetAddress.anyIPv4");
|
||||
throw UnsupportedError("InternetAddress.anyIPv4");
|
||||
}
|
||||
|
||||
@patch
|
||||
static InternetAddress get anyIPv6 {
|
||||
throw new UnsupportedError("InternetAddress.anyIPv6");
|
||||
throw UnsupportedError("InternetAddress.anyIPv6");
|
||||
}
|
||||
|
||||
@patch
|
||||
factory InternetAddress(String address, {InternetAddressType? type}) {
|
||||
throw new UnsupportedError("InternetAddress");
|
||||
throw UnsupportedError("InternetAddress");
|
||||
}
|
||||
|
||||
@patch
|
||||
factory InternetAddress.fromRawAddress(Uint8List rawAddress,
|
||||
{InternetAddressType? type}) {
|
||||
throw new UnsupportedError("InternetAddress.fromRawAddress");
|
||||
throw UnsupportedError("InternetAddress.fromRawAddress");
|
||||
}
|
||||
|
||||
@patch
|
||||
static Future<List<InternetAddress>> lookup(String host,
|
||||
{InternetAddressType type = InternetAddressType.any}) {
|
||||
throw new UnsupportedError("InternetAddress.lookup");
|
||||
throw UnsupportedError("InternetAddress.lookup");
|
||||
}
|
||||
|
||||
@patch
|
||||
static InternetAddress _cloneWithNewHost(
|
||||
InternetAddress address, String host) {
|
||||
throw new UnsupportedError("InternetAddress._cloneWithNewHost");
|
||||
throw UnsupportedError("InternetAddress._cloneWithNewHost");
|
||||
}
|
||||
|
||||
@patch
|
||||
|
@ -435,7 +435,7 @@ class InternetAddress {
|
|||
class NetworkInterface {
|
||||
@patch
|
||||
static bool get listSupported {
|
||||
throw new UnsupportedError("NetworkInterface.listSupported");
|
||||
throw UnsupportedError("NetworkInterface.listSupported");
|
||||
}
|
||||
|
||||
@patch
|
||||
|
@ -443,7 +443,7 @@ class NetworkInterface {
|
|||
{bool includeLoopback = false,
|
||||
bool includeLinkLocal = false,
|
||||
InternetAddressType type = InternetAddressType.any}) {
|
||||
throw new UnsupportedError("NetworkInterface.list");
|
||||
throw UnsupportedError("NetworkInterface.list");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -452,7 +452,7 @@ class RawServerSocket {
|
|||
@patch
|
||||
static Future<RawServerSocket> bind(address, int port,
|
||||
{int backlog = 0, bool v6Only = false, bool shared = false}) {
|
||||
throw new UnsupportedError("RawServerSocket.bind");
|
||||
throw UnsupportedError("RawServerSocket.bind");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -461,7 +461,7 @@ class ServerSocket {
|
|||
@patch
|
||||
static Future<ServerSocket> _bind(address, int port,
|
||||
{int backlog = 0, bool v6Only = false, bool shared = false}) {
|
||||
throw new UnsupportedError("ServerSocket.bind");
|
||||
throw UnsupportedError("ServerSocket.bind");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -470,13 +470,13 @@ class RawSocket {
|
|||
@patch
|
||||
static Future<RawSocket> connect(dynamic host, int port,
|
||||
{dynamic sourceAddress, int sourcePort = 0, Duration? timeout}) {
|
||||
throw new UnsupportedError("RawSocket constructor");
|
||||
throw UnsupportedError("RawSocket constructor");
|
||||
}
|
||||
|
||||
@patch
|
||||
static Future<ConnectionTask<RawSocket>> startConnect(dynamic host, int port,
|
||||
{dynamic sourceAddress, int sourcePort = 0}) {
|
||||
throw new UnsupportedError("RawSocket constructor");
|
||||
throw UnsupportedError("RawSocket constructor");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -485,13 +485,13 @@ class Socket {
|
|||
@patch
|
||||
static Future<Socket> _connect(dynamic host, int port,
|
||||
{dynamic sourceAddress, int sourcePort = 0, Duration? timeout}) {
|
||||
throw new UnsupportedError("Socket constructor");
|
||||
throw UnsupportedError("Socket constructor");
|
||||
}
|
||||
|
||||
@patch
|
||||
static Future<ConnectionTask<Socket>> _startConnect(dynamic host, int port,
|
||||
{dynamic sourceAddress, int sourcePort = 0}) {
|
||||
throw new UnsupportedError("Socket constructor");
|
||||
throw UnsupportedError("Socket constructor");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -551,7 +551,7 @@ class ResourceHandle {
|
|||
class SecureSocket {
|
||||
@patch
|
||||
factory SecureSocket._(RawSecureSocket rawSocket) {
|
||||
throw new UnsupportedError("SecureSocket constructor");
|
||||
throw UnsupportedError("SecureSocket constructor");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -559,7 +559,7 @@ class SecureSocket {
|
|||
class RawSynchronousSocket {
|
||||
@patch
|
||||
static RawSynchronousSocket connectSync(dynamic host, int port) {
|
||||
throw new UnsupportedError("RawSynchronousSocket.connectSync");
|
||||
throw UnsupportedError("RawSynchronousSocket.connectSync");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -575,17 +575,17 @@ class RawSocketOption {
|
|||
class SecurityContext {
|
||||
@patch
|
||||
factory SecurityContext({bool withTrustedRoots = false}) {
|
||||
throw new UnsupportedError("SecurityContext constructor");
|
||||
throw UnsupportedError("SecurityContext constructor");
|
||||
}
|
||||
|
||||
@patch
|
||||
static SecurityContext get defaultContext {
|
||||
throw new UnsupportedError("default SecurityContext getter");
|
||||
throw UnsupportedError("default SecurityContext getter");
|
||||
}
|
||||
|
||||
@patch
|
||||
static bool get alpnSupported {
|
||||
throw new UnsupportedError("SecurityContext alpnSupported getter");
|
||||
throw UnsupportedError("SecurityContext alpnSupported getter");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -593,7 +593,7 @@ class SecurityContext {
|
|||
class X509Certificate {
|
||||
@patch
|
||||
factory X509Certificate._() {
|
||||
throw new UnsupportedError("X509Certificate constructor");
|
||||
throw UnsupportedError("X509Certificate constructor");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -602,7 +602,7 @@ class RawDatagramSocket {
|
|||
@patch
|
||||
static Future<RawDatagramSocket> bind(dynamic host, int port,
|
||||
{bool reuseAddress = true, bool reusePort = false, int ttl = 1}) {
|
||||
throw new UnsupportedError("RawDatagramSocket.bind");
|
||||
throw UnsupportedError("RawDatagramSocket.bind");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -610,7 +610,7 @@ class RawDatagramSocket {
|
|||
class _SecureFilter {
|
||||
@patch
|
||||
factory _SecureFilter._() {
|
||||
throw new UnsupportedError("_SecureFilter._SecureFilter");
|
||||
throw UnsupportedError("_SecureFilter._SecureFilter");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -618,22 +618,22 @@ class _SecureFilter {
|
|||
class _StdIOUtils {
|
||||
@patch
|
||||
static Stdin _getStdioInputStream(int fd) {
|
||||
throw new UnsupportedError("StdIOUtils._getStdioInputStream");
|
||||
throw UnsupportedError("StdIOUtils._getStdioInputStream");
|
||||
}
|
||||
|
||||
@patch
|
||||
static _getStdioOutputStream(int fd) {
|
||||
throw new UnsupportedError("StdIOUtils._getStdioOutputStream");
|
||||
throw UnsupportedError("StdIOUtils._getStdioOutputStream");
|
||||
}
|
||||
|
||||
@patch
|
||||
static int _socketType(Socket socket) {
|
||||
throw new UnsupportedError("StdIOUtils._socketType");
|
||||
throw UnsupportedError("StdIOUtils._socketType");
|
||||
}
|
||||
|
||||
@patch
|
||||
static _getStdioHandleType(int fd) {
|
||||
throw new UnsupportedError("StdIOUtils._getStdioHandleType");
|
||||
throw UnsupportedError("StdIOUtils._getStdioHandleType");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -641,7 +641,7 @@ class _StdIOUtils {
|
|||
class _WindowsCodePageDecoder {
|
||||
@patch
|
||||
static String _decodeBytes(List<int> bytes) {
|
||||
throw new UnsupportedError("_WindowsCodePageDecoder._decodeBytes");
|
||||
throw UnsupportedError("_WindowsCodePageDecoder._decodeBytes");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -649,7 +649,7 @@ class _WindowsCodePageDecoder {
|
|||
class _WindowsCodePageEncoder {
|
||||
@patch
|
||||
static List<int> _encodeString(String string) {
|
||||
throw new UnsupportedError("_WindowsCodePageEncoder._encodeString");
|
||||
throw UnsupportedError("_WindowsCodePageEncoder._encodeString");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -664,13 +664,13 @@ class RawZLibFilter {
|
|||
int strategy,
|
||||
List<int>? dictionary,
|
||||
bool raw) {
|
||||
throw new UnsupportedError("_newZLibDeflateFilter");
|
||||
throw UnsupportedError("_newZLibDeflateFilter");
|
||||
}
|
||||
|
||||
@patch
|
||||
static RawZLibFilter _makeZLibInflateFilter(
|
||||
int windowBits, List<int>? dictionary, bool raw) {
|
||||
throw new UnsupportedError("_newZLibInflateFilter");
|
||||
throw UnsupportedError("_newZLibInflateFilter");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -678,17 +678,17 @@ class RawZLibFilter {
|
|||
class Stdin {
|
||||
@patch
|
||||
int readByteSync() {
|
||||
throw new UnsupportedError("Stdin.readByteSync");
|
||||
throw UnsupportedError("Stdin.readByteSync");
|
||||
}
|
||||
|
||||
@patch
|
||||
bool get echoMode {
|
||||
throw new UnsupportedError("Stdin.echoMode");
|
||||
throw UnsupportedError("Stdin.echoMode");
|
||||
}
|
||||
|
||||
@patch
|
||||
void set echoMode(bool enabled) {
|
||||
throw new UnsupportedError("Stdin.echoMode");
|
||||
throw UnsupportedError("Stdin.echoMode");
|
||||
}
|
||||
|
||||
@patch
|
||||
|
@ -703,17 +703,17 @@ class Stdin {
|
|||
|
||||
@patch
|
||||
bool get lineMode {
|
||||
throw new UnsupportedError("Stdin.lineMode");
|
||||
throw UnsupportedError("Stdin.lineMode");
|
||||
}
|
||||
|
||||
@patch
|
||||
void set lineMode(bool enabled) {
|
||||
throw new UnsupportedError("Stdin.lineMode");
|
||||
throw UnsupportedError("Stdin.lineMode");
|
||||
}
|
||||
|
||||
@patch
|
||||
bool get supportsAnsiEscapes {
|
||||
throw new UnsupportedError("Stdin.supportsAnsiEscapes");
|
||||
throw UnsupportedError("Stdin.supportsAnsiEscapes");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -721,22 +721,22 @@ class Stdin {
|
|||
class Stdout {
|
||||
@patch
|
||||
bool _hasTerminal(int fd) {
|
||||
throw new UnsupportedError("Stdout.hasTerminal");
|
||||
throw UnsupportedError("Stdout.hasTerminal");
|
||||
}
|
||||
|
||||
@patch
|
||||
int _terminalColumns(int fd) {
|
||||
throw new UnsupportedError("Stdout.terminalColumns");
|
||||
throw UnsupportedError("Stdout.terminalColumns");
|
||||
}
|
||||
|
||||
@patch
|
||||
int _terminalLines(int fd) {
|
||||
throw new UnsupportedError("Stdout.terminalLines");
|
||||
throw UnsupportedError("Stdout.terminalLines");
|
||||
}
|
||||
|
||||
@patch
|
||||
static bool _supportsAnsiEscapes(int fd) {
|
||||
throw new UnsupportedError("Stdout.supportsAnsiEscapes");
|
||||
throw UnsupportedError("Stdout.supportsAnsiEscapes");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -745,12 +745,12 @@ class _FileSystemWatcher {
|
|||
@patch
|
||||
static Stream<FileSystemEvent> _watch(
|
||||
String path, int events, bool recursive) {
|
||||
throw new UnsupportedError("_FileSystemWatcher.watch");
|
||||
throw UnsupportedError("_FileSystemWatcher.watch");
|
||||
}
|
||||
|
||||
@patch
|
||||
static bool get isSupported {
|
||||
throw new UnsupportedError("_FileSystemWatcher.isSupported");
|
||||
throw UnsupportedError("_FileSystemWatcher.isSupported");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -758,6 +758,6 @@ class _FileSystemWatcher {
|
|||
class _IOService {
|
||||
@patch
|
||||
static Future _dispatch(int request, List data) {
|
||||
throw new UnsupportedError("_IOService._dispatch");
|
||||
throw UnsupportedError("_IOService._dispatch");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,32 +13,32 @@ import "dart:typed_data" show TypedData;
|
|||
class Isolate {
|
||||
@patch
|
||||
static Isolate get current {
|
||||
throw new UnsupportedError("Isolate.current");
|
||||
throw UnsupportedError("Isolate.current");
|
||||
}
|
||||
|
||||
@patch
|
||||
String? get debugName {
|
||||
throw new UnsupportedError("Isolate.debugName");
|
||||
throw UnsupportedError("Isolate.debugName");
|
||||
}
|
||||
|
||||
@patch
|
||||
static Future<Uri?> get packageConfig {
|
||||
throw new UnsupportedError("Isolate.packageConfig");
|
||||
throw UnsupportedError("Isolate.packageConfig");
|
||||
}
|
||||
|
||||
@patch
|
||||
static Uri? get packageConfigSync {
|
||||
throw new UnsupportedError("Isolate.packageConfigSync");
|
||||
throw UnsupportedError("Isolate.packageConfigSync");
|
||||
}
|
||||
|
||||
@patch
|
||||
static Future<Uri?> resolvePackageUri(Uri packageUri) {
|
||||
throw new UnsupportedError("Isolate.resolvePackageUri");
|
||||
throw UnsupportedError("Isolate.resolvePackageUri");
|
||||
}
|
||||
|
||||
@patch
|
||||
static Uri? resolvePackageUriSync(Uri packageUri) {
|
||||
throw new UnsupportedError("Isolate.resolvePackageUriSync");
|
||||
throw UnsupportedError("Isolate.resolvePackageUriSync");
|
||||
}
|
||||
|
||||
@patch
|
||||
|
@ -48,7 +48,7 @@ class Isolate {
|
|||
SendPort? onExit,
|
||||
SendPort? onError,
|
||||
String? debugName}) {
|
||||
throw new UnsupportedError("Isolate.spawn");
|
||||
throw UnsupportedError("Isolate.spawn");
|
||||
}
|
||||
|
||||
@patch
|
||||
|
@ -63,58 +63,58 @@ class Isolate {
|
|||
Uri? packageConfig,
|
||||
bool automaticPackageResolution = false,
|
||||
String? debugName}) {
|
||||
throw new UnsupportedError("Isolate.spawnUri");
|
||||
throw UnsupportedError("Isolate.spawnUri");
|
||||
}
|
||||
|
||||
@patch
|
||||
void _pause(Capability resumeCapability) {
|
||||
throw new UnsupportedError("Isolate._pause");
|
||||
throw UnsupportedError("Isolate._pause");
|
||||
}
|
||||
|
||||
@patch
|
||||
void resume(Capability resumeCapability) {
|
||||
throw new UnsupportedError("Isolate.resume");
|
||||
throw UnsupportedError("Isolate.resume");
|
||||
}
|
||||
|
||||
@patch
|
||||
void addOnExitListener(SendPort responsePort, {Object? response}) {
|
||||
throw new UnsupportedError("Isolate.addOnExitListener");
|
||||
throw UnsupportedError("Isolate.addOnExitListener");
|
||||
}
|
||||
|
||||
@patch
|
||||
void removeOnExitListener(SendPort responsePort) {
|
||||
throw new UnsupportedError("Isolate.removeOnExitListener");
|
||||
throw UnsupportedError("Isolate.removeOnExitListener");
|
||||
}
|
||||
|
||||
@patch
|
||||
void setErrorsFatal(bool errorsAreFatal) {
|
||||
throw new UnsupportedError("Isolate.setErrorsFatal");
|
||||
throw UnsupportedError("Isolate.setErrorsFatal");
|
||||
}
|
||||
|
||||
@patch
|
||||
void kill({int priority = beforeNextEvent}) {
|
||||
throw new UnsupportedError("Isolate.kill");
|
||||
throw UnsupportedError("Isolate.kill");
|
||||
}
|
||||
|
||||
@patch
|
||||
void ping(SendPort responsePort,
|
||||
{Object? response, int priority = immediate}) {
|
||||
throw new UnsupportedError("Isolate.ping");
|
||||
throw UnsupportedError("Isolate.ping");
|
||||
}
|
||||
|
||||
@patch
|
||||
void addErrorListener(SendPort port) {
|
||||
throw new UnsupportedError("Isolate.addErrorListener");
|
||||
throw UnsupportedError("Isolate.addErrorListener");
|
||||
}
|
||||
|
||||
@patch
|
||||
void removeErrorListener(SendPort port) {
|
||||
throw new UnsupportedError("Isolate.removeErrorListener");
|
||||
throw UnsupportedError("Isolate.removeErrorListener");
|
||||
}
|
||||
|
||||
@patch
|
||||
static Never exit([SendPort? finalMessagePort, Object? message]) {
|
||||
throw new UnsupportedError("Isolate.exit");
|
||||
throw UnsupportedError("Isolate.exit");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -125,7 +125,7 @@ class ReceivePort {
|
|||
|
||||
@patch
|
||||
factory ReceivePort.fromRawReceivePort(RawReceivePort rawPort) {
|
||||
throw new UnsupportedError('new ReceivePort.fromRawReceivePort');
|
||||
throw UnsupportedError('new ReceivePort.fromRawReceivePort');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -136,19 +136,19 @@ class _ReceivePortImpl extends Stream implements ReceivePort {
|
|||
{Function? onError,
|
||||
void Function()? onDone,
|
||||
bool? cancelOnError = true}) {
|
||||
throw new UnsupportedError("ReceivePort.listen");
|
||||
throw UnsupportedError("ReceivePort.listen");
|
||||
}
|
||||
|
||||
void close() {}
|
||||
|
||||
SendPort get sendPort => throw new UnsupportedError("ReceivePort.sendPort");
|
||||
SendPort get sendPort => throw UnsupportedError("ReceivePort.sendPort");
|
||||
}
|
||||
|
||||
@patch
|
||||
class RawReceivePort {
|
||||
@patch
|
||||
factory RawReceivePort([Function? handler, String debugName = '']) {
|
||||
throw new UnsupportedError('new RawReceivePort');
|
||||
throw UnsupportedError('new RawReceivePort');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -156,7 +156,7 @@ class RawReceivePort {
|
|||
class Capability {
|
||||
@patch
|
||||
factory Capability() {
|
||||
throw new UnsupportedError('new Capability');
|
||||
throw UnsupportedError('new Capability');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -164,6 +164,6 @@ class Capability {
|
|||
abstract class TransferableTypedData {
|
||||
@patch
|
||||
factory TransferableTypedData.fromList(List<TypedData> list) {
|
||||
throw new UnsupportedError('TransferableTypedData.fromList');
|
||||
throw UnsupportedError('TransferableTypedData.fromList');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ class _Growable {
|
|||
const _Growable();
|
||||
}
|
||||
|
||||
const _ListConstructorSentinel = const _Growable();
|
||||
const _ListConstructorSentinel = _Growable();
|
||||
|
||||
/// The interceptor class for [List]. The compiler recognizes this
|
||||
/// class as an interceptor, and changes references to [:this:] to
|
||||
|
@ -27,16 +27,16 @@ class JSArray<E> extends JavaScriptObject implements List<E>, JSIndexable<E> {
|
|||
// in unchecked mode, and against `new Array(null)` which creates a single
|
||||
// element Array containing `null`.
|
||||
if (length is! int) {
|
||||
throw new ArgumentError.value(length, 'length', 'is not an integer');
|
||||
throw ArgumentError.value(length, 'length', 'is not an integer');
|
||||
}
|
||||
// The JavaScript Array constructor with one argument throws if the value is
|
||||
// not a UInt32 but the error message does not contain the bad value. Give a
|
||||
// better error message.
|
||||
int maxJSArrayLength = 0xFFFFFFFF;
|
||||
if (length < 0 || length > maxJSArrayLength) {
|
||||
throw new RangeError.range(length, 0, maxJSArrayLength, 'length');
|
||||
throw RangeError.range(length, 0, maxJSArrayLength, 'length');
|
||||
}
|
||||
return new JSArray<E>.markFixed(JS('', 'new Array(#)', length));
|
||||
return JSArray<E>.markFixed(JS('', 'new Array(#)', length));
|
||||
}
|
||||
|
||||
/// Returns a fresh JavaScript Array, marked as fixed-length. The Array is
|
||||
|
@ -52,20 +52,20 @@ class JSArray<E> extends JavaScriptObject implements List<E>, JSIndexable<E> {
|
|||
// in unchecked mode, and against `new Array(null)` which creates a single
|
||||
// element Array containing `null`.
|
||||
if (length is! int) {
|
||||
throw new ArgumentError.value(length, 'length', 'is not an integer');
|
||||
throw ArgumentError.value(length, 'length', 'is not an integer');
|
||||
}
|
||||
// The JavaScript Array constructor with one argument throws if the value is
|
||||
// not a UInt32 but the error message does not contain the bad value. Give a
|
||||
// better error message.
|
||||
int maxJSArrayLength = 0xFFFFFFFF;
|
||||
if (length < 0 || length > maxJSArrayLength) {
|
||||
throw new RangeError.range(length, 0, maxJSArrayLength, 'length');
|
||||
throw RangeError.range(length, 0, maxJSArrayLength, 'length');
|
||||
}
|
||||
return new JSArray<E>.markFixed(JS('', 'new Array(#)', length));
|
||||
return JSArray<E>.markFixed(JS('', 'new Array(#)', length));
|
||||
}
|
||||
|
||||
/// Returns a fresh growable JavaScript Array of zero length length.
|
||||
factory JSArray.emptyGrowable() => new JSArray<E>.markGrowable(JS('', '[]'));
|
||||
factory JSArray.emptyGrowable() => JSArray<E>.markGrowable(JS('', '[]'));
|
||||
|
||||
/// Returns a fresh growable JavaScript Array with initial length. The holes
|
||||
/// in the array yield `undefined`, making the Dart List appear to be filled
|
||||
|
@ -76,9 +76,9 @@ class JSArray<E> extends JavaScriptObject implements List<E>, JSIndexable<E> {
|
|||
// Explicit type test is necessary to guard against JavaScript conversions
|
||||
// in unchecked mode.
|
||||
if ((length is! int) || (length < 0)) {
|
||||
throw new ArgumentError('Length must be a non-negative integer: $length');
|
||||
throw ArgumentError('Length must be a non-negative integer: $length');
|
||||
}
|
||||
return new JSArray<E>.markGrowable(JS('', 'new Array(#)', length));
|
||||
return JSArray<E>.markGrowable(JS('', 'new Array(#)', length));
|
||||
}
|
||||
|
||||
/// Returns a fresh growable JavaScript Array with initial length. The Array
|
||||
|
@ -93,9 +93,9 @@ class JSArray<E> extends JavaScriptObject implements List<E>, JSIndexable<E> {
|
|||
// Explicit type test is necessary to guard against JavaScript conversions
|
||||
// in unchecked mode.
|
||||
if ((length is! int) || (length < 0)) {
|
||||
throw new ArgumentError('Length must be a non-negative integer: $length');
|
||||
throw ArgumentError('Length must be a non-negative integer: $length');
|
||||
}
|
||||
return new JSArray<E>.markGrowable(JS('', 'new Array(#)', length));
|
||||
return JSArray<E>.markGrowable(JS('', 'new Array(#)', length));
|
||||
}
|
||||
|
||||
/// Constructor for adding type parameters to an existing JavaScript Array.
|
||||
|
@ -113,10 +113,10 @@ class JSArray<E> extends JavaScriptObject implements List<E>, JSIndexable<E> {
|
|||
factory JSArray.typed(allocation) => JS('JSArray', '#', allocation);
|
||||
|
||||
factory JSArray.markFixed(allocation) =>
|
||||
JS('JSFixedArray', '#', markFixedList(new JSArray<E>.typed(allocation)));
|
||||
JS('JSFixedArray', '#', markFixedList(JSArray<E>.typed(allocation)));
|
||||
|
||||
factory JSArray.markGrowable(allocation) =>
|
||||
JS('JSExtendableArray', '#', new JSArray<E>.typed(allocation));
|
||||
JS('JSExtendableArray', '#', JSArray<E>.typed(allocation));
|
||||
|
||||
static List<T> markFixedList<T>(List<T> list) {
|
||||
// Functions are stored in the hidden class and not as properties in
|
||||
|
@ -173,7 +173,7 @@ class JSArray<E> extends JavaScriptObject implements List<E>, JSIndexable<E> {
|
|||
checkGrowable('removeAt');
|
||||
if (index is! int) throw argumentErrorValue(index);
|
||||
if (index < 0 || index >= length) {
|
||||
throw new RangeError.value(index);
|
||||
throw RangeError.value(index);
|
||||
}
|
||||
return JS('', r'#.splice(#, 1)[0]', this, index);
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ class JSArray<E> extends JavaScriptObject implements List<E>, JSIndexable<E> {
|
|||
checkGrowable('insert');
|
||||
if (index is! int) throw argumentErrorValue(index);
|
||||
if (index < 0 || index > length) {
|
||||
throw new RangeError.value(index);
|
||||
throw RangeError.value(index);
|
||||
}
|
||||
JS('void', r'#.splice(#, 0, #)', this, index, value);
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ class JSArray<E> extends JavaScriptObject implements List<E>, JSIndexable<E> {
|
|||
if (!test(element) == removeMatching) {
|
||||
retained.add(element);
|
||||
}
|
||||
if (this.length != end) throw new ConcurrentModificationError(this);
|
||||
if (this.length != end) throw ConcurrentModificationError(this);
|
||||
}
|
||||
if (retained.length == end) return;
|
||||
this.length = retained.length;
|
||||
|
@ -265,11 +265,11 @@ class JSArray<E> extends JavaScriptObject implements List<E>, JSIndexable<E> {
|
|||
}
|
||||
|
||||
Iterable<E> where(bool f(E element)) {
|
||||
return new WhereIterable<E>(this, f);
|
||||
return WhereIterable<E>(this, f);
|
||||
}
|
||||
|
||||
Iterable<T> expand<T>(Iterable<T> f(E element)) {
|
||||
return new ExpandIterable<E, T>(this, f);
|
||||
return ExpandIterable<E, T>(this, f);
|
||||
}
|
||||
|
||||
void addAll(Iterable<E> collection) {
|
||||
|
@ -311,12 +311,12 @@ class JSArray<E> extends JavaScriptObject implements List<E>, JSIndexable<E> {
|
|||
// be replaced by indexing.
|
||||
var element = JS<E>('', '#[#]', this, i);
|
||||
f(element);
|
||||
if (this.length != end) throw new ConcurrentModificationError(this);
|
||||
if (this.length != end) throw ConcurrentModificationError(this);
|
||||
}
|
||||
}
|
||||
|
||||
Iterable<T> map<T>(T f(E element)) {
|
||||
return new MappedListIterable<E, T>(this, f);
|
||||
return MappedListIterable<E, T>(this, f);
|
||||
}
|
||||
|
||||
String join([String separator = '']) {
|
||||
|
@ -328,19 +328,19 @@ class JSArray<E> extends JavaScriptObject implements List<E>, JSIndexable<E> {
|
|||
}
|
||||
|
||||
Iterable<E> take(int n) {
|
||||
return new SubListIterable<E>(this, 0, checkNotNullable(n, "count"));
|
||||
return SubListIterable<E>(this, 0, checkNotNullable(n, "count"));
|
||||
}
|
||||
|
||||
Iterable<E> takeWhile(bool test(E value)) {
|
||||
return new TakeWhileIterable<E>(this, test);
|
||||
return TakeWhileIterable<E>(this, test);
|
||||
}
|
||||
|
||||
Iterable<E> skip(int n) {
|
||||
return new SubListIterable<E>(this, n, null);
|
||||
return SubListIterable<E>(this, n, null);
|
||||
}
|
||||
|
||||
Iterable<E> skipWhile(bool test(E value)) {
|
||||
return new SkipWhileIterable<E>(this, test);
|
||||
return SkipWhileIterable<E>(this, test);
|
||||
}
|
||||
|
||||
E reduce(E combine(E previousValue, E element)) {
|
||||
|
@ -352,7 +352,7 @@ class JSArray<E> extends JavaScriptObject implements List<E>, JSIndexable<E> {
|
|||
// be replaced by indexing.
|
||||
var element = JS<E>('', '#[#]', this, i);
|
||||
value = combine(value, element);
|
||||
if (length != this.length) throw new ConcurrentModificationError(this);
|
||||
if (length != this.length) throw ConcurrentModificationError(this);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
@ -365,7 +365,7 @@ class JSArray<E> extends JavaScriptObject implements List<E>, JSIndexable<E> {
|
|||
// be replaced by indexing.
|
||||
var element = JS<E>('', '#[#]', this, i);
|
||||
value = combine(value, element);
|
||||
if (this.length != length) throw new ConcurrentModificationError(this);
|
||||
if (this.length != length) throw ConcurrentModificationError(this);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
@ -377,7 +377,7 @@ class JSArray<E> extends JavaScriptObject implements List<E>, JSIndexable<E> {
|
|||
// be replaced by indexing.
|
||||
var element = JS<E>('', '#[#]', this, i);
|
||||
if (test(element)) return element;
|
||||
if (this.length != end) throw new ConcurrentModificationError(this);
|
||||
if (this.length != end) throw ConcurrentModificationError(this);
|
||||
}
|
||||
if (orElse != null) return orElse();
|
||||
throw IterableElementError.noElement();
|
||||
|
@ -391,7 +391,7 @@ class JSArray<E> extends JavaScriptObject implements List<E>, JSIndexable<E> {
|
|||
var element = JS<E>('', '#[#]', this, i);
|
||||
if (test(element)) return element;
|
||||
if (length != this.length) {
|
||||
throw new ConcurrentModificationError(this);
|
||||
throw ConcurrentModificationError(this);
|
||||
}
|
||||
}
|
||||
if (orElse != null) return orElse();
|
||||
|
@ -414,7 +414,7 @@ class JSArray<E> extends JavaScriptObject implements List<E>, JSIndexable<E> {
|
|||
match = element;
|
||||
}
|
||||
if (length != this.length) {
|
||||
throw new ConcurrentModificationError(this);
|
||||
throw ConcurrentModificationError(this);
|
||||
}
|
||||
}
|
||||
if (matchFound) return match as E;
|
||||
|
@ -430,24 +430,23 @@ class JSArray<E> extends JavaScriptObject implements List<E>, JSIndexable<E> {
|
|||
checkNull(start); // TODO(ahe): This is not specified but co19 tests it.
|
||||
if (start is! int) throw argumentErrorValue(start);
|
||||
if (start < 0 || start > length) {
|
||||
throw new RangeError.range(start, 0, length, 'start');
|
||||
throw RangeError.range(start, 0, length, 'start');
|
||||
}
|
||||
if (end == null) {
|
||||
end = length;
|
||||
} else {
|
||||
if (end is! int) throw argumentErrorValue(end);
|
||||
if (end < start || end > length) {
|
||||
throw new RangeError.range(end, start, length, 'end');
|
||||
throw RangeError.range(end, start, length, 'end');
|
||||
}
|
||||
}
|
||||
if (start == end) return <E>[];
|
||||
return new JSArray<E>.markGrowable(
|
||||
JS('', r'#.slice(#, #)', this, start, end));
|
||||
return JSArray<E>.markGrowable(JS('', r'#.slice(#, #)', this, start, end));
|
||||
}
|
||||
|
||||
Iterable<E> getRange(int start, int end) {
|
||||
RangeError.checkValidRange(start, end, this.length);
|
||||
return new SubListIterable<E>(this, start, end);
|
||||
return SubListIterable<E>(this, start, end);
|
||||
}
|
||||
|
||||
E get first {
|
||||
|
@ -558,7 +557,7 @@ class JSArray<E> extends JavaScriptObject implements List<E>, JSIndexable<E> {
|
|||
// be replaced by indexing.
|
||||
var element = JS<E>('', '#[#]', this, i);
|
||||
if (test(element)) return true;
|
||||
if (this.length != end) throw new ConcurrentModificationError(this);
|
||||
if (this.length != end) throw ConcurrentModificationError(this);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -570,12 +569,12 @@ class JSArray<E> extends JavaScriptObject implements List<E>, JSIndexable<E> {
|
|||
// be replaced by indexing.
|
||||
var element = JS<E>('', '#[#]', this, i);
|
||||
if (!test(element)) return false;
|
||||
if (this.length != end) throw new ConcurrentModificationError(this);
|
||||
if (this.length != end) throw ConcurrentModificationError(this);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Iterable<E> get reversed => new ReversedListIterable<E>(this);
|
||||
Iterable<E> get reversed => ReversedListIterable<E>(this);
|
||||
|
||||
void sort([int Function(E, E)? compare]) {
|
||||
checkMutable('sort');
|
||||
|
@ -673,7 +672,7 @@ class JSArray<E> extends JavaScriptObject implements List<E>, JSIndexable<E> {
|
|||
|
||||
void shuffle([Random? random]) {
|
||||
checkMutable('shuffle');
|
||||
if (random == null) random = new Random();
|
||||
if (random == null) random = Random();
|
||||
int length = this.length;
|
||||
while (length > 1) {
|
||||
int pos = random.nextInt(length);
|
||||
|
@ -735,14 +734,13 @@ class JSArray<E> extends JavaScriptObject implements List<E>, JSIndexable<E> {
|
|||
|
||||
List<E> _toListGrowable() =>
|
||||
// slice(0) is slightly faster than slice()
|
||||
new JSArray<E>.markGrowable(JS('', '#.slice(0)', this));
|
||||
JSArray<E>.markGrowable(JS('', '#.slice(0)', this));
|
||||
|
||||
List<E> _toListFixed() =>
|
||||
new JSArray<E>.markFixed(JS('', '#.slice(0)', this));
|
||||
List<E> _toListFixed() => JSArray<E>.markFixed(JS('', '#.slice(0)', this));
|
||||
|
||||
Set<E> toSet() => new Set<E>.from(this);
|
||||
Set<E> toSet() => Set<E>.from(this);
|
||||
|
||||
Iterator<E> get iterator => new ArrayIterator<E>(this);
|
||||
Iterator<E> get iterator => ArrayIterator<E>(this);
|
||||
|
||||
int get hashCode => Primitives.objectHashCode(this);
|
||||
|
||||
|
@ -751,11 +749,11 @@ class JSArray<E> extends JavaScriptObject implements List<E>, JSIndexable<E> {
|
|||
set length(int newLength) {
|
||||
checkGrowable('set length');
|
||||
if (newLength is! int) {
|
||||
throw new ArgumentError.value(newLength, 'newLength');
|
||||
throw ArgumentError.value(newLength, 'newLength');
|
||||
}
|
||||
// TODO(sra): Remove this test and let JavaScript throw an error.
|
||||
if (newLength < 0) {
|
||||
throw new RangeError.range(newLength, 0, null, 'newLength');
|
||||
throw RangeError.range(newLength, 0, null, 'newLength');
|
||||
}
|
||||
|
||||
// Verify that element type is nullable.
|
||||
|
@ -774,11 +772,10 @@ class JSArray<E> extends JavaScriptObject implements List<E>, JSIndexable<E> {
|
|||
///
|
||||
/// Should only be called when the list is already known to be growable.
|
||||
void _setLengthUnsafe(int newLength) {
|
||||
assert(newLength is int,
|
||||
throw new ArgumentError.value(newLength, 'newLength'));
|
||||
assert(newLength is int, throw ArgumentError.value(newLength, 'newLength'));
|
||||
|
||||
assert(newLength >= 0,
|
||||
throw new RangeError.range(newLength, 0, null, 'newLength'));
|
||||
throw RangeError.range(newLength, 0, null, 'newLength'));
|
||||
|
||||
// JavaScript with throw a RangeError for numbers that are too big. The
|
||||
// message does not contain the value.
|
||||
|
@ -801,13 +798,13 @@ class JSArray<E> extends JavaScriptObject implements List<E>, JSIndexable<E> {
|
|||
}
|
||||
|
||||
Map<int, E> asMap() {
|
||||
return new ListMapView<E>(this);
|
||||
return ListMapView<E>(this);
|
||||
}
|
||||
|
||||
Iterable<E> followedBy(Iterable<E> other) =>
|
||||
new FollowedByIterable<E>.firstEfficient(this, other);
|
||||
FollowedByIterable<E>.firstEfficient(this, other);
|
||||
|
||||
Iterable<T> whereType<T>() => new WhereTypeIterable<T>(this);
|
||||
Iterable<T> whereType<T>() => WhereTypeIterable<T>(this);
|
||||
|
||||
List<E> operator +(List<E> other) => [...this, ...other];
|
||||
|
||||
|
|
|
@ -160,18 +160,18 @@ createInvocationMirror(
|
|||
String name, internalName, kind, arguments, argumentNames, types) {
|
||||
// TODO(sra): [types] (the number of type arguments) could be omitted in the
|
||||
// generated stub code to save an argument. Then we would use `types ?? 0`.
|
||||
return new JSInvocationMirror(
|
||||
return JSInvocationMirror(
|
||||
name, internalName, kind, arguments, argumentNames, types);
|
||||
}
|
||||
|
||||
createUnmangledInvocationMirror(
|
||||
Symbol symbol, internalName, kind, arguments, argumentNames, types) {
|
||||
return new JSInvocationMirror(
|
||||
return JSInvocationMirror(
|
||||
symbol, internalName, kind, arguments, argumentNames, types);
|
||||
}
|
||||
|
||||
void throwInvalidReflectionError(String memberName) {
|
||||
throw new UnsupportedError("Can't use '$memberName' in reflection.");
|
||||
throw UnsupportedError("Can't use '$memberName' in reflection.");
|
||||
}
|
||||
|
||||
/// Helper used to instrument calls when the compiler is invoked with
|
||||
|
@ -231,7 +231,7 @@ class JSInvocationMirror implements Invocation {
|
|||
|
||||
Symbol get memberName {
|
||||
if (_memberName is Symbol) return _memberName;
|
||||
return _memberName = new _symbol_dev.Symbol.unvalidated(_memberName);
|
||||
return _memberName = _symbol_dev.Symbol.unvalidated(_memberName);
|
||||
}
|
||||
|
||||
bool get isMethod => _kind == METHOD;
|
||||
|
@ -267,12 +267,12 @@ class JSInvocationMirror implements Invocation {
|
|||
int namedArgumentsStartIndex =
|
||||
_arguments.length - namedArgumentCount - _typeArgumentCount;
|
||||
if (namedArgumentCount == 0) return const <Symbol, dynamic>{};
|
||||
var map = new Map<Symbol, dynamic>();
|
||||
var map = Map<Symbol, dynamic>();
|
||||
for (int i = 0; i < namedArgumentCount; i++) {
|
||||
map[new _symbol_dev.Symbol.unvalidated(_namedArgumentNames[i])] =
|
||||
map[_symbol_dev.Symbol.unvalidated(_namedArgumentNames[i])] =
|
||||
_arguments[namedArgumentsStartIndex + i];
|
||||
}
|
||||
return new ConstantMapView<Symbol, dynamic>(map);
|
||||
return ConstantMapView<Symbol, dynamic>(map);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -321,10 +321,10 @@ class Primitives {
|
|||
}
|
||||
|
||||
if (radix is! int) {
|
||||
throw new ArgumentError.value(radix, 'radix', 'is not an integer');
|
||||
throw ArgumentError.value(radix, 'radix', 'is not an integer');
|
||||
}
|
||||
if (radix < 2 || radix > 36) {
|
||||
throw new RangeError.range(radix, 2, 36, 'radix');
|
||||
throw RangeError.range(radix, 2, 36, 'radix');
|
||||
}
|
||||
if (radix == 10 && decimalMatch != null) {
|
||||
// Cannot fail because we know that the digits are all decimal.
|
||||
|
@ -630,7 +630,7 @@ class Primitives {
|
|||
'String.fromCharCode(#, #)', high, low);
|
||||
}
|
||||
}
|
||||
throw new RangeError.range(charCode, 0, 0x10ffff);
|
||||
throw RangeError.range(charCode, 0, 0x10ffff);
|
||||
}
|
||||
|
||||
static String stringConcatUnchecked(String string1, String string2) {
|
||||
|
@ -1116,17 +1116,17 @@ ioore(receiver, index) {
|
|||
/// describes the problem.
|
||||
@pragma('dart2js:noInline')
|
||||
Error diagnoseIndexError(indexable, index) {
|
||||
if (index is! int) return new ArgumentError.value(index, 'index');
|
||||
if (index is! int) return ArgumentError.value(index, 'index');
|
||||
int length = indexable.length;
|
||||
// The following returns the same error that would be thrown by calling
|
||||
// [IndexError.check] with no optional parameters
|
||||
// provided.
|
||||
if (index < 0 || index >= length) {
|
||||
return new IndexError.withLength(index, length,
|
||||
return IndexError.withLength(index, length,
|
||||
indexable: indexable, name: 'index');
|
||||
}
|
||||
// The above should always match, but if it does not, use the following.
|
||||
return new RangeError.value(index, 'index');
|
||||
return RangeError.value(index, 'index');
|
||||
}
|
||||
|
||||
/// Diagnoses a range error. Returns the ArgumentError or RangeError that
|
||||
|
@ -1134,21 +1134,21 @@ Error diagnoseIndexError(indexable, index) {
|
|||
@pragma('dart2js:noInline')
|
||||
Error diagnoseRangeError(start, end, length) {
|
||||
if (start is! int) {
|
||||
return new ArgumentError.value(start, 'start');
|
||||
return ArgumentError.value(start, 'start');
|
||||
}
|
||||
if (start < 0 || start > length) {
|
||||
return new RangeError.range(start, 0, length, 'start');
|
||||
return RangeError.range(start, 0, length, 'start');
|
||||
}
|
||||
if (end != null) {
|
||||
if (end is! int) {
|
||||
return new ArgumentError.value(end, 'end');
|
||||
return ArgumentError.value(end, 'end');
|
||||
}
|
||||
if (end < start || end > length) {
|
||||
return new RangeError.range(end, start, length, 'end');
|
||||
return RangeError.range(end, start, length, 'end');
|
||||
}
|
||||
}
|
||||
// The above should always match, but if it does not, use the following.
|
||||
return new ArgumentError.value(end, 'end');
|
||||
return ArgumentError.value(end, 'end');
|
||||
}
|
||||
|
||||
stringLastIndexOfUnchecked(receiver, element, start) =>
|
||||
|
@ -1157,7 +1157,7 @@ stringLastIndexOfUnchecked(receiver, element, start) =>
|
|||
/// 'factory' for constructing ArgumentError.value to keep the call sites small.
|
||||
@pragma('dart2js:noInline')
|
||||
ArgumentError argumentErrorValue(object) {
|
||||
return new ArgumentError.value(object);
|
||||
return ArgumentError.value(object);
|
||||
}
|
||||
|
||||
checkNull(object) {
|
||||
|
@ -1198,7 +1198,7 @@ wrapException(ex) {
|
|||
|
||||
@pragma('dart2js:never-inline')
|
||||
initializeExceptionWrapper(wrapper, ex) {
|
||||
if (ex == null) ex = new TypeError();
|
||||
if (ex == null) ex = TypeError();
|
||||
// [unwrapException] looks for the property 'dartException'.
|
||||
JS('void', '#.dartException = #', wrapper, ex);
|
||||
|
||||
|
@ -1241,7 +1241,7 @@ Never throwExpressionWithWrapper(ex, wrapper) {
|
|||
}
|
||||
|
||||
throwUnsupportedError(message) {
|
||||
throw new UnsupportedError(message);
|
||||
throw UnsupportedError(message);
|
||||
}
|
||||
|
||||
// This is used in open coded for-in loops on arrays.
|
||||
|
@ -1266,7 +1266,7 @@ checkConcurrentModificationError(sameLength, collection) {
|
|||
|
||||
@pragma('dart2js:noInline')
|
||||
throwConcurrentModificationError(collection) {
|
||||
throw new ConcurrentModificationError(collection);
|
||||
throw ConcurrentModificationError(collection);
|
||||
}
|
||||
|
||||
/// Helper class for building patterns recognizing native type errors.
|
||||
|
@ -1463,7 +1463,7 @@ class TypeErrorDecoder {
|
|||
r'"((?:x|[^x])*)")',
|
||||
message);
|
||||
|
||||
return new TypeErrorDecoder(
|
||||
return TypeErrorDecoder(
|
||||
arguments, argumentsExpr, expr, method, receiver, pattern);
|
||||
}
|
||||
|
||||
|
@ -1824,10 +1824,10 @@ StackTrace getTraceFromException(exception) {
|
|||
if (exception is ExceptionAndStackTrace) {
|
||||
return exception.stackTrace;
|
||||
}
|
||||
if (exception == null) return new _StackTrace(exception);
|
||||
if (exception == null) return _StackTrace(exception);
|
||||
_StackTrace? trace = JS('_StackTrace|Null', r'#.$cachedTrace', exception);
|
||||
if (trace != null) return trace;
|
||||
trace = new _StackTrace(exception);
|
||||
trace = _StackTrace(exception);
|
||||
|
||||
// When storing a property on a primitive value `v`, JavaScript converts the
|
||||
// primitive value to an ephemeral wrapper object via `Object(v)`, and then
|
||||
|
@ -1957,7 +1957,7 @@ _invokeClosure(Function closure, int numberOfArguments, var arg1, var arg2,
|
|||
case 4:
|
||||
return closure(arg1, arg2, arg3, arg4);
|
||||
}
|
||||
throw new Exception('Unsupported number of arguments for wrapped closure');
|
||||
throw Exception('Unsupported number of arguments for wrapped closure');
|
||||
}
|
||||
|
||||
/// Called by generated code to convert a Dart closure to a JS
|
||||
|
@ -2118,9 +2118,9 @@ abstract final class Closure implements Function {
|
|||
// TODO(sra): Cache the prototype to avoid the allocation.
|
||||
var prototype = isStatic
|
||||
? JS('StaticClosure', 'Object.create(#.constructor.prototype)',
|
||||
new StaticClosure())
|
||||
StaticClosure())
|
||||
: JS('BoundClosure', 'Object.create(#.constructor.prototype)',
|
||||
new BoundClosure(null, null));
|
||||
BoundClosure(null, null));
|
||||
|
||||
JS('', '#.\$initialize = #', prototype, JS('', '#.constructor', prototype));
|
||||
|
||||
|
@ -2601,7 +2601,7 @@ final class BoundClosure extends TearOffClosure {
|
|||
@pragma('dart2js:noInline')
|
||||
@pragma('dart2js:noSideEffects')
|
||||
static String _computeFieldNamed(String fieldName) {
|
||||
var template = new BoundClosure('receiver', 'interceptor');
|
||||
var template = BoundClosure('receiver', 'interceptor');
|
||||
var names = JSArray.markFixedList(
|
||||
JS('', 'Object.getOwnPropertyNames(#)', template));
|
||||
for (int i = 0; i < names.length; i++) {
|
||||
|
@ -2712,7 +2712,7 @@ bool boolConversionCheck(value) {
|
|||
@pragma('dart2js:noInline')
|
||||
void checkDeferredIsLoaded(String loadId) {
|
||||
if (!_loadedLibraries.contains(loadId)) {
|
||||
throw new DeferredNotLoadedError(loadId);
|
||||
throw DeferredNotLoadedError(loadId);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2752,7 +2752,7 @@ void assertHelper(condition) {
|
|||
/// Called by generated code when a static field's initializer references the
|
||||
/// field that is currently being initialized.
|
||||
void throwCyclicInit(String staticName) {
|
||||
throw new _CyclicInitializationError(staticName);
|
||||
throw _CyclicInitializationError(staticName);
|
||||
}
|
||||
|
||||
/// Error thrown when a lazily initialized variable cannot be initialized.
|
||||
|
@ -2829,7 +2829,7 @@ String getIsolateAffinityTag(String name) {
|
|||
final Map<String, Completer<Null>?> _loadingLibraries = {};
|
||||
final Set<String> _loadedLibraries = {};
|
||||
|
||||
typedef void DeferredLoadCallback();
|
||||
typedef DeferredLoadCallback = void Function();
|
||||
|
||||
// Function that will be called every time a new deferred import is loaded.
|
||||
DeferredLoadCallback? deferredLoadHook;
|
||||
|
@ -2886,7 +2886,7 @@ Future<Null> loadDeferredLibrary(String loadId, int priority) {
|
|||
// another that maps the index to a hash.
|
||||
var partsMap = JS_EMBEDDED_GLOBAL('', DEFERRED_LIBRARY_PARTS);
|
||||
List? indexes = JS('JSExtendableArray|Null', '#[#]', partsMap, loadId);
|
||||
if (indexes == null) return new Future.value(null);
|
||||
if (indexes == null) return Future.value(null);
|
||||
List<String> uris = <String>[];
|
||||
List<String> hashes = <String>[];
|
||||
List index2uri = JS_EMBEDDED_GLOBAL('JSArray', DEFERRED_PART_URIS);
|
||||
|
@ -2899,7 +2899,7 @@ Future<Null> loadDeferredLibrary(String loadId, int priority) {
|
|||
|
||||
int total = hashes.length;
|
||||
assert(total == uris.length);
|
||||
List<bool> waitingForLoad = new List.filled(total, true);
|
||||
List<bool> waitingForLoad = List.filled(total, true);
|
||||
int nextHunkToInitialize = 0;
|
||||
var isHunkLoaded = JS_EMBEDDED_GLOBAL('', IS_HUNK_LOADED);
|
||||
var isHunkInitialized = JS_EMBEDDED_GLOBAL('', IS_HUNK_INITIALIZED);
|
||||
|
@ -2934,7 +2934,7 @@ Future<Null> loadDeferredLibrary(String loadId, int priority) {
|
|||
} else {
|
||||
_addEvent(part: uri, hash: hash, event: 'missing', loadId: loadId);
|
||||
|
||||
throw new DeferredLoadException("Loading ${uris[i]} failed: "
|
||||
throw DeferredLoadException("Loading ${uris[i]} failed: "
|
||||
"the code with hash '${hash}' was not loaded.\n"
|
||||
"event log:\n${_getEventLog()}\n");
|
||||
}
|
||||
|
@ -2968,7 +2968,7 @@ Future<Null> loadDeferredLibrary(String loadId, int priority) {
|
|||
final hash = hashes[i];
|
||||
if (JS('bool', '#(#)', isHunkLoaded, hash)) {
|
||||
waitingForLoad[i] = false;
|
||||
return new Future.value();
|
||||
return Future.value();
|
||||
}
|
||||
return _loadHunk(uris[i], loadId, priority, hash, 0).then((Null _) {
|
||||
waitingForLoad[i] = false;
|
||||
|
@ -2976,7 +2976,7 @@ Future<Null> loadDeferredLibrary(String loadId, int priority) {
|
|||
});
|
||||
}
|
||||
|
||||
return Future.wait(new List.generate(total, loadAndInitialize)).then((_) {
|
||||
return Future.wait(List.generate(total, loadAndInitialize)).then((_) {
|
||||
finalizeLoad();
|
||||
});
|
||||
}
|
||||
|
@ -3096,7 +3096,7 @@ String _computeThisScriptFromTrace() {
|
|||
'(function() {'
|
||||
'try { throw new Error() } catch(e) { return e.stack }'
|
||||
'})()');
|
||||
if (stack == null) throw new UnsupportedError('No stack trace');
|
||||
if (stack == null) throw UnsupportedError('No stack trace');
|
||||
}
|
||||
var pattern, matches;
|
||||
|
||||
|
@ -3116,7 +3116,7 @@ String _computeThisScriptFromTrace() {
|
|||
matches = JS('JSExtendableArray|Null', '#.match(#)', stack, pattern);
|
||||
if (matches != null) return JS('String', '#[1]', matches);
|
||||
|
||||
throw new UnsupportedError('Cannot extract URI from "$stack"');
|
||||
throw UnsupportedError('Cannot extract URI from "$stack"');
|
||||
}
|
||||
|
||||
Future _loadAllHunks(Object loader, List<String> hunkNames, List<String> hashes,
|
||||
|
@ -3361,7 +3361,7 @@ class _UnreachableError extends AssertionError {
|
|||
|
||||
@pragma('dart2js:noInline')
|
||||
Never assertUnreachable() {
|
||||
throw new _UnreachableError();
|
||||
throw _UnreachableError();
|
||||
}
|
||||
|
||||
// Hook to register new global object if necessary.
|
||||
|
@ -3391,7 +3391,7 @@ class _Required {
|
|||
const _Required();
|
||||
}
|
||||
|
||||
const kRequiredSentinel = const _Required();
|
||||
const kRequiredSentinel = _Required();
|
||||
bool isRequired(Object? value) => identical(kRequiredSentinel, value);
|
||||
|
||||
/// Checks that [f] is a function that supports interop.
|
||||
|
|
|
@ -100,7 +100,7 @@ final class JSNumber extends Interceptor implements double {
|
|||
return JS('int', r'# + 0', truncateToDouble()); // Converts -0.0 to +0.0.
|
||||
}
|
||||
// [this] is either NaN, Infinity or -Infinity.
|
||||
throw new UnsupportedError(JS('String', '"" + # + ".toInt()"', this));
|
||||
throw UnsupportedError(JS('String', '"" + # + ".toInt()"', this));
|
||||
}
|
||||
|
||||
int truncate() => toInt();
|
||||
|
@ -121,7 +121,7 @@ final class JSNumber extends Interceptor implements double {
|
|||
return JS('int', r'#', d);
|
||||
}
|
||||
// [this] is either NaN, Infinity or -Infinity.
|
||||
throw new UnsupportedError(JS('String', '"" + # + ".ceil()"', this));
|
||||
throw UnsupportedError(JS('String', '"" + # + ".ceil()"', this));
|
||||
}
|
||||
|
||||
int floor() {
|
||||
|
@ -140,7 +140,7 @@ final class JSNumber extends Interceptor implements double {
|
|||
return JS('int', r'#', d);
|
||||
}
|
||||
// [this] is either NaN, Infinity or -Infinity.
|
||||
throw new UnsupportedError(JS('String', '"" + # + ".floor()"', this));
|
||||
throw UnsupportedError(JS('String', '"" + # + ".floor()"', this));
|
||||
}
|
||||
|
||||
int round() {
|
||||
|
@ -159,7 +159,7 @@ final class JSNumber extends Interceptor implements double {
|
|||
return JS('int', r'0 - Math.round(0 - #)', this);
|
||||
}
|
||||
// [this] is either NaN, Infinity or -Infinity.
|
||||
throw new UnsupportedError(JS('String', '"" + # + ".round()"', this));
|
||||
throw UnsupportedError(JS('String', '"" + # + ".round()"', this));
|
||||
}
|
||||
|
||||
double ceilToDouble() => JS('num', r'Math.ceil(#)', this);
|
||||
|
@ -194,7 +194,7 @@ final class JSNumber extends Interceptor implements double {
|
|||
String toStringAsFixed(int fractionDigits) {
|
||||
checkInt(fractionDigits);
|
||||
if (fractionDigits < 0 || fractionDigits > 20) {
|
||||
throw new RangeError.range(fractionDigits, 0, 20, 'fractionDigits');
|
||||
throw RangeError.range(fractionDigits, 0, 20, 'fractionDigits');
|
||||
}
|
||||
String result = JS('String', r'#.toFixed(#)', this, fractionDigits);
|
||||
if (this == 0 && isNegative) return '-$result';
|
||||
|
@ -206,7 +206,7 @@ final class JSNumber extends Interceptor implements double {
|
|||
if (fractionDigits != null) {
|
||||
checkInt(fractionDigits);
|
||||
if (fractionDigits < 0 || fractionDigits > 20) {
|
||||
throw new RangeError.range(fractionDigits, 0, 20, 'fractionDigits');
|
||||
throw RangeError.range(fractionDigits, 0, 20, 'fractionDigits');
|
||||
}
|
||||
result = JS('String', r'#.toExponential(#)', this, fractionDigits);
|
||||
} else {
|
||||
|
@ -219,7 +219,7 @@ final class JSNumber extends Interceptor implements double {
|
|||
String toStringAsPrecision(int precision) {
|
||||
checkInt(precision);
|
||||
if (precision < 1 || precision > 21) {
|
||||
throw new RangeError.range(precision, 1, 21, 'precision');
|
||||
throw RangeError.range(precision, 1, 21, 'precision');
|
||||
}
|
||||
String result = JS('String', r'#.toPrecision(#)', this, precision);
|
||||
if (this == 0 && isNegative) return '-$result';
|
||||
|
@ -229,7 +229,7 @@ final class JSNumber extends Interceptor implements double {
|
|||
String toRadixString(int radix) {
|
||||
checkInt(radix);
|
||||
if (radix < 2 || radix > 36) {
|
||||
throw new RangeError.range(radix, 2, 36, 'radix');
|
||||
throw RangeError.range(radix, 2, 36, 'radix');
|
||||
}
|
||||
String result = JS('String', r'#.toString(#)', this, radix);
|
||||
const int rightParenCode = 0x29;
|
||||
|
@ -246,7 +246,7 @@ final class JSNumber extends Interceptor implements double {
|
|||
r'/^([\da-z]+)(?:\.([\da-z]+))?\(e\+(\d+)\)$/.exec(#)', result);
|
||||
if (match == null) {
|
||||
// Then we don't know how to handle it at all.
|
||||
throw new UnsupportedError('Unexpected toString result: $result');
|
||||
throw UnsupportedError('Unexpected toString result: $result');
|
||||
}
|
||||
result = JS('String', '#', match[1]);
|
||||
int exponent = JS('int', '+#', match[3]);
|
||||
|
@ -374,7 +374,7 @@ final class JSNumber extends Interceptor implements double {
|
|||
}
|
||||
|
||||
// [quotient] is either NaN, Infinity or -Infinity.
|
||||
throw new UnsupportedError(
|
||||
throw UnsupportedError(
|
||||
'Result of truncating division is $quotient: $this ~/ $other');
|
||||
}
|
||||
|
||||
|
@ -644,7 +644,7 @@ final class JSInt extends JSNumber implements int, TrustedGetRuntimeType {
|
|||
}
|
||||
} while (u != 0);
|
||||
if (!inv) return s * v;
|
||||
if (v != 1) throw new Exception('Not coprime');
|
||||
if (v != 1) throw Exception('Not coprime');
|
||||
if (d < 0) {
|
||||
d += x;
|
||||
if (d < 0) d += x;
|
||||
|
@ -658,15 +658,15 @@ final class JSInt extends JSNumber implements int, TrustedGetRuntimeType {
|
|||
// Returns 1/this % m, with m > 0.
|
||||
int modInverse(int m) {
|
||||
if (m is! int) {
|
||||
throw new ArgumentError.value(m, 'modulus', 'not an integer');
|
||||
throw ArgumentError.value(m, 'modulus', 'not an integer');
|
||||
}
|
||||
if (m <= 0) throw new RangeError.range(m, 1, null, 'modulus');
|
||||
if (m <= 0) throw RangeError.range(m, 1, null, 'modulus');
|
||||
if (m == 1) return 0;
|
||||
int t = this;
|
||||
if ((t < 0) || (t >= m)) t %= m;
|
||||
if (t == 1) return 1;
|
||||
if ((t == 0) || (t.isEven && m.isEven)) {
|
||||
throw new Exception('Not coprime');
|
||||
throw Exception('Not coprime');
|
||||
}
|
||||
return _binaryGcd(m, t, true);
|
||||
}
|
||||
|
@ -674,7 +674,7 @@ final class JSInt extends JSNumber implements int, TrustedGetRuntimeType {
|
|||
// Returns gcd of abs(this) and abs(other).
|
||||
int gcd(int other) {
|
||||
if (other is! int) {
|
||||
throw new ArgumentError.value(other, 'other', 'not an integer');
|
||||
throw ArgumentError.value(other, 'other', 'not an integer');
|
||||
}
|
||||
int x = this.abs();
|
||||
int y = other.abs();
|
||||
|
|
|
@ -28,14 +28,14 @@ final class JSString extends Interceptor
|
|||
checkString(string);
|
||||
checkInt(start);
|
||||
if (0 > start || start > string.length) {
|
||||
throw new RangeError.range(start, 0, string.length);
|
||||
throw RangeError.range(start, 0, string.length);
|
||||
}
|
||||
return allMatchesInStringUnchecked(this, string, start);
|
||||
}
|
||||
|
||||
Match? matchAsPrefix(String string, [int start = 0]) {
|
||||
if (start < 0 || start > string.length) {
|
||||
throw new RangeError.range(start, 0, string.length);
|
||||
throw RangeError.range(start, 0, string.length);
|
||||
}
|
||||
if (start + this.length > string.length) return null;
|
||||
// TODO(lrn): See if this can be optimized.
|
||||
|
@ -44,11 +44,11 @@ final class JSString extends Interceptor
|
|||
return null;
|
||||
}
|
||||
}
|
||||
return new StringMatch(start, string, this);
|
||||
return StringMatch(start, string, this);
|
||||
}
|
||||
|
||||
String operator +(String other) {
|
||||
if (other is! String) throw new ArgumentError.value(other);
|
||||
if (other is! String) throw ArgumentError.value(other);
|
||||
return JS('String', r'# + #', this, other);
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,7 @@ final class JSString extends Interceptor
|
|||
bool startsWith(Pattern pattern, [int index = 0]) {
|
||||
checkInt(index);
|
||||
if (index < 0 || index > this.length) {
|
||||
throw new RangeError.range(index, 0, this.length);
|
||||
throw RangeError.range(index, 0, this.length);
|
||||
}
|
||||
if (pattern is String) {
|
||||
String other = pattern;
|
||||
|
@ -346,15 +346,15 @@ final class JSString extends Interceptor
|
|||
return this + padding * delta;
|
||||
}
|
||||
|
||||
List<int> get codeUnits => new CodeUnits(this);
|
||||
List<int> get codeUnits => CodeUnits(this);
|
||||
|
||||
Runes get runes => new Runes(this);
|
||||
Runes get runes => Runes(this);
|
||||
|
||||
int indexOf(Pattern pattern, [int start = 0]) {
|
||||
checkNull(pattern);
|
||||
if (start is! int) throw argumentErrorValue(start);
|
||||
if (start < 0 || start > this.length) {
|
||||
throw new RangeError.range(start, 0, this.length);
|
||||
throw RangeError.range(start, 0, this.length);
|
||||
}
|
||||
if (pattern is String) {
|
||||
return stringIndexOfStringUnchecked(this, pattern, start);
|
||||
|
@ -377,7 +377,7 @@ final class JSString extends Interceptor
|
|||
} else if (start is! int) {
|
||||
throw argumentErrorValue(start);
|
||||
} else if (start < 0 || start > this.length) {
|
||||
throw new RangeError.range(start, 0, this.length);
|
||||
throw RangeError.range(start, 0, this.length);
|
||||
}
|
||||
if (pattern is String) {
|
||||
String other = pattern;
|
||||
|
@ -395,7 +395,7 @@ final class JSString extends Interceptor
|
|||
bool contains(Pattern other, [int startIndex = 0]) {
|
||||
checkNull(other);
|
||||
if (startIndex < 0 || startIndex > this.length) {
|
||||
throw new RangeError.range(startIndex, 0, this.length);
|
||||
throw RangeError.range(startIndex, 0, this.length);
|
||||
}
|
||||
return stringContainsUnchecked(this, other, startIndex);
|
||||
}
|
||||
|
|
|
@ -45,11 +45,11 @@ class JsLinkedHashMap<K, V> extends MapBase<K, V>
|
|||
bool get isNotEmpty => !isEmpty;
|
||||
|
||||
Iterable<K> get keys {
|
||||
return new LinkedHashMapKeyIterable<K>(this);
|
||||
return LinkedHashMapKeyIterable<K>(this);
|
||||
}
|
||||
|
||||
Iterable<V> get values {
|
||||
return new MappedIterable<K, V>(keys, (each) => this[each] as V);
|
||||
return MappedIterable<K, V>(keys, (each) => this[each] as V);
|
||||
}
|
||||
|
||||
bool containsKey(Object? key) {
|
||||
|
@ -228,7 +228,7 @@ class JsLinkedHashMap<K, V> extends MapBase<K, V>
|
|||
|
||||
// Create a new cell and link it in as the last one in the list.
|
||||
LinkedHashMapCell _newLinkedCell(K key, V value) {
|
||||
LinkedHashMapCell cell = new LinkedHashMapCell(key, value);
|
||||
LinkedHashMapCell cell = LinkedHashMapCell(key, value);
|
||||
if (_first == null) {
|
||||
_first = _last = cell;
|
||||
} else {
|
||||
|
@ -348,7 +348,7 @@ class LinkedHashMapKeyIterable<E> extends EfficientLengthIterable<E>
|
|||
bool get isEmpty => _map._length == 0;
|
||||
|
||||
Iterator<E> get iterator {
|
||||
return new LinkedHashMapKeyIterator<E>(_map, _map._modifications);
|
||||
return LinkedHashMapKeyIterator<E>(_map, _map._modifications);
|
||||
}
|
||||
|
||||
bool contains(Object? element) {
|
||||
|
|
|
@ -80,7 +80,7 @@ class _JSRandom implements Random {
|
|||
|
||||
int nextInt(int max) {
|
||||
if (max <= 0 || max > _POW2_32) {
|
||||
throw new RangeError('max must be in range 0 < max ≤ 2^32, was $max');
|
||||
throw RangeError('max must be in range 0 < max ≤ 2^32, was $max');
|
||||
}
|
||||
return JS('int', '(Math.random() * #) >>> 0', max);
|
||||
}
|
||||
|
@ -212,7 +212,7 @@ class _Random implements Random {
|
|||
|
||||
int nextInt(int max) {
|
||||
if (max <= 0 || max > _POW2_32) {
|
||||
throw new RangeError('max must be in range 0 < max ≤ 2^32, was $max');
|
||||
throw RangeError('max must be in range 0 < max ≤ 2^32, was $max');
|
||||
}
|
||||
if ((max & (max - 1)) == 0) {
|
||||
// Fast case for powers of two.
|
||||
|
@ -246,7 +246,7 @@ class _Random implements Random {
|
|||
|
||||
class _JSSecureRandom implements Random {
|
||||
// Reused buffer with room enough for a double.
|
||||
final _buffer = new ByteData(8);
|
||||
final _buffer = ByteData(8);
|
||||
|
||||
_JSSecureRandom() {
|
||||
var crypto = JS('', 'self.crypto');
|
||||
|
@ -256,7 +256,7 @@ class _JSSecureRandom implements Random {
|
|||
return;
|
||||
}
|
||||
}
|
||||
throw new UnsupportedError(
|
||||
throw UnsupportedError(
|
||||
'No source of cryptographically secure random numbers available.');
|
||||
}
|
||||
|
||||
|
@ -293,7 +293,7 @@ class _JSSecureRandom implements Random {
|
|||
|
||||
int nextInt(int max) {
|
||||
if (max <= 0 || max > _POW2_32) {
|
||||
throw new RangeError('max must be in range 0 < max ≤ 2^32, was $max');
|
||||
throw RangeError('max must be in range 0 < max ≤ 2^32, was $max');
|
||||
}
|
||||
int byteCount = 1;
|
||||
if (max > 0xFF) {
|
||||
|
|
|
@ -208,7 +208,7 @@ lookupAndCacheInterceptor(obj) {
|
|||
|
||||
if (mark == DISCRIMINATED_MARK) {
|
||||
// TODO(sra): Use discriminator of tag.
|
||||
throw new UnimplementedError(tag);
|
||||
throw UnimplementedError(tag);
|
||||
}
|
||||
|
||||
// [tag] was not explicitly an interior or leaf tag, so
|
||||
|
@ -419,7 +419,7 @@ applyHooksTransformer(transformer, hooks) {
|
|||
// the code emitter, or JS_CONST could be improved to parse entire functions and
|
||||
// take care of the minification.
|
||||
|
||||
const _baseHooks = const JS_CONST(r'''
|
||||
const _baseHooks = JS_CONST(r'''
|
||||
function() {
|
||||
var toStringFunction = Object.prototype.toString;
|
||||
function getTag(o) {
|
||||
|
@ -466,13 +466,13 @@ function() {
|
|||
/// This function is split out of
|
||||
/// [_fallbackConstructorHooksTransformerGenerator] as it is called from both
|
||||
/// the dispatch hooks and via [constructorNameFallback] from objectToString.
|
||||
const _constructorNameFallback = const JS_CONST(r'''
|
||||
const _constructorNameFallback = JS_CONST(r'''
|
||||
function getTagFallback(o) {
|
||||
var s = Object.prototype.toString.call(o);
|
||||
return s.substring(8, s.length - 1);
|
||||
}''');
|
||||
|
||||
const _fallbackConstructorHooksTransformerGenerator = const JS_CONST(r'''
|
||||
const _fallbackConstructorHooksTransformerGenerator = JS_CONST(r'''
|
||||
function(getTagFallback) {
|
||||
return function(hooks) {
|
||||
// If we are not in a browser, assume we are in d8.
|
||||
|
@ -494,7 +494,7 @@ function(getTagFallback) {
|
|||
};
|
||||
}''');
|
||||
|
||||
const _ieHooksTransformer = const JS_CONST(r'''
|
||||
const _ieHooksTransformer = JS_CONST(r'''
|
||||
function(hooks) {
|
||||
if (typeof navigator != "object") return hooks;
|
||||
var userAgent = navigator.userAgent;
|
||||
|
@ -533,7 +533,7 @@ function(hooks) {
|
|||
hooks.prototypeForTag = prototypeForTagIE;
|
||||
}''');
|
||||
|
||||
const _fixDocumentHooksTransformer = const JS_CONST(r'''
|
||||
const _fixDocumentHooksTransformer = JS_CONST(r'''
|
||||
function(hooks) {
|
||||
var getTag = hooks.getTag;
|
||||
var prototypeForTag = hooks.prototypeForTag;
|
||||
|
@ -560,7 +560,7 @@ function(hooks) {
|
|||
hooks.prototypeForTag = prototypeForTagFixed;
|
||||
}''');
|
||||
|
||||
const _firefoxHooksTransformer = const JS_CONST(r'''
|
||||
const _firefoxHooksTransformer = JS_CONST(r'''
|
||||
function(hooks) {
|
||||
if (typeof navigator != "object") return hooks;
|
||||
var userAgent = navigator.userAgent;
|
||||
|
@ -585,15 +585,15 @@ function(hooks) {
|
|||
hooks.getTag = getTagFirefox;
|
||||
}''');
|
||||
|
||||
const _operaHooksTransformer = const JS_CONST(r'''
|
||||
const _operaHooksTransformer = JS_CONST(r'''
|
||||
function(hooks) { return hooks; }
|
||||
''');
|
||||
|
||||
const _safariHooksTransformer = const JS_CONST(r'''
|
||||
const _safariHooksTransformer = JS_CONST(r'''
|
||||
function(hooks) { return hooks; }
|
||||
''');
|
||||
|
||||
const _dartExperimentalFixupGetTagHooksTransformer = const JS_CONST(r'''
|
||||
const _dartExperimentalFixupGetTagHooksTransformer = JS_CONST(r'''
|
||||
function(hooks) {
|
||||
if (typeof dartExperimentalFixupGetTag != "function") return hooks;
|
||||
hooks.getTag = dartExperimentalFixupGetTag(hooks.getTag);
|
||||
|
|
|
@ -106,14 +106,14 @@ class JSSyntaxRegExp implements RegExp {
|
|||
// The returned value is the JavaScript exception. Turn it into a
|
||||
// Dart exception.
|
||||
String errorMessage = JS('String', r'String(#)', regexp);
|
||||
throw new FormatException('Illegal RegExp pattern ($errorMessage)', source);
|
||||
throw FormatException('Illegal RegExp pattern ($errorMessage)', source);
|
||||
}
|
||||
|
||||
RegExpMatch? firstMatch(String string) {
|
||||
JSArray? m = JS('JSExtendableArray|Null', r'#.exec(#)', _nativeRegExp,
|
||||
checkString(string));
|
||||
if (m == null) return null;
|
||||
return new _MatchImplementation(this, m);
|
||||
return _MatchImplementation(this, m);
|
||||
}
|
||||
|
||||
bool hasMatch(String string) {
|
||||
|
@ -130,9 +130,9 @@ class JSSyntaxRegExp implements RegExp {
|
|||
checkString(string);
|
||||
checkInt(start);
|
||||
if (start < 0 || start > string.length) {
|
||||
throw new RangeError.range(start, 0, string.length);
|
||||
throw RangeError.range(start, 0, string.length);
|
||||
}
|
||||
return new _AllMatchesIterable(this, string, start);
|
||||
return _AllMatchesIterable(this, string, start);
|
||||
}
|
||||
|
||||
RegExpMatch? _execGlobal(String string, int start) {
|
||||
|
@ -140,7 +140,7 @@ class JSSyntaxRegExp implements RegExp {
|
|||
JS('void', '#.lastIndex = #', regexp, start);
|
||||
JSArray? match = JS('JSExtendableArray|Null', '#.exec(#)', regexp, string);
|
||||
if (match == null) return null;
|
||||
return new _MatchImplementation(this, match);
|
||||
return _MatchImplementation(this, match);
|
||||
}
|
||||
|
||||
RegExpMatch? _execAnchored(String string, int start) {
|
||||
|
@ -151,12 +151,12 @@ class JSSyntaxRegExp implements RegExp {
|
|||
// If the last capture group participated, the original regexp did not
|
||||
// match at the start position.
|
||||
if (match.removeLast() != null) return null;
|
||||
return new _MatchImplementation(this, match);
|
||||
return _MatchImplementation(this, match);
|
||||
}
|
||||
|
||||
RegExpMatch? matchAsPrefix(String string, [int start = 0]) {
|
||||
if (start < 0 || start > string.length) {
|
||||
throw new RangeError.range(start, 0, string.length);
|
||||
throw RangeError.range(start, 0, string.length);
|
||||
}
|
||||
return _execAnchored(string, start);
|
||||
}
|
||||
|
@ -222,7 +222,7 @@ class _MatchImplementation implements RegExpMatch {
|
|||
Iterable<String> get groupNames {
|
||||
var groups = JS('=Object|Null', '#.groups', _match);
|
||||
if (groups != null) {
|
||||
var keys = new JSArray<String>.markGrowable(
|
||||
var keys = JSArray<String>.markGrowable(
|
||||
JS('returns:JSExtendableArray;new:true', 'Object.keys(#)', groups));
|
||||
return SubListIterable(keys, 0, null);
|
||||
}
|
||||
|
@ -238,7 +238,7 @@ class _AllMatchesIterable extends Iterable<RegExpMatch> {
|
|||
_AllMatchesIterable(this._re, this._string, this._start);
|
||||
|
||||
Iterator<RegExpMatch> get iterator =>
|
||||
new _AllMatchesIterator(_re, _string, _start);
|
||||
_AllMatchesIterator(_re, _string, _start);
|
||||
}
|
||||
|
||||
class _AllMatchesIterator implements Iterator<RegExpMatch> {
|
||||
|
|
|
@ -26,7 +26,7 @@ List<String> stringSplitUnchecked(
|
|||
String receiver,
|
||||
/* String | JavaScript RegExp */
|
||||
pattern) {
|
||||
return new JSArray<String>.markGrowable(JS(
|
||||
return JSArray<String>.markGrowable(JS(
|
||||
'returns:JSExtendableArray;new:true', '#.split(#)', receiver, pattern));
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ class StringMatch implements Match {
|
|||
|
||||
String group(int group_) {
|
||||
if (group_ != 0) {
|
||||
throw new RangeError.value(group_);
|
||||
throw RangeError.value(group_);
|
||||
}
|
||||
return pattern;
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ class StringMatch implements Match {
|
|||
|
||||
Iterable<Match> allMatchesInStringUnchecked(
|
||||
String pattern, String string, int startIndex) {
|
||||
return new _StringAllMatchesIterable(string, pattern, startIndex);
|
||||
return _StringAllMatchesIterable(string, pattern, startIndex);
|
||||
}
|
||||
|
||||
class _StringAllMatchesIterable extends Iterable<Match> {
|
||||
|
@ -70,12 +70,12 @@ class _StringAllMatchesIterable extends Iterable<Match> {
|
|||
_StringAllMatchesIterable(this._input, this._pattern, this._index);
|
||||
|
||||
Iterator<Match> get iterator =>
|
||||
new _StringAllMatchesIterator(_input, _pattern, _index);
|
||||
_StringAllMatchesIterator(_input, _pattern, _index);
|
||||
|
||||
Match get first {
|
||||
int index = stringIndexOfStringUnchecked(_input, _pattern, _index);
|
||||
if (index >= 0) {
|
||||
return new StringMatch(index, _input, _pattern);
|
||||
return StringMatch(index, _input, _pattern);
|
||||
}
|
||||
throw IterableElementError.noElement();
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ class _StringAllMatchesIterator implements Iterator<Match> {
|
|||
return false;
|
||||
}
|
||||
int end = index + _pattern.length;
|
||||
_current = new StringMatch(index, _input, _pattern);
|
||||
_current = StringMatch(index, _input, _pattern);
|
||||
// Empty match, don't start at same location again.
|
||||
if (end == _index) end++;
|
||||
_index = end;
|
||||
|
@ -200,7 +200,7 @@ String stringReplaceAllUncheckedString(
|
|||
if (receiver == "") {
|
||||
return JS('String', '#', replacement); // help type inference.
|
||||
}
|
||||
StringBuffer result = new StringBuffer('');
|
||||
StringBuffer result = StringBuffer('');
|
||||
int length = receiver.length;
|
||||
result.write(replacement);
|
||||
for (int i = 0; i < length; i++) {
|
||||
|
@ -251,9 +251,9 @@ String stringReplaceAllFuncUnchecked(String receiver, Pattern pattern,
|
|||
// top of the method but it saves an extra check on the `pattern is String`
|
||||
// path.
|
||||
if (pattern is! Pattern) {
|
||||
throw new ArgumentError.value(pattern, 'pattern', 'is not a Pattern');
|
||||
throw ArgumentError.value(pattern, 'pattern', 'is not a Pattern');
|
||||
}
|
||||
StringBuffer buffer = new StringBuffer('');
|
||||
StringBuffer buffer = StringBuffer('');
|
||||
int startIndex = 0;
|
||||
for (Match match in pattern.allMatches(receiver)) {
|
||||
buffer.write(onNonMatch(receiver.substring(startIndex, match.start)));
|
||||
|
@ -272,7 +272,7 @@ String stringReplaceAllEmptyFuncUnchecked(String receiver,
|
|||
int i = 0;
|
||||
buffer.write(onNonMatch(""));
|
||||
while (i < length) {
|
||||
buffer.write(onMatch(new StringMatch(i, receiver, "")));
|
||||
buffer.write(onMatch(StringMatch(i, receiver, "")));
|
||||
// Special case to avoid splitting a surrogate pair.
|
||||
int code = receiver.codeUnitAt(i);
|
||||
if ((code & ~0x3FF) == 0xD800 && length > i + 1) {
|
||||
|
@ -288,7 +288,7 @@ String stringReplaceAllEmptyFuncUnchecked(String receiver,
|
|||
buffer.write(onNonMatch(receiver[i]));
|
||||
i++;
|
||||
}
|
||||
buffer.write(onMatch(new StringMatch(i, receiver, "")));
|
||||
buffer.write(onMatch(StringMatch(i, receiver, "")));
|
||||
buffer.write(onNonMatch(""));
|
||||
return buffer.toString();
|
||||
}
|
||||
|
@ -300,7 +300,7 @@ String stringReplaceAllStringFuncUnchecked(String receiver, String pattern,
|
|||
return stringReplaceAllEmptyFuncUnchecked(receiver, onMatch, onNonMatch);
|
||||
}
|
||||
int length = receiver.length;
|
||||
StringBuffer buffer = new StringBuffer('');
|
||||
StringBuffer buffer = StringBuffer('');
|
||||
int startIndex = 0;
|
||||
while (startIndex < length) {
|
||||
int position = stringIndexOfStringUnchecked(receiver, pattern, startIndex);
|
||||
|
@ -308,7 +308,7 @@ String stringReplaceAllStringFuncUnchecked(String receiver, String pattern,
|
|||
break;
|
||||
}
|
||||
buffer.write(onNonMatch(receiver.substring(startIndex, position)));
|
||||
buffer.write(onMatch(new StringMatch(position, receiver, pattern)));
|
||||
buffer.write(onMatch(StringMatch(position, receiver, pattern)));
|
||||
startIndex = position + patternLength;
|
||||
}
|
||||
buffer.write(onNonMatch(receiver.substring(startIndex)));
|
||||
|
|
|
@ -203,55 +203,52 @@ final class _UnmodifiableByteBufferView
|
|||
int get lengthInBytes => _data.lengthInBytes;
|
||||
|
||||
Uint8List asUint8List([int offsetInBytes = 0, int? length]) =>
|
||||
new UnmodifiableUint8ListView(_data.asUint8List(offsetInBytes, length));
|
||||
UnmodifiableUint8ListView(_data.asUint8List(offsetInBytes, length));
|
||||
|
||||
Int8List asInt8List([int offsetInBytes = 0, int? length]) =>
|
||||
new UnmodifiableInt8ListView(_data.asInt8List(offsetInBytes, length));
|
||||
UnmodifiableInt8ListView(_data.asInt8List(offsetInBytes, length));
|
||||
|
||||
Uint8ClampedList asUint8ClampedList([int offsetInBytes = 0, int? length]) =>
|
||||
new UnmodifiableUint8ClampedListView(
|
||||
UnmodifiableUint8ClampedListView(
|
||||
_data.asUint8ClampedList(offsetInBytes, length));
|
||||
|
||||
Uint16List asUint16List([int offsetInBytes = 0, int? length]) =>
|
||||
new UnmodifiableUint16ListView(_data.asUint16List(offsetInBytes, length));
|
||||
UnmodifiableUint16ListView(_data.asUint16List(offsetInBytes, length));
|
||||
|
||||
Int16List asInt16List([int offsetInBytes = 0, int? length]) =>
|
||||
new UnmodifiableInt16ListView(_data.asInt16List(offsetInBytes, length));
|
||||
UnmodifiableInt16ListView(_data.asInt16List(offsetInBytes, length));
|
||||
|
||||
Uint32List asUint32List([int offsetInBytes = 0, int? length]) =>
|
||||
new UnmodifiableUint32ListView(_data.asUint32List(offsetInBytes, length));
|
||||
UnmodifiableUint32ListView(_data.asUint32List(offsetInBytes, length));
|
||||
|
||||
Int32List asInt32List([int offsetInBytes = 0, int? length]) =>
|
||||
new UnmodifiableInt32ListView(_data.asInt32List(offsetInBytes, length));
|
||||
UnmodifiableInt32ListView(_data.asInt32List(offsetInBytes, length));
|
||||
|
||||
Uint64List asUint64List([int offsetInBytes = 0, int? length]) =>
|
||||
new UnmodifiableUint64ListView(_data.asUint64List(offsetInBytes, length));
|
||||
UnmodifiableUint64ListView(_data.asUint64List(offsetInBytes, length));
|
||||
|
||||
Int64List asInt64List([int offsetInBytes = 0, int? length]) =>
|
||||
new UnmodifiableInt64ListView(_data.asInt64List(offsetInBytes, length));
|
||||
UnmodifiableInt64ListView(_data.asInt64List(offsetInBytes, length));
|
||||
|
||||
Int32x4List asInt32x4List([int offsetInBytes = 0, int? length]) =>
|
||||
new UnmodifiableInt32x4ListView(
|
||||
_data.asInt32x4List(offsetInBytes, length));
|
||||
UnmodifiableInt32x4ListView(_data.asInt32x4List(offsetInBytes, length));
|
||||
|
||||
Float32List asFloat32List([int offsetInBytes = 0, int? length]) =>
|
||||
new UnmodifiableFloat32ListView(
|
||||
_data.asFloat32List(offsetInBytes, length));
|
||||
UnmodifiableFloat32ListView(_data.asFloat32List(offsetInBytes, length));
|
||||
|
||||
Float64List asFloat64List([int offsetInBytes = 0, int? length]) =>
|
||||
new UnmodifiableFloat64ListView(
|
||||
_data.asFloat64List(offsetInBytes, length));
|
||||
UnmodifiableFloat64ListView(_data.asFloat64List(offsetInBytes, length));
|
||||
|
||||
Float32x4List asFloat32x4List([int offsetInBytes = 0, int? length]) =>
|
||||
new UnmodifiableFloat32x4ListView(
|
||||
UnmodifiableFloat32x4ListView(
|
||||
_data.asFloat32x4List(offsetInBytes, length));
|
||||
|
||||
Float64x2List asFloat64x2List([int offsetInBytes = 0, int? length]) =>
|
||||
new UnmodifiableFloat64x2ListView(
|
||||
UnmodifiableFloat64x2ListView(
|
||||
_data.asFloat64x2List(offsetInBytes, length));
|
||||
|
||||
ByteData asByteData([int offsetInBytes = 0, int? length]) =>
|
||||
new UnmodifiableByteDataView(_data.asByteData(offsetInBytes, length));
|
||||
UnmodifiableByteDataView(_data.asByteData(offsetInBytes, length));
|
||||
}
|
||||
|
||||
/// A read-only view of a [ByteData].
|
||||
|
@ -328,11 +325,10 @@ final class _UnmodifiableByteDataView
|
|||
|
||||
int get lengthInBytes => _data.lengthInBytes;
|
||||
|
||||
ByteBuffer get buffer => new UnmodifiableByteBufferView(_data.buffer);
|
||||
ByteBuffer get buffer => UnmodifiableByteBufferView(_data.buffer);
|
||||
|
||||
void _unsupported() {
|
||||
throw new UnsupportedError(
|
||||
"An UnmodifiableByteDataView may not be modified");
|
||||
throw UnsupportedError("An UnmodifiableByteDataView may not be modified");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -350,7 +346,7 @@ mixin _UnmodifiableListMixin<N, L extends List<N>, TD extends TypedData> {
|
|||
|
||||
int get lengthInBytes => _data.lengthInBytes;
|
||||
|
||||
ByteBuffer get buffer => new UnmodifiableByteBufferView(_data.buffer);
|
||||
ByteBuffer get buffer => UnmodifiableByteBufferView(_data.buffer);
|
||||
|
||||
L _createList(int length);
|
||||
|
||||
|
|
Loading…
Reference in a new issue