[VM/libraries] Fix final set of warnings in dart:core and dart:typed_data

Change-Id: If05b13eba924fbeaad2a82598a5255f12ba6b1b0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133323
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
This commit is contained in:
asiva 2020-01-27 19:51:14 +00:00 committed by commit-bot@chromium.org
parent 38b8dc7b21
commit c2fb631d99
13 changed files with 39 additions and 30 deletions

View file

@ -0,0 +1,2 @@
ERROR|STATIC_WARNING|NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER|lib/core/core.dart|3894|7|16|Missing concrete implementations of 'getter Error._stackTrace' and 'setter Error._stackTrace'.
ERROR|STATIC_WARNING|NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER|lib/core/core.dart|3902|7|18|Missing concrete implementations of 'getter Error._stackTrace' and 'setter Error._stackTrace'.

View file

@ -175,11 +175,11 @@ class _ImmutableList<E> extends UnmodifiableListBase<E> {
final int actualEnd = RangeError.checkValidRange(start, end, this.length);
int length = actualEnd - start;
if (length == 0) return <E>[];
List list = new _List(length);
final list = new _List(length);
for (int i = 0; i < length; i++) {
list[i] = this[start + i];
}
var result = new _GrowableList<E>._withData(list);
final result = new _GrowableList<E>._withData(list);
result._setLength(length);
return result;
}

View file

@ -81,7 +81,7 @@ class List<E> {
if (elements.isEmpty) {
return new _GrowableList<E>(0);
}
var result = new _GrowableList<E>._withData(elements);
final result = new _GrowableList<E>._withData(unsafeCast<_List>(elements));
result._setLength(elements.length);
return result;
}

View file

