Cleanup unused vars in VM patch files

Change-Id: Ibc548921113d979df5b0ed8eb7f6ad48a553fc86
Reviewed-on: https://dart-review.googlesource.com/c/84121
Commit-Queue: Kevin Moore <kevmoo@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
This commit is contained in:
Kevin Moore 2018-11-13 22:56:54 +00:00 committed by commit-bot@chromium.org
parent e2f99e4cee
commit bc03bd3805
18 changed files with 63 additions and 148 deletions

View file

@ -5,5 +5,8 @@ description: >
# This package is not intended to be published - yet
publish_to: none
environment:
sdk: '>=2.0.0 <3.0.0'
dependencies:
front_end: ^0.1.0

View file

@ -6,8 +6,8 @@ description: VM specific Dart code and helper scripts
dependencies:
build_integration:
path: ../build_integration
front_end: 0.1.6
kernel: 0.3.6
front_end: ^0.1.6
kernel: ^0.3.6
dev_dependencies:
args: ^1.4.4

View file

@ -200,8 +200,7 @@ class _AsyncStarStreamController<T> {
// If stream is cancelled, tell caller to exit the async generator.
if (!controller.hasListener) return true;
isAdding = true;
var whenDoneAdding =
controller.addStream(stream as Stream<T>, cancelOnError: false);
var whenDoneAdding = controller.addStream(stream, cancelOnError: false);
whenDoneAdding.then((_) {
isAdding = false;
scheduleGenerator();

View file

@ -2572,9 +2572,6 @@ class _BigIntMontgomeryReduction implements _BigIntReduction {
// args[_rhoDigit.._rhoHighDigit] =
// 1/args[_xDigit.._xHighDigit] mod _digitBase^2.
static void _invDigitPair(Uint32List args) {
var two = _BigIntImpl.two;
var mask32 = _BigIntImpl._oneDigitMask;
var mask64 = _BigIntImpl._twoDigitMask;
var xl = args[_xDigit]; // Lower 32-bit digit of x.
var y = xl & 3; // y == 1/x mod 2^2
y = (y * (2 - (xl & 0xf) * y)) & 0xf; // y == 1/x mod 2^4

View file

@ -34,17 +34,11 @@ class HashMap<K, V> {
identical(identical, equals)) {
return new _IdentityHashMap<K, V>();
}
if (equals == null) {
equals = _defaultEquals;
}
equals ??= _defaultEquals;
}
} else {
if (hashCode == null) {
hashCode = _defaultHashCode;
}
if (equals == null) {
equals = _defaultEquals;
}
hashCode ??= _defaultHashCode;
equals ??= _defaultEquals;
}
return new _CustomHashMap<K, V>(equals, hashCode, isValidKey);
}
@ -536,17 +530,11 @@ class HashSet<E> {
identical(identical, equals)) {
return new _IdentityHashSet<E>();
}
if (equals == null) {
equals = _defaultEquals;
}
equals ??= _defaultEquals;
}
} else {
if (hashCode == null) {
hashCode = _defaultHashCode;
}
if (equals == null) {
equals = _defaultEquals;
}
hashCode ??= _defaultHashCode;
equals ??= _defaultEquals;
}
return new _CustomHashSet<E>(equals, hashCode, isValidKey);
}
@ -637,9 +625,7 @@ class _HashSet<E> extends _HashSetBase<E> implements HashSet<E> {
}
void addAll(Iterable<E> objects) {
int ctr = 0;
for (E object in objects) {
ctr++;
add(object);
}
}
@ -879,17 +865,11 @@ class LinkedHashMap<K, V> {
identical(identical, equals)) {
return new _CompactLinkedIdentityHashMap<K, V>();
}
if (equals == null) {
equals = _defaultEquals;
}
equals ??= _defaultEquals;
}
} else {
if (hashCode == null) {
hashCode = _defaultHashCode;
}
if (equals == null) {
equals = _defaultEquals;
}
hashCode ??= _defaultHashCode;
equals ??= _defaultEquals;
}
return new _CompactLinkedCustomHashMap<K, V>(equals, hashCode, isValidKey);
}
@ -916,17 +896,11 @@ class LinkedHashSet<E> {
identical(identical, equals)) {
return new _CompactLinkedIdentityHashSet<E>();
}
if (equals == null) {
equals = _defaultEquals;
}
equals ??= _defaultEquals;
}
} else {
if (hashCode == null) {
hashCode = _defaultHashCode;
}
if (equals == null) {
equals = _defaultEquals;
}
hashCode ??= _defaultHashCode;
equals ??= _defaultEquals;
}
return new _CompactLinkedCustomHashSet<E>(equals, hashCode, isValidKey);
}

