mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 00:58:29 +00:00
[VM/Libraries] Fix all errors reported by CFE when the option
performNnbdChecks is turned on. Bug:40424 Change-Id: I97a283c4a2d54f570def04d938baa9a4ced08667 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137250 Commit-Queue: Siva Annamalai <asiva@google.com> Reviewed-by: Alexander Markov <alexmarkov@google.com>
This commit is contained in:
parent
e211bd28c1
commit
75de086f1d
|
@ -6,21 +6,16 @@ ERROR|COMPILE_TIME_ERROR|INCONSISTENT_INHERITANCE|lib/_internal/js_runtime/lib/i
|
|||
ERROR|COMPILE_TIME_ERROR|INCONSISTENT_INHERITANCE|lib/_internal/js_runtime/lib/interceptors.dart|1637|7|5|Superinterfaces don't have a valid override for '>>': int.>> (int Function(int)), JSNumber.>> (num Function(num)).
|
||||
ERROR|COMPILE_TIME_ERROR|INCONSISTENT_INHERITANCE|lib/_internal/js_runtime/lib/interceptors.dart|1637|7|5|Superinterfaces don't have a valid override for '\|': int.\| (int Function(int)), JSNumber.\| (num Function(num)).
|
||||
ERROR|COMPILE_TIME_ERROR|INCONSISTENT_INHERITANCE|lib/_internal/js_runtime/lib/interceptors.dart|1637|7|5|Superinterfaces don't have a valid override for '^': int.^ (int Function(int)), JSNumber.^ (num Function(num)).
|
||||
ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|1003|10|5|Non-nullable instance field 'value' must be initialized.
|
||||
ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|1029|8|6|Non-nullable instance field 'secure' must be initialized.
|
||||
ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|1035|8|8|Non-nullable instance field 'httpOnly' must be initialized.
|
||||
ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|1491|12|11|Non-nullable instance field 'idleTimeout' must be initialized.
|
||||
ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|1541|8|14|Non-nullable instance field 'autoUncompress' must be initialized.
|
||||
ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|171|8|12|Non-nullable instance field 'autoCompress' must be initialized.
|
||||
ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|990|10|4|Non-nullable instance field 'name' must be initialized.
|
||||
ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|1004|10|5|Non-nullable instance field 'value' must be initialized.
|
||||
ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|1030|8|6|Non-nullable instance field 'secure' must be initialized.
|
||||
ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|1036|8|8|Non-nullable instance field 'httpOnly' must be initialized.
|
||||
ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|1493|12|11|Non-nullable instance field 'idleTimeout' must be initialized.
|
||||
ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|1543|8|14|Non-nullable instance field 'autoUncompress' must be initialized.
|
||||
ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|172|8|12|Non-nullable instance field 'autoCompress' must be initialized.
|
||||
ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|991|10|4|Non-nullable instance field 'name' must be initialized.
|
||||
ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/io/io.dart|5589|12|8|Non-nullable instance field 'encoding' must be initialized.
|
||||
ERROR|STATIC_TYPE_WARNING|UNDEFINED_OPERATOR|lib/_internal/js_runtime/lib/interceptors.dart|1654|28|1|The operator '&' isn't defined for the type 'JSInt'.
|
||||
ERROR|STATIC_TYPE_WARNING|UNDEFINED_OPERATOR|lib/_internal/js_runtime/lib/interceptors.dart|1656|27|1|The operator '&' isn't defined for the type 'JSInt'.
|
||||
ERROR|STATIC_TYPE_WARNING|UNDEFINED_OPERATOR|lib/_internal/js_runtime/lib/interceptors.dart|1659|17|1|The operator '&' isn't defined for the type 'JSInt'.
|
||||
ERROR|STATIC_TYPE_WARNING|UNDEFINED_OPERATOR|lib/_internal/js_runtime/lib/interceptors.dart|1664|18|1|The operator '&' isn't defined for the type 'JSInt'.
|
||||
ERROR|STATIC_TYPE_WARNING|UNDEFINED_OPERATOR|lib/_internal/js_runtime/lib/interceptors.dart|1664|44|1|The operator '&' isn't defined for the type 'JSInt'.
|
||||
WARNING|STATIC_WARNING|DEAD_NULL_AWARE_EXPRESSION|lib/_http/http.dart|1476|39|5|The left operand can't be null, so the right operand is never executed.
|
||||
WARNING|STATIC_WARNING|DEAD_NULL_AWARE_EXPRESSION|lib/_http/http.dart|8384|60|5|The left operand can't be null, so the right operand is never executed.
|
||||
WARNING|STATIC_WARNING|DEAD_NULL_AWARE_EXPRESSION|lib/_http/http.dart|9311|54|5|The left operand can't be null, so the right operand is never executed.
|
||||
WARNING|STATIC_WARNING|DEAD_NULL_AWARE_EXPRESSION|lib/developer/developer.dart|315|25|23|The left operand can't be null, so the right operand is never executed.
|
||||
WARNING|STATIC_WARNING|DEAD_NULL_AWARE_EXPRESSION|lib/io/io.dart|9188|16|1|The left operand can't be null, so the right operand is never executed.
|
||||
|
|
|
@ -15,16 +15,11 @@ ERROR|COMPILE_TIME_ERROR|BODY_MIGHT_COMPLETE_NORMALLY|lib/_internal/js_dev_runti
|
|||
ERROR|COMPILE_TIME_ERROR|BODY_MIGHT_COMPLETE_NORMALLY|lib/_internal/js_dev_runtime/private/foreign_helper.dart|221|8|37|The body might complete normally, which would cause 'null' to be returned, but the return type is a potentially non-nullable type.
|
||||
ERROR|COMPILE_TIME_ERROR|BODY_MIGHT_COMPLETE_NORMALLY|lib/_internal/js_dev_runtime/private/foreign_helper.dart|224|8|11|The body might complete normally, which would cause 'null' to be returned, but the return type is a potentially non-nullable type.
|
||||
ERROR|COMPILE_TIME_ERROR|BODY_MIGHT_COMPLETE_NORMALLY|lib/_internal/js_dev_runtime/private/foreign_helper.dart|228|6|11|The body might complete normally, which would cause 'null' to be returned, but the return type is a potentially non-nullable type.
|
||||
ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|1003|10|5|Non-nullable instance field 'value' must be initialized.
|
||||
ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|1029|8|6|Non-nullable instance field 'secure' must be initialized.
|
||||
ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|1035|8|8|Non-nullable instance field 'httpOnly' must be initialized.
|
||||
ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|1491|12|11|Non-nullable instance field 'idleTimeout' must be initialized.
|
||||
ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|1541|8|14|Non-nullable instance field 'autoUncompress' must be initialized.
|
||||
ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|171|8|12|Non-nullable instance field 'autoCompress' must be initialized.
|
||||
ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|990|10|4|Non-nullable instance field 'name' must be initialized.
|
||||
ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|1004|10|5|Non-nullable instance field 'value' must be initialized.
|
||||
ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|1030|8|6|Non-nullable instance field 'secure' must be initialized.
|
||||
ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|1036|8|8|Non-nullable instance field 'httpOnly' must be initialized.
|
||||
ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|1493|12|11|Non-nullable instance field 'idleTimeout' must be initialized.
|
||||
ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|1543|8|14|Non-nullable instance field 'autoUncompress' must be initialized.
|
||||
ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|172|8|12|Non-nullable instance field 'autoCompress' must be initialized.
|
||||
ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|991|10|4|Non-nullable instance field 'name' must be initialized.
|
||||
ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/io/io.dart|5589|12|8|Non-nullable instance field 'encoding' must be initialized.
|
||||
WARNING|STATIC_WARNING|DEAD_NULL_AWARE_EXPRESSION|lib/_http/http.dart|1476|39|5|The left operand can't be null, so the right operand is never executed.
|
||||
WARNING|STATIC_WARNING|DEAD_NULL_AWARE_EXPRESSION|lib/_http/http.dart|8384|60|5|The left operand can't be null, so the right operand is never executed.
|
||||
WARNING|STATIC_WARNING|DEAD_NULL_AWARE_EXPRESSION|lib/_http/http.dart|9311|54|5|The left operand can't be null, so the right operand is never executed.
|
||||
WARNING|STATIC_WARNING|DEAD_NULL_AWARE_EXPRESSION|lib/developer/developer.dart|332|25|23|The left operand can't be null, so the right operand is never executed.
|
||||
WARNING|STATIC_WARNING|DEAD_NULL_AWARE_EXPRESSION|lib/io/io.dart|9188|16|1|The left operand can't be null, so the right operand is never executed.
|
||||
|
|
|
@ -16,7 +16,8 @@ import 'dart:collection'
|
|||
UnmodifiableMapView;
|
||||
import 'dart:convert';
|
||||
import 'dart:developer' hide log;
|
||||
import 'dart:_internal' show Since, HttpStatus;
|
||||
import 'dart:_internal'
|
||||
show Since, valueOfNonNullableParamWithDefault, HttpStatus;
|
||||
import 'dart:math';
|
||||
import 'dart:io';
|
||||
import 'dart:typed_data';
|
||||
|
@ -1473,7 +1474,8 @@ abstract class HttpClient {
|
|||
///
|
||||
/// Default is `false`.
|
||||
static set enableTimelineLogging(bool value) {
|
||||
_enableTimelineLogging = value ?? false;
|
||||
_enableTimelineLogging =
|
||||
valueOfNonNullableParamWithDefault<bool>(value, false);
|
||||
}
|
||||
|
||||
/// Current state of HTTP request logging from all [HttpClient]s to the
|
||||
|
|
|
@ -883,7 +883,9 @@ class _HttpParser extends Stream<_HttpIncoming> {
|
|||
bool get upgrade => _connectionUpgrade && _state == _State.UPGRADED;
|
||||
bool get persistentConnection => _persistentConnection;
|
||||
|
||||
void set isHead(bool value) => _noMessageBody = value ?? false;
|
||||
void set isHead(bool value) {
|
||||
_noMessageBody = valueOfNonNullableParamWithDefault<bool>(value, false);
|
||||
}
|
||||
|
||||
_HttpDetachedIncoming detachIncoming() {
|
||||
// Simulate detached by marking as upgraded.
|
||||
|
|
|
@ -407,7 +407,7 @@ abstract class WebSocket
|
|||
"explicitly to WebSocket.fromUpgradedSocket.");
|
||||
}
|
||||
return new _WebSocketImpl._fromSocket(
|
||||
socket, protocol, compression, serverSide ?? false);
|
||||
socket, protocol, compression, serverSide);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -33,15 +33,15 @@ void _print(arg) {
|
|||
_getPrintClosure() => _print;
|
||||
|
||||
// The current working directory when the embedder was launched.
|
||||
Uri _workingDirectory;
|
||||
late Uri _workingDirectory;
|
||||
|
||||
// The URI that the root script was loaded from. Remembered so that
|
||||
// package imports can be resolved relative to it. The root script is the basis
|
||||
// for the root library in the VM.
|
||||
Uri _rootScript;
|
||||
Uri? _rootScript;
|
||||
|
||||
// packagesConfig specified for the isolate.
|
||||
Uri _packagesConfigUri;
|
||||
Uri? _packagesConfigUri;
|
||||
|
||||
// Packages are either resolved looking up in a map or resolved from within a
|
||||
// package root.
|
||||
|
@ -50,11 +50,11 @@ bool get _packagesReady => (_packageMap != null) || (_packageError != null);
|
|||
// Error string set if there was an error resolving package configuration.
|
||||
// For example not finding a .packages file or packages/ directory, malformed
|
||||
// .packages file or any other related error.
|
||||
String _packageError = null;
|
||||
String? _packageError = null;
|
||||
|
||||
// The map describing how certain package names are mapped to Uris.
|
||||
Uri _packageConfig = null;
|
||||
Map<String, Uri> _packageMap = null;
|
||||
Uri? _packageConfig = null;
|
||||
Map<String, Uri>? _packageMap = null;
|
||||
|
||||
// Special handling for Windows paths so that they are compatible with URI
|
||||
// handling.
|
||||
|
@ -128,11 +128,12 @@ Uri _resolvePackageUri(Uri uri) {
|
|||
_log('Resolving package with uri path: ${uri.path}');
|
||||
}
|
||||
var resolvedUri;
|
||||
if (_packageError != null) {
|
||||
final error = _packageError;
|
||||
if (error != null) {
|
||||
if (_traceLoading) {
|
||||
_log("Resolving package with pending resolution error: $_packageError");
|
||||
_log("Resolving package with pending resolution error: $error");
|
||||
}
|
||||
throw _packageError;
|
||||
throw error;
|
||||
} else {
|
||||
if (packageNameEnd < 0) {
|
||||
// Package URIs must have a path after the package name, even if it's
|
||||
|
@ -141,7 +142,7 @@ Uri _resolvePackageUri(Uri uri) {
|
|||
"'package:${uri.path}/', not 'package:${uri.path}'";
|
||||
}
|
||||
var packageName = uri.path.substring(0, packageNameEnd);
|
||||
var mapping = _packageMap[packageName];
|
||||
final mapping = _packageMap![packageName];
|
||||
if (_traceLoading) {
|
||||
_log("Mapped '$packageName' package to '$mapping'");
|
||||
}
|
||||
|
@ -162,14 +163,14 @@ Uri _resolvePackageUri(Uri uri) {
|
|||
return resolvedUri;
|
||||
}
|
||||
|
||||
void _requestPackagesMap(Uri packageConfig) {
|
||||
void _requestPackagesMap(Uri? packageConfig) {
|
||||
var msg = null;
|
||||
if (packageConfig != null) {
|
||||
// Explicitly specified .packages path.
|
||||
msg = _handlePackagesRequest(_traceLoading, -2, packageConfig);
|
||||
} else {
|
||||
// Search for .packages starting at the root script.
|
||||
msg = _handlePackagesRequest(_traceLoading, -1, _rootScript);
|
||||
msg = _handlePackagesRequest(_traceLoading, -1, _rootScript!);
|
||||
}
|
||||
if (_traceLoading) {
|
||||
_log("Requested packages map for '$_rootScript'.");
|
||||
|
@ -186,10 +187,11 @@ void _requestPackagesMap(Uri packageConfig) {
|
|||
assert(msg.length >= 2);
|
||||
assert(msg[1] == null);
|
||||
_packageConfig = Uri.parse(msg[0]);
|
||||
_packageMap = new Map<String, Uri>();
|
||||
final pmap = new Map<String, Uri>();
|
||||
_packageMap = pmap;
|
||||
for (var i = 2; i < msg.length; i += 2) {
|
||||
// TODO(iposva): Complain about duplicate entries.
|
||||
_packageMap[msg[i]] = Uri.parse(msg[i + 1]);
|
||||
pmap[msg[i]] = Uri.parse(msg[i + 1]);
|
||||
}
|
||||
if (_traceLoading) {
|
||||
_log("Setup package map: $_packageMap");
|
||||
|
@ -591,9 +593,6 @@ String _setPackagesMap(String packagesParam) {
|
|||
if (_traceLoading) {
|
||||
_log("Resolving packages map: $packagesParam");
|
||||
}
|
||||
if (_workingDirectory == null) {
|
||||
throw 'No current working directory set.';
|
||||
}
|
||||
var packagesName = _sanitizeWindowsPath(packagesParam);
|
||||
var packagesUri = Uri.parse(packagesName);
|
||||
if (packagesUri.scheme == '') {
|
||||
|
@ -616,9 +615,6 @@ String _resolveScriptUri(String scriptName) {
|
|||
if (_traceLoading) {
|
||||
_log("Resolving script: $scriptName");
|
||||
}
|
||||
if (_workingDirectory == null) {
|
||||
throw 'No current working directory set.';
|
||||
}
|
||||
scriptName = _sanitizeWindowsPath(scriptName);
|
||||
|
||||
var scriptUri = Uri.parse(scriptName);
|
||||
|
@ -657,7 +653,7 @@ Future<Uri> _getPackageConfigFuture() {
|
|||
return Future.value(_packageConfig);
|
||||
}
|
||||
|
||||
Future<Uri> _resolvePackageUriFuture(Uri packageUri) {
|
||||
Future<Uri?> _resolvePackageUriFuture(Uri packageUri) {
|
||||
if (_traceLoading) {
|
||||
_log("Request for package Uri resolution from user code: $packageUri");
|
||||
}
|
||||
|
@ -671,7 +667,7 @@ Future<Uri> _resolvePackageUriFuture(Uri packageUri) {
|
|||
if (!_packagesReady) {
|
||||
_requestPackagesMap(_packagesConfigUri);
|
||||
}
|
||||
Uri resolvedUri;
|
||||
Uri? resolvedUri;
|
||||
try {
|
||||
resolvedUri = _resolvePackageUri(packageUri);
|
||||
} catch (e, s) {
|
||||
|
|
|
@ -45,7 +45,7 @@ Future<Server>? serverFuture;
|
|||
Server _lazyServerBoot() {
|
||||
var localServer = server;
|
||||
if (localServer != null) {
|
||||
return server;
|
||||
return localServer;
|
||||
}
|
||||
// Lazily create service.
|
||||
final service = VMService();
|
||||
|
|
|
@ -383,11 +383,11 @@ class Server {
|
|||
client.onRequest(message); // exception free, no need to try catch
|
||||
}
|
||||
|
||||
Future<void> _dumpServiceInfoToFile() async {
|
||||
Future<void> _dumpServiceInfoToFile(String serviceInfoFilenameLocal) async {
|
||||
final serviceInfo = <String, dynamic>{
|
||||
'uri': serverAddress.toString(),
|
||||
};
|
||||
final file = File.fromUri(Uri.parse(_serviceInfoFilename));
|
||||
final file = File.fromUri(Uri.parse(serviceInfoFilenameLocal));
|
||||
return file.writeAsString(json.encode(serviceInfo));
|
||||
}
|
||||
|
||||
|
@ -456,7 +456,7 @@ class Server {
|
|||
final serviceInfoFilenameLocal = _serviceInfoFilename;
|
||||
if (serviceInfoFilenameLocal != null &&
|
||||
serviceInfoFilenameLocal.isNotEmpty) {
|
||||
await _dumpServiceInfoToFile();
|
||||
await _dumpServiceInfoToFile(serviceInfoFilenameLocal);
|
||||
}
|
||||
// Server is up and running.
|
||||
_notifyServerState(serverAddress.toString());
|
||||
|
|
|
@ -18,20 +18,20 @@ import "dart:isolate" show SendPort;
|
|||
// part "timeline.dart"
|
||||
|
||||
@patch
|
||||
bool debugger({bool when: true, String message}) native "Developer_debugger";
|
||||
bool debugger({bool when: true, String? message}) native "Developer_debugger";
|
||||
|
||||
@patch
|
||||
Object inspect(Object object) native "Developer_inspect";
|
||||
|
||||
@patch
|
||||
void log(String message,
|
||||
{DateTime time,
|
||||
int sequenceNumber,
|
||||
{DateTime? time,
|
||||
int? sequenceNumber,
|
||||
int level: 0,
|
||||
String name: '',
|
||||
Zone zone,
|
||||
Object error,
|
||||
StackTrace stackTrace}) {
|
||||
Zone? zone,
|
||||
Object? error,
|
||||
StackTrace? stackTrace}) {
|
||||
if (message is! String) {
|
||||
throw new ArgumentError.value(message, "message", "Must be a String");
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ void log(String message,
|
|||
int _nextSequenceNumber = 0;
|
||||
|
||||
_log(String message, int timestamp, int sequenceNumber, int level, String name,
|
||||
Zone zone, Object error, StackTrace stackTrace) native "Developer_log";
|
||||
Zone? zone, Object? error, StackTrace? stackTrace) native "Developer_log";
|
||||
|
||||
@patch
|
||||
void _postEvent(String eventKind, String eventData)
|
||||
|
|
|
@ -29,7 +29,7 @@ int sizeOf<T extends NativeType>() {
|
|||
// This is not super fast, but it is faster than a runtime entry.
|
||||
// Hot loops with elementAt().load() do not use this sizeOf, elementAt is
|
||||
// optimized per NativeType statically to prevent use of sizeOf at runtime.
|
||||
final int knownSize = _knownSizes[T];
|
||||
final int? knownSize = _knownSizes[T];
|
||||
if (knownSize != null) return knownSize;
|
||||
if (T == IntPtr) return _intPtrSize;
|
||||
if (T == Pointer) return _intPtrSize;
|
||||
|
@ -84,7 +84,7 @@ class Pointer<T extends NativeType> {
|
|||
@patch
|
||||
static Pointer<NativeFunction<T>> fromFunction<T extends Function>(
|
||||
@DartRepresentationOf("T") Function f,
|
||||
[Object exceptionalReturn]) {
|
||||
[Object? exceptionalReturn]) {
|
||||
throw UnsupportedError(
|
||||
"Pointer.fromFunction cannot be called dynamically.");
|
||||
}
|
||||
|
|
|
@ -333,7 +333,7 @@ class Isolate {
|
|||
}
|
||||
|
||||
@patch
|
||||
static Future<Uri> resolvePackageUri(Uri packageUri) {
|
||||
static Future<Uri?> resolvePackageUri(Uri packageUri) {
|
||||
var hook = VMLibraryHooks.resolvePackageUriFuture;
|
||||
if (hook == null) {
|
||||
throw new UnsupportedError("Isolate.resolvePackageUri");
|
||||
|
|
|
@ -424,7 +424,7 @@ class _ClassMirror extends _ObjectMirror implements ClassMirror, _TypeMirror {
|
|||
return _qualifiedName = _computeQualifiedName(owner, simpleName);
|
||||
}
|
||||
|
||||
DeclarationMirror get owner {
|
||||
DeclarationMirror? get owner {
|
||||
var o = _owner;
|
||||
if (o != null) return o;
|
||||
|
||||
|
@ -927,7 +927,7 @@ class _TypedefMirror extends _DeclarationMirror
|
|||
bool get isTopLevel => true;
|
||||
|
||||
DeclarationMirror? _owner;
|
||||
DeclarationMirror get owner {
|
||||
DeclarationMirror? get owner {
|
||||
var o = _owner;
|
||||
if (o != null) return o;
|
||||
var uri = _ClassMirror._libraryUri(_reflectee);
|
||||
|
|
|
@ -378,10 +378,11 @@ mixin _IntListMixin implements List<int> {
|
|||
}
|
||||
|
||||
void fillRange(int start, int end, [int? fillValue]) {
|
||||
if (fillValue == null && start < end) {
|
||||
RangeError.checkValidRange(start, end, this.length);
|
||||
if (start == end) return;
|
||||
if (fillValue == null) {
|
||||
throw ArgumentError.notNull("fillValue");
|
||||
}
|
||||
RangeError.checkValidRange(start, end, this.length);
|
||||
for (var i = start; i < end; ++i) {
|
||||
this[i] = fillValue;
|
||||
}
|
||||
|
@ -736,10 +737,11 @@ mixin _DoubleListMixin implements List<double> {
|
|||
|
||||
void fillRange(int start, int end, [double? fillValue]) {
|
||||
// TODO(eernst): Could use zero as default and not throw; issue .
|
||||
if (fillValue == null && start < end) {
|
||||
RangeError.checkValidRange(start, end, this.length);
|
||||
if (start == end) return;
|
||||
if (fillValue == null) {
|
||||
throw ArgumentError.notNull("fillValue");
|
||||
}
|
||||
RangeError.checkValidRange(start, end, this.length);
|
||||
for (var i = start; i < end; ++i) {
|
||||
this[i] = fillValue;
|
||||
}
|
||||
|
@ -1174,10 +1176,11 @@ abstract class _Float32x4ListMixin implements List<Float32x4> {
|
|||
}
|
||||
|
||||
void fillRange(int start, int end, [Float32x4? fillValue]) {
|
||||
if (fillValue == null && start < end) {
|
||||
RangeError.checkValidRange(start, end, this.length);
|
||||
if (start == end) return;
|
||||
if (fillValue == null) {
|
||||
throw ArgumentError.notNull("fillValue");
|
||||
}
|
||||
RangeError.checkValidRange(start, end, this.length);
|
||||
for (var i = start; i < end; ++i) {
|
||||
this[i] = fillValue;
|
||||
}
|
||||
|
@ -1532,10 +1535,11 @@ abstract class _Int32x4ListMixin implements List<Int32x4> {
|
|||
}
|
||||
|
||||
void fillRange(int start, int end, [Int32x4? fillValue]) {
|
||||
if (fillValue == null && start < end) {
|
||||
RangeError.checkValidRange(start, end, this.length);
|
||||
if (start == end) return;
|
||||
if (fillValue == null) {
|
||||
throw ArgumentError.notNull("fillValue");
|
||||
}
|
||||
RangeError.checkValidRange(start, end, this.length);
|
||||
for (var i = start; i < end; ++i) {
|
||||
this[i] = fillValue;
|
||||
}
|
||||
|
@ -1891,10 +1895,11 @@ abstract class _Float64x2ListMixin implements List<Float64x2> {
|
|||
}
|
||||
|
||||
void fillRange(int start, int end, [Float64x2? fillValue]) {
|
||||
if (fillValue == null && start < end) {
|
||||
RangeError.checkValidRange(start, end, this.length);
|
||||
if (start == end) return;
|
||||
if (fillValue == null) {
|
||||
throw ArgumentError.notNull("fillValue");
|
||||
}
|
||||
RangeError.checkValidRange(start, end, this.length);
|
||||
for (var i = start; i < end; ++i) {
|
||||
this[i] = fillValue;
|
||||
}
|
||||
|
|
|
@ -105,11 +105,12 @@ class _NativeWasmImports extends NativeFieldWrapperClass1
|
|||
}
|
||||
|
||||
class _NativeWasmMemory extends NativeFieldWrapperClass1 implements WasmMemory {
|
||||
int _pages;
|
||||
Uint8List _buffer;
|
||||
late int _pages;
|
||||
late Uint8List _buffer;
|
||||
|
||||
_NativeWasmMemory(int initialPages, int? maxPages) : _pages = initialPages {
|
||||
_NativeWasmMemory(int initialPages, int? maxPages) {
|
||||
_buffer = _init(initialPages, maxPages);
|
||||
_pages = initialPages;
|
||||
}
|
||||
|
||||
_NativeWasmMemory.fromInstance(_NativeWasmInstance inst) {
|
||||
|
|
|
@ -57,10 +57,11 @@ void Function(int)? _waitForEventClosure;
|
|||
|
||||
class _WaitForUtils {
|
||||
static void waitForEvent({Duration? timeout}) {
|
||||
if (_waitForEventClosure == null) {
|
||||
final closure = _waitForEventClosure;
|
||||
if (closure == null) {
|
||||
throw new UnsupportedError("waitFor is not supported by this embedder");
|
||||
}
|
||||
_waitForEventClosure(timeout == null ? 0 : max(1, timeout.inMilliseconds));
|
||||
closure(timeout == null ? 0 : max(1, timeout.inMilliseconds));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -145,7 +146,7 @@ T waitFor<T>(Future<T> future, {Duration? timeout}) {
|
|||
Timer.run(() {}); // Ensure that previous calls to waitFor are woken up.
|
||||
|
||||
if (error != null) {
|
||||
throw new AsyncError(error, stacktrace);
|
||||
throw new AsyncError(error!, stacktrace);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
|
@ -63,7 +63,7 @@ class Gauge extends Metric {
|
|||
}
|
||||
|
||||
Gauge(String name, String description, this.min, this.max)
|
||||
: _value = min ?? double.negativeInfinity,
|
||||
: _value = min,
|
||||
super(name, description) {
|
||||
// TODO: When NNBD is complete, delete the following two lines.
|
||||
ArgumentError.checkNotNull(min, 'min');
|
||||
|
|
|
@ -54,7 +54,7 @@ class Pointer<T extends NativeType> extends NativeType {
|
|||
/// [dynamic].
|
||||
external static Pointer<NativeFunction<T>> fromFunction<T extends Function>(
|
||||
@DartRepresentationOf("T") Function f,
|
||||
[Object exceptionalReturn]);
|
||||
[Object? exceptionalReturn]);
|
||||
|
||||
/// Access to the raw pointer value.
|
||||
/// On 32-bit systems, the upper 32-bits of the result are 0.
|
||||
|
|
|
@ -229,6 +229,24 @@ class NotNullableError<T> extends Error implements TypeError {
|
|||
"Null is not a valid value for the parameter '$_name' of type '$T'";
|
||||
}
|
||||
|
||||
/// A function that returns the value or default value (if invoked with `null`
|
||||
/// value) for non-nullable function parameters in Null safety enabled code.
|
||||
///
|
||||
/// Because Dart does not have full null safety
|
||||
/// until all legacy code has been removed from a program,
|
||||
/// a non-nullable parameter can still end up with a `null` value.
|
||||
/// This function can be used to get a default value for a parameter
|
||||
/// when a `null` value is passed in for a non-nullable parameter.
|
||||
///
|
||||
/// TODO(40810) - Remove uses of this function when Dart has full null safety.
|
||||
T valueOfNonNullableParamWithDefault<T extends Object>(T value, T defaultVal) {
|
||||
if ((value as dynamic) == null) {
|
||||
return defaultVal;
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* HTTP status codes. Exported in dart:io and dart:html.
|
||||
*/
|
||||
|
|
|
@ -709,7 +709,6 @@ class _RawSecureSocket extends Stream<RawSocketEvent>
|
|||
return 0;
|
||||
}
|
||||
if (_status != connectedStatus) return 0;
|
||||
offset ??= 0;
|
||||
bytes ??= data.length - offset;
|
||||
|
||||
int written =
|
||||
|
|
Loading…
Reference in a new issue