@ -1832,7 +1832,7 @@ class _BigIntImpl implements BigInt {
}
return z._revert(resultDigits, resultUsed);
}
var k;
late int k;
if (exponentBitlen < 18)
k = 1;
else if (exponentBitlen < 48)
@ -1845,7 +1845,7 @@ class _BigIntImpl implements BigInt {
k = 6;
_BigIntReduction z = new _BigIntMontgomeryReduction(modulus);
var n = 3;
final k1 = k - 1;
final int k1 = k - 1;
final km = (1 << k) - 1;
List gDigits = new List.filled(km + 1, null);
List gUsed = new List.filled(km + 1, null);
@ -1869,7 +1869,7 @@ class _BigIntImpl implements BigInt {
var result2Used;
var exponentDigits = exponent._digits;
var j = exponent._used - 1;
var i = exponentDigits[j].bitLength - 1;
int i = exponentDigits[j].bitLength - 1;
while (j >= 0) {
if (i >= k1) {
w = (exponentDigits[j] >> (i - k1)) & km;

View file

@ -119,18 +119,18 @@ class DateTime {
int days = daysSince1970;
days += DAYS_OFFSET;
resultYear = 400 * (days ~/ DAYS_IN_400_YEARS) - YEARS_OFFSET;
days = days.remainder(DAYS_IN_400_YEARS);
days = unsafeCast<int>(days.remainder(DAYS_IN_400_YEARS));
days--;
int yd1 = days ~/ DAYS_IN_100_YEARS;
days = days.remainder(DAYS_IN_100_YEARS);
days = unsafeCast<int>(days.remainder(DAYS_IN_100_YEARS));
resultYear += 100 * yd1;
days++;
int yd2 = days ~/ DAYS_IN_4_YEARS;
days = days.remainder(DAYS_IN_4_YEARS);
days = unsafeCast<int>(days.remainder(DAYS_IN_4_YEARS));
resultYear += 4 * yd2;
days--;
int yd3 = days ~/ 365;
days = days.remainder(365);
days = unsafeCast<int>(days.remainder(365));
resultYear += yd3;
bool isLeap = (yd1 == 0 || yd2 != 0) && yd3 == 0;

View file

@ -283,8 +283,8 @@ class NoSuchMethodError {
// Use deprecated version of toString.
return _toStringDeprecated();
}
String memberName =
internal.Symbol.computeUnmangledName(localInvocation.memberName);
var internalName = localInvocation.memberName as internal.Symbol;
String memberName = internal.Symbol.computeUnmangledName(internalName);
var level = (localInvocation._type >> _InvocationMirror._LEVEL_SHIFT) &
_InvocationMirror._LEVEL_MASK;
@ -325,7 +325,8 @@ class NoSuchMethodError {
if (argumentCount > 0) {
argumentsBuf.write(", ");
}
argumentsBuf.write(internal.Symbol.computeUnmangledName(key));
var internalName = key as internal.Symbol;
argumentsBuf.write(internal.Symbol.computeUnmangledName(internalName));
argumentsBuf.write(": ");
argumentsBuf.write(Error.safeToString(value));
argumentCount++;
@ -437,7 +438,7 @@ class NoSuchMethodError {
var type = _invocationType & _InvocationMirror._KIND_MASK;
String memberName = (_memberName == null)
? ""
: internal.Symbol.computeUnmangledName(_memberName);
: internal.Symbol.computeUnmangledName(_memberName as internal.Symbol);
if (type == _InvocationMirror._LOCAL_VAR) {
return "NoSuchMethodError: Cannot assign to final variable '$memberName'";
@ -458,7 +459,8 @@ class NoSuchMethodError {
if (argumentCount > 0) {
arguments.write(", ");
}
arguments.write(internal.Symbol.computeUnmangledName(key));
var internalName = key as internal.Symbol;
arguments.write(internal.Symbol.computeUnmangledName(internalName));
arguments.write(": ");
arguments.write(Error.safeToString(value));
argumentCount++;

View file

@ -28,7 +28,7 @@ class Function {
if (numNamedArguments > 0) {
namedArguments?.forEach((name, value) {
arguments[argumentIndex++] = value;
names[nameIndex++] = internal.Symbol.getName(name);
names[nameIndex++] = internal.Symbol.getName(name as internal.Symbol);
});
}
return _apply(arguments, names);

View file

@ -77,11 +77,11 @@ class _GrowableList<T> extends ListBase<T> {
final int actualEnd = RangeError.checkValidRange(start, end, this.length);
int length = actualEnd - start;
if (length == 0) return <T>[];
List list = new _List(length);
final list = new _List(length);
for (int i = 0; i < length; i++) {
list[i] = this[start + i];
}
var result = new _GrowableList<T>._withData(list);
final result = new _GrowableList<T>._withData(list);
result._setLength(length);
return result;
}

View file

@ -637,10 +637,14 @@ class _Smi extends _IntegerImplementation {
} while (smi >= 100);
if (smi < 10) {
// Character code for '0'.
result._setAt(index, DIGIT_ZERO + smi);
// Issue(https://dartbug.com/39639): The analyzer incorrectly reports the
// result type as `num`.
result._setAt(index, unsafeCast<int>(DIGIT_ZERO + smi));
} else {
// No remainder for this case.
int digitIndex = smi * 2;
// Issue(https://dartbug.com/39639): The analyzer incorrectly reports the
// result type as `num`.
int digitIndex = unsafeCast<int>(smi * 2);
result._setAt(index, _digitTable[digitIndex + 1]);
result._setAt(index - 1, _digitTable[digitIndex]);
}
@ -694,7 +698,7 @@ class _Smi extends _IntegerImplementation {
result._setAt(0, MINUS_SIGN); // '-'.
int index = digitCount;
do {
var twoDigits = negSmi.remainder(100);
int twoDigits = unsafeCast<int>(negSmi.remainder(100));
negSmi = negSmi ~/ 100;
int digitIndex = -twoDigits * 2;
result._setAt(index, _digitTable[digitIndex + 1]);

View file

@ -134,9 +134,9 @@ class _InvocationMirror implements Invocation {
final namedArguments = new Map<Symbol, dynamic>();
for (int i = 0; i < numNamedArguments; i++) {
int namedEntryIndex = _FIRST_NAMED_ENTRY + 2 * i;
int pos = argsDescriptor[namedEntryIndex + 1];
String arg_name = argsDescriptor[namedEntryIndex];
var arg_value =
_arguments![receiverIndex + argsDescriptor[namedEntryIndex + 1]];
var arg_value = _arguments![receiverIndex + pos];
namedArguments[new internal.Symbol.unvalidated(arg_name)] = arg_value;
}
_namedArguments = new Map.unmodifiable(namedArguments);

View file

@ -219,7 +219,7 @@ class _RegExp implements RegExp {
RegExpMatch? firstMatch(String input) {
// TODO: Remove these null checks once all code is opted into strong nonnullable mode.
if (input == null) throw new ArgumentError.notNull('input');
List? match = _ExecuteMatch(input, 0);
final match = _ExecuteMatch(input, 0);
if (match == null) {
return null;
}
@ -243,7 +243,7 @@ class _RegExp implements RegExp {
if (start < 0 || start > string.length) {
throw new RangeError.range(start, 0, string.length);
}
List? list = _ExecuteMatchSticky(string, start);
final list = _ExecuteMatchSticky(string, start);
if (list == null) return null;
return new _RegExpMatch._(this, string, list);
}
@ -344,9 +344,10 @@ class _RegExp implements RegExp {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
];
List? _ExecuteMatch(String str, int start_index) native "RegExp_ExecuteMatch";
List<int>? _ExecuteMatch(String str, int start_index)
native "RegExp_ExecuteMatch";
List? _ExecuteMatchSticky(String str, int start_index)
List<int>? _ExecuteMatchSticky(String str, int start_index)
native "RegExp_ExecuteMatchSticky";
}
@ -383,7 +384,7 @@ class _AllMatchesIterator implements Iterator<RegExpMatch> {
final re = _re;
if (re == null) return false; // Cleared after a failed match.
if (_nextIndex <= _str.length) {
var match = re._ExecuteMatch(_str, _nextIndex);
final match = re._ExecuteMatch(_str, _nextIndex);
if (match != null) {
var current = new _RegExpMatch._(re, _str, match);
_current = current;

View file

@ -127,7 +127,7 @@ class StringBuffer {
final localParts = _parts;
return (_partsCodeUnits == 0 || localParts == null)
? ""
: _StringBase._concatRange(_parts, 0, localParts.length);
: _StringBase._concatRange(localParts, 0, localParts.length);
}
/** Ensures that the buffer has enough capacity to add n code units. */

View file

@ -3827,7 +3827,7 @@ class _TypedListIterator<E> implements Iterator<E> {
int _position;
E? _current;
_TypedListIterator(List array)
_TypedListIterator(List<E> array)
: _array = array,
_length = array.length,
_position = -1 {