View file

@ -256,7 +256,6 @@ abstract class _LinkedHashMapMixin<K, V> implements _HashBase {
void operator []=(K key, V value) {
final int size = _index.length;
final int sizeMask = size - 1;
final int fullHash = _hashCode(key);
final int hashPattern = _HashBase._hashPattern(fullHash, _hashMask, size);
final int d = _findValueOrInsertPoint(key, fullHash, hashPattern, size);
@ -270,8 +269,6 @@ abstract class _LinkedHashMapMixin<K, V> implements _HashBase {
V putIfAbsent(K key, V ifAbsent()) {
final int size = _index.length;
final int sizeMask = size - 1;
final int maxEntries = size >> 1;
final int fullHash = _hashCode(key);
final int hashPattern = _HashBase._hashPattern(fullHash, _hashMask, size);
final int d = _findValueOrInsertPoint(key, fullHash, hashPattern, size);

View file

@ -177,7 +177,6 @@ class _BuildJsonListener extends _JsonListener {
}
void arrayElement() {
List list = currentContainer;
currentContainer.add(value);
value = null;
}

View file

@ -57,7 +57,7 @@ class DateTime {
@patch
DateTime._now()
: isUtc = false,
_value = _getCurrentMicros() {}
_value = _getCurrentMicros();
@patch
String get timeZoneName {
@ -180,9 +180,7 @@ class DateTime {
}
get _parts {
if (__parts == null) {
__parts = _computeUpperPart(_localDateInUtcMicros);
}
__parts ??= _computeUpperPart(_localDateInUtcMicros);
return __parts;
}

View file

@ -35,9 +35,7 @@ void log(String message,
if (message is! String) {
throw new ArgumentError.value(message, "message", "Must be a String");
}
if (time == null) {
time = new DateTime.now();
}
time ??= new DateTime.now();
if (time is! DateTime) {
throw new ArgumentError.value(time, "time", "Must be a DateTime");
}

View file

@ -9,9 +9,7 @@ class _Closure implements Function {
bool operator ==(Object other) native "Closure_equals";
int get hashCode {
if (_hash == null) {
_hash = _computeHash();
}
_hash ??= _computeHash();
return _hash;
}

View file

@ -224,7 +224,6 @@ class _GrowableList<T> extends ListBase<T> {
if (length == 1) return this[0];
if (length == 0) throw IterableElementError.noElement();
throw IterableElementError.tooMany();
;
}
// Shared array used as backing for new empty growable arrays.

View file

@ -458,7 +458,7 @@ class Isolate {
packageRootString,
packageConfigString);
return await _spawnCommon(readyPort);
} catch (e, st) {
} catch (e) {
if (readyPort != null) {
readyPort.close();
}
@ -632,7 +632,7 @@ class Isolate {
static Uri _getCurrentRootUri() {
try {
return Uri.parse(_getCurrentRootUriStr());
} catch (e, s) {
} catch (e) {
return null;
}
}

View file

@ -54,7 +54,6 @@ _completeDeferredLoads() {
// which have not completed, remember them for next time in
// stillOutstandingLoadRequests.
var stillOutstandingLoadRequests = new List<List>();
var completedLoadRequests = new List<List>();
// Make a copy of the outstandingRequests because the call to _load below
// may recursively trigger another call to |_completeDeferredLoads|, which

View file

@ -245,7 +245,7 @@ class _Random implements Random {
static const _POW2_27_D = 1.0 * (1 << 27);
// Use a singleton Random object to get a new seed if no seed was passed.
static var _prng = new _Random._withState(_initialSeed());
static final _prng = new _Random._withState(_initialSeed());
// This is a native to prevent 64-bit operations in Dart, which
// fail with --throw_on_javascript_int_overflow.

View file

@ -124,7 +124,6 @@ abstract class _StringBase implements String {
if (charCodes == null) throw new ArgumentError(charCodes);
// TODO(srdjan): Also skip copying of wide typed arrays.
final ccid = ClassID.getID(charCodes);
bool isOneByteString = false;
if ((ccid != ClassID.cidArray) &&
(ccid != ClassID.cidGrowableObjectArray) &&
(ccid != ClassID.cidImmutableArray)) {
@ -139,9 +138,7 @@ abstract class _StringBase implements String {
end = RangeError.checkValidRange(start, end, codeCount);
final len = end - start;
if (len == 0) return "";
if (limit == null) {
limit = _scanCodeUnits(charCodes, start, end);
}
limit ??= _scanCodeUnits(charCodes, start, end);
if (limit < 0) {
throw new ArgumentError(charCodes);
}
@ -368,7 +365,7 @@ abstract class _StringBase implements String {
}
String substring(int startIndex, [int endIndex]) {
if (endIndex == null) endIndex = this.length;
endIndex ??= this.length;
if ((startIndex < 0) || (startIndex > this.length)) {
throw new RangeError.value(startIndex);
@ -623,7 +620,6 @@ abstract class _StringBase implements String {
int replacementLength = replacement.length;
int startIndex = 0;
if (replacementLength == 0) {
int count = 0;
for (Match match in pattern.allMatches(this)) {
length += _addReplaceSlice(matches, startIndex, match.start);
startIndex = match.end;
@ -782,8 +778,8 @@ abstract class _StringBase implements String {
if (pattern is! Pattern) {
throw new ArgumentError("${pattern} is not a Pattern");
}
if (onMatch == null) onMatch = _matchString;
if (onNonMatch == null) onNonMatch = _stringIdentity;
onMatch ??= _matchString;
onNonMatch ??= _stringIdentity;
if (pattern is String) {
String stringPattern = pattern;
if (stringPattern.isEmpty) {

View file

@ -124,7 +124,7 @@ class _Timer implements Timer {
// Timers are ordered by wakeup time. Timers with a timeout value of > 0 do
// end up on the TimerHeap. Timers with a timeout of 0 are queued in a list.
static _TimerHeap _heap = new _TimerHeap();
static final _heap = new _TimerHeap();
static _Timer _firstZeroTimer;
static _Timer _lastZeroTimer;

View file

@ -26,9 +26,7 @@ class Timer {
static Timer _createPeriodicTimer(
Duration duration, void callback(Timer timer)) {
// TODO(iposva): Remove _TimerFactory and use VMLibraryHooks exclusively.
if (_TimerFactory._factory == null) {
_TimerFactory._factory = VMLibraryHooks.timerFactory;
}
_TimerFactory._factory ??= VMLibraryHooks.timerFactory;
if (_TimerFactory._factory == null) {
throw new UnsupportedError("Timer interface not supported.");
}

View file

@ -165,7 +165,7 @@ abstract class _IntListMixin implements List<int> {
}
void shuffle([Random random]) {
if (random == null) random = new Random();
random ??= new Random();
var i = this.length;
while (i > 1) {
int pos = random.nextInt(i);
@ -282,7 +282,6 @@ abstract class _IntListMixin implements List<int> {
int reduce(int combine(int value, int element)) {
var len = this.length;
if (len == 0) throw IterableElementError.noElement();
var i = 0;
var value = this[0];
for (var i = 1; i < len; ++i) {
value = combine(value, this[i]);
@ -330,7 +329,6 @@ abstract class _IntListMixin implements List<int> {
}
int lastWhere(bool test(int element), {int orElse()}) {
var result = null;
var len = this.length;
for (var i = len - 1; i >= 0; --i) {
var element = this[i];
@ -518,7 +516,7 @@ abstract class _DoubleListMixin implements List<double> {
}
void shuffle([Random random]) {
if (random == null) random = new Random();
random ??= new Random();
var i = this.length;
while (i > 1) {
int pos = random.nextInt(i);
@ -637,7 +635,6 @@ abstract class _DoubleListMixin implements List<double> {
double reduce(double combine(double value, double element)) {
var len = this.length;
if (len == 0) throw IterableElementError.noElement();
var i = 0;
var value = this[0];
for (var i = 1; i < len; ++i) {
value = combine(value, this[i]);
@ -686,7 +683,6 @@ abstract class _DoubleListMixin implements List<double> {
}
double lastWhere(bool test(double element), {double orElse()}) {
var result = null;
var len = this.length;
for (var i = len - 1; i >= 0; --i) {
var element = this[i];
@ -874,7 +870,7 @@ abstract class _Float32x4ListMixin implements List<Float32x4> {
}
void shuffle([Random random]) {
if (random == null) random = new Random();
random ??= new Random();
var i = this.length;
while (i > 1) {
int pos = random.nextInt(i);
@ -994,7 +990,6 @@ abstract class _Float32x4ListMixin implements List<Float32x4> {
Float32x4 reduce(Float32x4 combine(Float32x4 value, Float32x4 element)) {
var len = this.length;
if (len == 0) throw IterableElementError.noElement();
var i = 0;
var value = this[0];
for (var i = 1; i < len; ++i) {
value = combine(value, this[i]);
@ -1043,7 +1038,6 @@ abstract class _Float32x4ListMixin implements List<Float32x4> {
}
Float32x4 lastWhere(bool test(Float32x4 element), {Float32x4 orElse()}) {
var result = null;
var len = this.length;
for (var i = len - 1; i >= 0; --i) {
var element = this[i];
@ -1234,7 +1228,7 @@ abstract class _Int32x4ListMixin implements List<Int32x4> {
}
void shuffle([Random random]) {
if (random == null) random = new Random();
random ??= new Random();
var i = this.length;
while (i > 1) {
int pos = random.nextInt(i);
@ -1353,7 +1347,6 @@ abstract class _Int32x4ListMixin implements List<Int32x4> {
Int32x4 reduce(Int32x4 combine(Int32x4 value, Int32x4 element)) {
var len = this.length;
if (len == 0) throw IterableElementError.noElement();
var i = 0;
var value = this[0];
for (var i = 1; i < len; ++i) {
value = combine(value, this[i]);
@ -1402,7 +1395,6 @@ abstract class _Int32x4ListMixin implements List<Int32x4> {
}
Int32x4 lastWhere(bool test(Int32x4 element), {Int32x4 orElse()}) {
var result = null;
var len = this.length;
for (var i = len - 1; i >= 0; --i) {
var element = this[i];
@ -1593,7 +1585,7 @@ abstract class _Float64x2ListMixin implements List<Float64x2> {
}
void shuffle([Random random]) {
if (random == null) random = new Random();
random ??= new Random();
var i = this.length;
while (i > 1) {
int pos = random.nextInt(i);
@ -1713,7 +1705,6 @@ abstract class _Float64x2ListMixin implements List<Float64x2> {
Float64x2 reduce(Float64x2 combine(Float64x2 value, Float64x2 element)) {
var len = this.length;
if (len == 0) throw IterableElementError.noElement();
var i = 0;
var value = this[0];
for (var i = 1; i < len; ++i) {
value = combine(value, this[i]);
@ -1762,7 +1753,6 @@ abstract class _Float64x2ListMixin implements List<Float64x2> {
}
Float64x2 lastWhere(bool test(Float64x2 element), {Float64x2 orElse()}) {
var result = null;
var len = this.length;
for (var i = len - 1; i >= 0; --i) {
var element = this[i];
@ -1913,118 +1903,88 @@ class _ByteBuffer implements ByteBuffer {
(other is _ByteBuffer) && identical(_data, other._data);
ByteData asByteData([int offsetInBytes = 0, int length]) {
if (length == null) {
length = this.lengthInBytes - offsetInBytes;
}
length ??= this.lengthInBytes - offsetInBytes;
return new _ByteDataView(this._data, offsetInBytes, length);
}
Int8List asInt8List([int offsetInBytes = 0, int length]) {
if (length == null) {
length = this.lengthInBytes - offsetInBytes;
}
length ??= this.lengthInBytes - offsetInBytes;
return new _Int8ArrayView(this, offsetInBytes, length);
}
Uint8List asUint8List([int offsetInBytes = 0, int length]) {
if (length == null) {
length = this.lengthInBytes - offsetInBytes;
}
length ??= this.lengthInBytes - offsetInBytes;
return new _Uint8ArrayView(this, offsetInBytes, length);
}
Uint8ClampedList asUint8ClampedList([int offsetInBytes = 0, int length]) {
if (length == null) {
length = this.lengthInBytes - offsetInBytes;
}
length ??= this.lengthInBytes - offsetInBytes;
return new _Uint8ClampedArrayView(this, offsetInBytes, length);
}
Int16List asInt16List([int offsetInBytes = 0, int length]) {
if (length == null) {
length =
(this.lengthInBytes - offsetInBytes) ~/ Int16List.bytesPerElement;
}
length ??=
(this.lengthInBytes - offsetInBytes) ~/ Int16List.bytesPerElement;
return new _Int16ArrayView(this, offsetInBytes, length);
}
Uint16List asUint16List([int offsetInBytes = 0, int length]) {
if (length == null) {
length =
(this.lengthInBytes - offsetInBytes) ~/ Uint16List.bytesPerElement;
}
length ??=
(this.lengthInBytes - offsetInBytes) ~/ Uint16List.bytesPerElement;
return new _Uint16ArrayView(this, offsetInBytes, length);
}
Int32List asInt32List([int offsetInBytes = 0, int length]) {
if (length == null) {
length =
(this.lengthInBytes - offsetInBytes) ~/ Int32List.bytesPerElement;
}
length ??=
(this.lengthInBytes - offsetInBytes) ~/ Int32List.bytesPerElement;
return new _Int32ArrayView(this, offsetInBytes, length);
}
Uint32List asUint32List([int offsetInBytes = 0, int length]) {
if (length == null) {
length =
(this.lengthInBytes - offsetInBytes) ~/ Uint32List.bytesPerElement;
}
length ??=
(this.lengthInBytes - offsetInBytes) ~/ Uint32List.bytesPerElement;
return new _Uint32ArrayView(this, offsetInBytes, length);
}
Int64List asInt64List([int offsetInBytes = 0, int length]) {
if (length == null) {
length =
(this.lengthInBytes - offsetInBytes) ~/ Int64List.bytesPerElement;
}
length ??=
(this.lengthInBytes - offsetInBytes) ~/ Int64List.bytesPerElement;
return new _Int64ArrayView(this, offsetInBytes, length);
}
Uint64List asUint64List([int offsetInBytes = 0, int length]) {
if (length == null) {
length =
(this.lengthInBytes - offsetInBytes) ~/ Uint64List.bytesPerElement;
}
length ??=
(this.lengthInBytes - offsetInBytes) ~/ Uint64List.bytesPerElement;
return new _Uint64ArrayView(this, offsetInBytes, length);
}
Float32List asFloat32List([int offsetInBytes = 0, int length]) {
if (length == null) {
length =
(this.lengthInBytes - offsetInBytes) ~/ Float32List.bytesPerElement;
}
length ??=
(this.lengthInBytes - offsetInBytes) ~/ Float32List.bytesPerElement;
return new _Float32ArrayView(this, offsetInBytes, length);
}
Float64List asFloat64List([int offsetInBytes = 0, int length]) {
if (length == null) {
length =
(this.lengthInBytes - offsetInBytes) ~/ Float64List.bytesPerElement;
}
length ??=
(this.lengthInBytes - offsetInBytes) ~/ Float64List.bytesPerElement;
return new _Float64ArrayView(this, offsetInBytes, length);
}
Float32x4List asFloat32x4List([int offsetInBytes = 0, int length]) {
if (length == null) {
length =
(this.lengthInBytes - offsetInBytes) ~/ Float32x4List.bytesPerElement;
}
length ??=
(this.lengthInBytes - offsetInBytes) ~/ Float32x4List.bytesPerElement;
return new _Float32x4ArrayView(this, offsetInBytes, length);
}
Int32x4List asInt32x4List([int offsetInBytes = 0, int length]) {
if (length == null) {
length =
(this.lengthInBytes - offsetInBytes) ~/ Int32x4List.bytesPerElement;
}
length ??=
(this.lengthInBytes - offsetInBytes) ~/ Int32x4List.bytesPerElement;
return new _Int32x4ArrayView(this, offsetInBytes, length);
}
Float64x2List asFloat64x2List([int offsetInBytes = 0, int length]) {
if (length == null) {
length =
(this.lengthInBytes - offsetInBytes) ~/ Float64x2List.bytesPerElement;
}
length ??=
(this.lengthInBytes - offsetInBytes) ~/ Float64x2List.bytesPerElement;
return new _Float64x2ArrayView(this, offsetInBytes, length);
}
}
@ -3572,7 +3532,7 @@ abstract class _TypedListView extends _TypedListBase implements TypedData {
_TypedListView(_ByteBuffer _buffer, int _offset, int _length)
: _typedData = _buffer._data,
offsetInBytes = _offset,
length = _length {}
length = _length;
// Method(s) implementing the TypedData interface.