lib: drop unnecessary new and const
CoreLibraryReviewExempt: no API changes
TEST=no behavior changes
Change-Id: Ibef80bbfb000026042e562014b672258a5f1860d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/419761
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
diff --git a/sdk/lib/_internal/vm/bin/builtin.dart b/sdk/lib/_internal/vm/bin/builtin.dart
index 53cccb3..a960eec 100644
--- a/sdk/lib/_internal/vm/bin/builtin.dart
+++ b/sdk/lib/_internal/vm/bin/builtin.dart
@@ -189,7 +189,7 @@
assert(msg.length >= 2);
assert(msg[1] == null);
_packageConfig = Uri.parse(msg[0]);
- final pmap = new Map<String, Uri>();
+ final pmap = Map<String, Uri>();
_packageMap = pmap;
for (var i = 2; i < msg.length; i += 2) {
// TODO(iposva): Complain about duplicate entries.
@@ -335,7 +335,7 @@
// of
// - .packages (preferred)
// - .dart_tool/package_config.json
- var currentDir = new File.fromUri(base).parent;
+ var currentDir = File.fromUri(base).parent;
while (true) {
final dirUri = currentDir.uri;
@@ -497,7 +497,7 @@
_setupHooks();
// _workingDirectory must be set first.
- _workingDirectory = new Uri.directory(workingDirectory);
+ _workingDirectory = Uri.directory(workingDirectory);
// setup _rootScript.
if (rootScript != null) {
@@ -521,7 +521,7 @@
if (_traceLoading) {
_log('Setting working directory: $cwd');
}
- _workingDirectory = new Uri.directory(cwd);
+ _workingDirectory = Uri.directory(cwd);
if (_traceLoading) {
_log('Working directory URI: $_workingDirectory');
}
diff --git a/sdk/lib/_internal/vm/bin/directory_patch.dart b/sdk/lib/_internal/vm/bin/directory_patch.dart
index 58de8eb..f2bae3d 100644
--- a/sdk/lib/_internal/vm/bin/directory_patch.dart
+++ b/sdk/lib/_internal/vm/bin/directory_patch.dart
@@ -53,7 +53,7 @@
class _AsyncDirectoryListerOps {
@patch
factory _AsyncDirectoryListerOps(int pointer) =>
- new _AsyncDirectoryListerOpsImpl(pointer);
+ _AsyncDirectoryListerOpsImpl(pointer);
}
base class _AsyncDirectoryListerOpsImpl extends NativeFieldWrapperClass1
@@ -61,7 +61,7 @@
_AsyncDirectoryListerOpsImpl._();
factory _AsyncDirectoryListerOpsImpl(int pointer) =>
- new _AsyncDirectoryListerOpsImpl._().._setPointer(pointer);
+ _AsyncDirectoryListerOpsImpl._().._setPointer(pointer);
@pragma("vm:external-name", "Directory_SetAsyncDirectoryListerPointer")
external void _setPointer(int pointer);
@@ -79,13 +79,13 @@
}
var result = _Directory._current(_Namespace._namespace);
if (result is OSError) {
- throw new FileSystemException._fromOSError(
+ throw FileSystemException._fromOSError(
result,
"Getting current working directory failed",
"",
);
}
- return new Uri.directory(result as String);
+ return Uri.directory(result as String);
}
@pragma("vm:entry-point", "call")
diff --git a/sdk/lib/_internal/vm/bin/file_patch.dart b/sdk/lib/_internal/vm/bin/file_patch.dart
index 8889209..7ac836e 100644
--- a/sdk/lib/_internal/vm/bin/file_patch.dart
+++ b/sdk/lib/_internal/vm/bin/file_patch.dart
@@ -91,7 +91,7 @@
class _RandomAccessFileOps {
@patch
factory _RandomAccessFileOps(int pointer) =>
- new _RandomAccessFileOpsImpl(pointer);
+ _RandomAccessFileOpsImpl(pointer);
}
@pragma("vm:entry-point")
@@ -100,7 +100,7 @@
_RandomAccessFileOpsImpl._();
factory _RandomAccessFileOpsImpl(int pointer) =>
- new _RandomAccessFileOpsImpl._().._setPointer(pointer);
+ _RandomAccessFileOpsImpl._().._setPointer(pointer);
@pragma("vm:external-name", "File_SetPointer")
external void _setPointer(int pointer);
@@ -156,7 +156,7 @@
_WatcherPath? _watcherPath;
final StreamController<FileSystemEvent> _broadcastController =
- new StreamController<FileSystemEvent>.broadcast();
+ StreamController<FileSystemEvent>.broadcast();
/// Subscription on the stream returned by [_watchPath].
///
@@ -171,26 +171,22 @@
bool recursive,
) {
if (Platform.isLinux || Platform.isAndroid) {
- return new _InotifyFileSystemWatcher(path, events, recursive)._stream;
+ return _InotifyFileSystemWatcher(path, events, recursive)._stream;
}
if (Platform.isWindows) {
- return new _Win32FileSystemWatcher(path, events, recursive)._stream;
+ return _Win32FileSystemWatcher(path, events, recursive)._stream;
}
if (Platform.isMacOS) {
- return new _FSEventStreamFileSystemWatcher(
- path,
- events,
- recursive,
- )._stream;
+ return _FSEventStreamFileSystemWatcher(path, events, recursive)._stream;
}
- throw new FileSystemException(
+ throw FileSystemException(
"File system watching is not supported on this platform",
);
}
_FileSystemWatcher._(this._path, this._events, this._recursive) {
if (!isSupported) {
- throw new FileSystemException(
+ throw FileSystemException(
"File system watching is not supported on this platform",
_path,
);
@@ -236,7 +232,7 @@
return;
}
if (!_idMap.containsKey(pathId)) {
- _idMap[pathId] = new _WatcherPath(pathId, _path, _events);
+ _idMap[pathId] = _WatcherPath(pathId, _path, _events);
}
_watcherPath = _idMap[pathId];
_watcherPath!.count++;
@@ -324,9 +320,9 @@
void rewriteMove(event, isDir) {
if (event[3]) {
- add(event[4], new FileSystemCreateEvent(getPath(event), isDir));
+ add(event[4], FileSystemCreateEvent(getPath(event), isDir));
} else {
- add(event[4], new FileSystemDeleteEvent(getPath(event), false));
+ add(event[4], FileSystemDeleteEvent(getPath(event), false));
}
}
@@ -344,13 +340,13 @@
bool isDir = getIsDir(event);
var path = getPath(event);
if ((event[0] & FileSystemEvent.create) != 0) {
- add(event[4], new FileSystemCreateEvent(path, isDir));
+ add(event[4], FileSystemCreateEvent(path, isDir));
}
if ((event[0] & FileSystemEvent.modify) != 0) {
- add(event[4], new FileSystemModifyEvent(path, isDir, true));
+ add(event[4], FileSystemModifyEvent(path, isDir, true));
}
if ((event[0] & FileSystemEvent._modifyAttributes) != 0) {
- add(event[4], new FileSystemModifyEvent(path, isDir, false));
+ add(event[4], FileSystemModifyEvent(path, isDir, false));
}
if ((event[0] & FileSystemEvent.move) != 0) {
int link = event[1];
@@ -359,7 +355,7 @@
if (pair[pathId].containsKey(link)) {
add(
event[4],
- new FileSystemMoveEvent(
+ FileSystemMoveEvent(
getPath(pair[pathId][link]),
isDir,
path,
@@ -374,10 +370,10 @@
}
}
if ((event[0] & FileSystemEvent.delete) != 0) {
- add(event[4], new FileSystemDeleteEvent(path, false));
+ add(event[4], FileSystemDeleteEvent(path, false));
}
if ((event[0] & FileSystemEvent._deleteSelf) != 0) {
- add(event[4], new FileSystemDeleteEvent(path, false));
+ add(event[4], FileSystemDeleteEvent(path, false));
// Signal done event.
stops.add([event[4], null]);
}
@@ -479,7 +475,7 @@
Stream<FileSystemEvent> _pathWatched() {
var pathId = _watcherPath!.pathId;
if (!_idMap.containsKey(pathId)) {
- _idMap[pathId] = new StreamController<FileSystemEvent>.broadcast();
+ _idMap[pathId] = StreamController<FileSystemEvent>.broadcast();
}
return _idMap[pathId]!.stream;
}
@@ -501,7 +497,7 @@
Stream<FileSystemEvent> _pathWatched() {
var pathId = _watcherPath!.pathId;
- _controller = new StreamController<FileSystemEvent>();
+ _controller = StreamController<FileSystemEvent>();
_subscription = _FileSystemWatcher._listenOnSocket(
pathId,
0,
@@ -533,7 +529,7 @@
Stream<FileSystemEvent> _pathWatched() {
var pathId = _watcherPath!.pathId;
var socketId = _FileSystemWatcher._getSocketId(0, pathId);
- _controller = new StreamController<FileSystemEvent>();
+ _controller = StreamController<FileSystemEvent>();
_subscription = _FileSystemWatcher._listenOnSocket(
socketId,
0,
@@ -556,5 +552,5 @@
@pragma("vm:entry-point", "call")
Uint8List _makeUint8ListView(Uint8List source, int offsetInBytes, int length) {
- return new Uint8List.view(source.buffer, offsetInBytes, length);
+ return Uint8List.view(source.buffer, offsetInBytes, length);
}
diff --git a/sdk/lib/_internal/vm/bin/filter_patch.dart b/sdk/lib/_internal/vm/bin/filter_patch.dart
index 6df875b..c822273 100644
--- a/sdk/lib/_internal/vm/bin/filter_patch.dart
+++ b/sdk/lib/_internal/vm/bin/filter_patch.dart
@@ -66,7 +66,7 @@
int strategy,
List<int>? dictionary,
bool raw,
- ) => new _ZLibDeflateFilter(
+ ) => _ZLibDeflateFilter(
gzip,
level,
windowBits,
@@ -81,5 +81,5 @@
int windowBits,
List<int>? dictionary,
bool raw,
- ) => new _ZLibInflateFilter(gzip, windowBits, dictionary, raw);
+ ) => _ZLibInflateFilter(gzip, windowBits, dictionary, raw);
}
diff --git a/sdk/lib/_internal/vm/bin/io_service_patch.dart b/sdk/lib/_internal/vm/bin/io_service_patch.dart
index ff4b2c0..587d163 100644
--- a/sdk/lib/_internal/vm/bin/io_service_patch.dart
+++ b/sdk/lib/_internal/vm/bin/io_service_patch.dart
@@ -17,7 +17,7 @@
assert(data.length == 2);
_forwardResponse(data[0] as int, data[1]);
}, 'IO Service');
- static HashMap<int, Completer> _messageMap = new HashMap<int, Completer>();
+ static HashMap<int, Completer> _messageMap = HashMap<int, Completer>();
static int _id = 0;
@patch
@@ -26,7 +26,7 @@
do {
id = _getNextId();
} while (_messageMap.containsKey(id));
- final Completer completer = new Completer();
+ final Completer completer = Completer();
try {
if (_messageMap.isEmpty) {
// This is the first outgoing request after being in an idle state,
diff --git a/sdk/lib/_internal/vm/bin/namespace_patch.dart b/sdk/lib/_internal/vm/bin/namespace_patch.dart
index cf8b43a..7ce21b4 100644
--- a/sdk/lib/_internal/vm/bin/namespace_patch.dart
+++ b/sdk/lib/_internal/vm/bin/namespace_patch.dart
@@ -20,14 +20,14 @@
// embedder with the platform-specific namespace information.
static _NamespaceImpl? _cachedNamespace = null;
static void _setupNamespace(var namespace) {
- _cachedNamespace = _create(new _NamespaceImpl._(), namespace);
+ _cachedNamespace = _create(_NamespaceImpl._(), namespace);
}
static _NamespaceImpl get _namespace {
if (_cachedNamespace == null) {
// The embedder has not supplied a namespace before one is needed, so
// instead use a safe-ish default value.
- _cachedNamespace = _create(new _NamespaceImpl._(), _getDefault());
+ _cachedNamespace = _create(_NamespaceImpl._(), _getDefault());
}
return _cachedNamespace!;
}
diff --git a/sdk/lib/_internal/vm/bin/platform_patch.dart b/sdk/lib/_internal/vm/bin/platform_patch.dart
index 6da84b0..1b6b43e 100644
--- a/sdk/lib/_internal/vm/bin/platform_patch.dart
+++ b/sdk/lib/_internal/vm/bin/platform_patch.dart
@@ -60,7 +60,7 @@
path.startsWith('file:')) {
return Uri.parse(path);
} else {
- return Uri.base.resolveUri(new Uri.file(path));
+ return Uri.base.resolveUri(Uri.file(path));
}
});
}
diff --git a/sdk/lib/_internal/vm/bin/process_patch.dart b/sdk/lib/_internal/vm/bin/process_patch.dart
index a43770f..6de77a5 100644
--- a/sdk/lib/_internal/vm/bin/process_patch.dart
+++ b/sdk/lib/_internal/vm/bin/process_patch.dart
@@ -30,7 +30,7 @@
bool runInShell = false,
ProcessStartMode mode = ProcessStartMode.normal,
}) {
- _ProcessImpl process = new _ProcessImpl(
+ _ProcessImpl process = _ProcessImpl(
executable,
arguments,
workingDirectory,
@@ -96,12 +96,12 @@
}
}
-List<_SignalController?> _signalControllers = new List.filled(32, null);
+List<_SignalController?> _signalControllers = List.filled(32, null);
class _SignalController {
final ProcessSignal signal;
- final _controller = new StreamController<ProcessSignal>.broadcast();
+ final _controller = StreamController<ProcessSignal>.broadcast();
var _id;
_SignalController(this.signal) {
@@ -115,13 +115,11 @@
void _listen() {
var id = _setSignalHandler(signal.signalNumber);
if (id is! int) {
- _controller.addError(
- new SignalException("Failed to listen for $signal", id),
- );
+ _controller.addError(SignalException("Failed to listen for $signal", id));
return;
}
_id = id;
- var socket = new _RawSocket(new _NativeSocket.watchSignal(id));
+ var socket = _RawSocket(_NativeSocket.watchSignal(id));
socket.listen((event) {
if (event == RawSocketEvent.read) {
var bytes = socket.read()!;
@@ -176,16 +174,14 @@
(signal != ProcessSignal.sigusr1 &&
signal != ProcessSignal.sigusr2 &&
signal != ProcessSignal.sigwinch))) {
- throw new SignalException(
- "Listening for signal $signal is not supported",
- );
+ throw SignalException("Listening for signal $signal is not supported");
}
return _watchSignalInternal(signal);
}
static Stream<ProcessSignal> _watchSignalInternal(ProcessSignal signal) {
if (_signalControllers[signal.signalNumber] == null) {
- _signalControllers[signal.signalNumber] = new _SignalController(signal);
+ _signalControllers[signal.signalNumber] = _SignalController(signal);
}
return _signalControllers[signal.signalNumber]!.stream;
}
@@ -299,14 +295,14 @@
if (_modeHasStdio(_mode)) {
// stdin going to process.
- _stdin = new _StdSink(new _Socket._writePipe().._owner = this);
+ _stdin = _StdSink(_Socket._writePipe().._owner = this);
// stdout coming from process.
- _stdout = new _StdStream(new _Socket._readPipe().._owner = this);
+ _stdout = _StdStream(_Socket._readPipe().._owner = this);
// stderr coming from process.
- _stderr = new _StdStream(new _Socket._readPipe().._owner = this);
+ _stderr = _StdStream(_Socket._readPipe().._owner = this);
}
if (_modeIsAttached(_mode)) {
- _exitHandler = new _Socket._readPipe();
+ _exitHandler = _Socket._readPipe();
}
}
@@ -346,7 +342,7 @@
shellArguments.add(arg);
}
} else {
- var commandLine = new StringBuffer();
+ var commandLine = StringBuffer();
executable = executable.replaceAll("'", "'\"'\"'");
commandLine.write("'$executable'");
shellArguments.add("-c");
@@ -373,7 +369,7 @@
// Replace any number of '\' followed by '"' with
// twice as many '\' followed by '\"'.
var backslash = '\\'.codeUnitAt(0);
- var sb = new StringBuffer();
+ var sb = StringBuffer();
var nextPos = 0;
var quotePos = argument.indexOf('"', nextPos);
while (quotePos != -1) {
@@ -396,7 +392,7 @@
// Add '"' at the beginning and end and replace all '\' at
// the end with two '\'.
- sb = new StringBuffer('"');
+ sb = StringBuffer('"');
sb.write(result);
nextPos = argument.length - 1;
while (argument.codeUnitAt(nextPos) == backslash) {
@@ -418,15 +414,15 @@
}
Future<Process> _start() {
- var completer = new Completer<Process>();
+ var completer = Completer<Process>();
var stackTrace = StackTrace.current;
if (_modeIsAttached(_mode)) {
- _exitCode = new Completer<int>();
+ _exitCode = Completer<int>();
}
// TODO(ager): Make the actual process starting really async instead of
// simulating it with a timer.
Timer.run(() {
- var status = new _ProcessStartStatus();
+ var status = _ProcessStartStatus();
bool success = _startNative(
_Namespace._namespace,
_path,
@@ -442,7 +438,7 @@
);
if (!success) {
completer.completeError(
- new ProcessException(
+ ProcessException(
_path,
_arguments,
status._errorMessage!,
@@ -454,14 +450,14 @@
}
_started = true;
- final resourceInfo = new _SpawnedProcessResourceInfo(this);
+ final resourceInfo = _SpawnedProcessResourceInfo(this);
// Setup an exit handler to handle internal cleanup and possible
// callback when a process terminates.
if (_modeIsAttached(_mode)) {
int exitDataRead = 0;
final int EXIT_DATA_SIZE = 8;
- List<int> exitDataBuffer = new List<int>.filled(EXIT_DATA_SIZE, 0);
+ List<int> exitDataBuffer = List<int>.filled(EXIT_DATA_SIZE, 0);
_exitHandler.listen((data) {
int exitCode(List<int> ints) {
var code = _intFromBytes(ints, 0);
@@ -501,8 +497,8 @@
Encoding? stdoutEncoding,
Encoding? stderrEncoding,
) {
- var status = new _ProcessStartStatus();
- _exitCode = new Completer<int>();
+ var status = _ProcessStartStatus();
+ _exitCode = Completer<int>();
bool success = _startNative(
_Namespace._namespace,
_path,
@@ -517,7 +513,7 @@
status,
);
if (!success) {
- throw new ProcessException(
+ throw ProcessException(
_path,
_arguments,
status._errorMessage!,
@@ -525,7 +521,7 @@
);
}
- final resourceInfo = new _SpawnedProcessResourceInfo(this);
+ final resourceInfo = _SpawnedProcessResourceInfo(this);
var result = _wait(
_stdinNativeSocket,
@@ -541,7 +537,7 @@
resourceInfo.stopped();
- return new ProcessResult(
+ return ProcessResult(
result[0],
result[1],
getOutput(result[2], stdoutEncoding),
@@ -641,14 +637,14 @@
if (encoding == null) {
return stream
.fold<BytesBuilder>(
- new BytesBuilder(),
+ BytesBuilder(),
(builder, data) => builder..add(data),
)
.then((builder) => builder.takeBytes());
} else {
return stream
.transform(encoding.decoder)
- .fold<StringBuffer>(new StringBuffer(), (buf, data) {
+ .fold<StringBuffer>(StringBuffer(), (buf, data) {
buf.write(data);
return buf;
})
@@ -660,7 +656,7 @@
Future stderr = foldStream(p.stderr, stderrEncoding);
return Future.wait([p.exitCode, stdout, stderr]).then((result) {
- return new ProcessResult(pid, result[0], result[1], result[2]);
+ return ProcessResult(pid, result[0], result[1], result[2]);
});
});
}
@@ -675,7 +671,7 @@
Encoding? stdoutEncoding,
Encoding? stderrEncoding,
) {
- var process = new _ProcessImpl(
+ var process = _ProcessImpl(
executable,
arguments,
workingDirectory,
diff --git a/sdk/lib/_internal/vm/bin/secure_socket_patch.dart b/sdk/lib/_internal/vm/bin/secure_socket_patch.dart
index 6f69dcf..61d9381 100644
--- a/sdk/lib/_internal/vm/bin/secure_socket_patch.dart
+++ b/sdk/lib/_internal/vm/bin/secure_socket_patch.dart
@@ -7,14 +7,13 @@
@patch
class SecureSocket {
@patch
- factory SecureSocket._(RawSecureSocket rawSocket) =>
- new _SecureSocket(rawSocket);
+ factory SecureSocket._(RawSecureSocket rawSocket) => _SecureSocket(rawSocket);
}
@patch
class _SecureFilter {
@patch
- factory _SecureFilter._() => new _SecureFilterImpl._();
+ factory _SecureFilter._() => _SecureFilterImpl._();
}
@patch
@@ -22,7 +21,7 @@
class X509Certificate {
@patch
@pragma("vm:entry-point")
- factory X509Certificate._() => new _X509CertificateImpl._();
+ factory X509Certificate._() => _X509CertificateImpl._();
}
class _SecureSocket extends _Socket implements SecureSocket {
@@ -38,14 +37,14 @@
X509Certificate? get peerCertificate {
if (_raw == null) {
- throw new StateError("peerCertificate called on destroyed SecureSocket");
+ throw StateError("peerCertificate called on destroyed SecureSocket");
}
return _raw!.peerCertificate;
}
String? get selectedProtocol {
if (_raw == null) {
- throw new StateError("selectedProtocol called on destroyed SecureSocket");
+ throw StateError("selectedProtocol called on destroyed SecureSocket");
}
return _raw!.selectedProtocol;
}
@@ -74,7 +73,7 @@
_SecureFilterImpl._() {
buffers = <_ExternalBuffer>[
for (int i = 0; i < _RawSecureSocket.bufferCount; ++i)
- new _ExternalBuffer(
+ _ExternalBuffer(
_RawSecureSocket._isBufferEncrypted(i) ? ENCRYPTED_SIZE : SIZE,
),
];
@@ -158,9 +157,9 @@
}
}
- void rehandshake() => throw new UnimplementedError();
+ void rehandshake() => throw UnimplementedError();
- int processBuffer(int bufferIndex) => throw new UnimplementedError();
+ int processBuffer(int bufferIndex) => throw UnimplementedError();
@pragma("vm:external-name", "SecureSocket_GetSelectedProtocol")
external String? selectedProtocol();
@@ -203,7 +202,7 @@
class SecurityContext {
@patch
factory SecurityContext({bool withTrustedRoots = false}) {
- return new _SecurityContext(withTrustedRoots);
+ return _SecurityContext(withTrustedRoots);
}
@patch
@@ -245,10 +244,10 @@
@pragma("vm:external-name", "SecurityContext_Allocate")
external void _createNativeContext();
- static final SecurityContext defaultContext = new _SecurityContext(true);
+ static final SecurityContext defaultContext = _SecurityContext(true);
void usePrivateKey(String file, {String? password}) {
- List<int> bytes = (new File(file)).readAsBytesSync();
+ List<int> bytes = (File(file)).readAsBytesSync();
usePrivateKeyBytes(bytes, password: password);
}
@@ -256,7 +255,7 @@
external void usePrivateKeyBytes(List<int> keyBytes, {String? password});
void setTrustedCertificates(String file, {String? password}) {
- List<int> bytes = (new File(file)).readAsBytesSync();
+ List<int> bytes = (File(file)).readAsBytesSync();
setTrustedCertificatesBytes(bytes, password: password);
}
@@ -267,7 +266,7 @@
});
void useCertificateChain(String file, {String? password}) {
- List<int> bytes = (new File(file)).readAsBytesSync();
+ List<int> bytes = (File(file)).readAsBytesSync();
useCertificateChainBytes(bytes, password: password);
}
@@ -278,7 +277,7 @@
});
void setClientAuthorities(String file, {String? password}) {
- List<int> bytes = (new File(file)).readAsBytesSync();
+ List<int> bytes = (File(file)).readAsBytesSync();
setClientAuthoritiesBytes(bytes, password: password);
}
@@ -334,14 +333,11 @@
@pragma("vm:external-name", "X509_Issuer")
external String get issuer;
DateTime get startValidity {
- return new DateTime.fromMillisecondsSinceEpoch(
- _startValidity(),
- isUtc: true,
- );
+ return DateTime.fromMillisecondsSinceEpoch(_startValidity(), isUtc: true);
}
DateTime get endValidity {
- return new DateTime.fromMillisecondsSinceEpoch(_endValidity(), isUtc: true);
+ return DateTime.fromMillisecondsSinceEpoch(_endValidity(), isUtc: true);
}
@pragma("vm:external-name", "X509_StartValidity")
diff --git a/sdk/lib/_internal/vm/bin/socket_patch.dart b/sdk/lib/_internal/vm/bin/socket_patch.dart
index a5ed255..4ae6fe6 100644
--- a/sdk/lib/_internal/vm/bin/socket_patch.dart
+++ b/sdk/lib/_internal/vm/bin/socket_patch.dart
@@ -141,7 +141,7 @@
// TODO(40614): Remove once non-nullability is sound.
ArgumentError.checkNotNull(port, "port");
if ((port < 0) || (port > 0xFFFF)) {
- throw new ArgumentError("Invalid port $port");
+ throw ArgumentError("Invalid port $port");
}
}
@@ -149,7 +149,7 @@
// TODO(40614): Remove once non-nullability is sound.
ArgumentError.checkNotNull(ttl, "ttl");
if (ttl < 1 || ttl > 255) {
- throw new ArgumentError('Invalid ttl $ttl');
+ throw ArgumentError('Invalid ttl $ttl');
}
}
@@ -178,7 +178,7 @@
String get host => _host ?? address;
- Uint8List get rawAddress => new Uint8List.fromList(_in_addr);
+ Uint8List get rawAddress => Uint8List.fromList(_in_addr);
bool get isLoopback {
switch (type) {
@@ -194,7 +194,7 @@
case InternetAddressType.unix:
return false;
}
- throw new UnsupportedError("Unexpected address type $type");
+ throw UnsupportedError("Unexpected address type $type");
}
bool get isLinkLocal {
@@ -210,7 +210,7 @@
case InternetAddressType.unix:
return false;
}
- throw new UnsupportedError("Unexpected address type $type");
+ throw UnsupportedError("Unexpected address type $type");
}
bool get isMulticast {
@@ -226,7 +226,7 @@
case InternetAddressType.unix:
return false;
}
- throw new UnsupportedError("Unexpected address type $type");
+ throw UnsupportedError("Unexpected address type $type");
}
Future<InternetAddress> reverse() {
@@ -528,10 +528,8 @@
static const int normalTokenBatchSize = 8;
static const int listeningTokenBatchSize = 2;
- static const Duration _retryDuration = const Duration(milliseconds: 250);
- static const Duration _retryDurationLoopback = const Duration(
- milliseconds: 25,
- );
+ static const Duration _retryDuration = Duration(milliseconds: 250);
+ static const Duration _retryDurationLoopback = Duration(milliseconds: 25);
// Socket close state
bool isClosed = false;
@@ -539,7 +537,7 @@
bool isClosedRead = false;
bool closedReadEventSent = false;
bool isClosedWrite = false;
- Completer closeCompleter = new Completer.sync();
+ Completer closeCompleter = Completer.sync();
// Handlers and receive port for socket events from the event handler.
void Function()? readEventHandler;
@@ -633,7 +631,7 @@
throw createError(response, "Failed listing interfaces");
} else {
var map = (response as List).skip(1).fold(
- new Map<String, NetworkInterface>(),
+ Map<String, NetworkInterface>(),
(map, result) {
List<Object?> resultList = result as List<Object?>;
var type = InternetAddressType._from(resultList[0] as int);
@@ -647,7 +645,7 @@
);
if (!includeLinkLocal && address.isLinkLocal) return map;
if (!includeLoopback && address.isLoopback) return map;
- map.putIfAbsent(name, () => new _NetworkInterface(name, index));
+ map.putIfAbsent(name, () => _NetworkInterface(name, index));
(map[name] as _NetworkInterface).addresses.add(address);
return map;
},
@@ -665,7 +663,7 @@
if (!checkLinkLocalAddress(host)) {
// The only well defined usage is link-local address. Checks Section 4 of https://tools.ietf.org/html/rfc6874.
// If it is not a valid link-local address and contains escape character, throw an exception.
- throw new FormatException(
+ throw FormatException(
'${host} is not a valid link-local address but contains %. Scope id should be used as part of link-local address.',
host,
index,
@@ -811,7 +809,7 @@
}
source = sourceAddress;
} else if (sourceAddress is String) {
- source = new _InternetAddress.fromString(sourceAddress);
+ source = _InternetAddress.fromString(sourceAddress);
} else {
throw ArgumentError.value(
sourceAddress,
@@ -823,7 +821,7 @@
final stackTrace = StackTrace.current;
- return new Future.value(host).then<ConnectionTask<_NativeSocket>>((host) {
+ return Future.value(host).then<ConnectionTask<_NativeSocket>>((host) {
if (host is String) {
// Attempt to interpret the host as a numeric address
// (e.g. "127.0.0.1"). This will prevent [InternetAddress.lookup] from
@@ -868,7 +866,7 @@
StackTrace callerStackTrace,
) {
// Completer for result.
- final result = new Completer<_NativeSocket>();
+ final result = Completer<_NativeSocket>();
// Error, set if an error occurs.
// Keeps first error if multiple errors occur.
var error = null;
@@ -1012,7 +1010,7 @@
return;
}
final address = pendingLookedUp.removeFirst();
- final socket = new _NativeSocket.normal(address);
+ final socket = _NativeSocket.normal(address);
// Will contain values of various types representing the result
// of trying to create a connection.
// A value of `true` means success, everything else means failure.
@@ -1049,7 +1047,7 @@
// succeed or fail later.
final duration =
address.isLoopback ? _retryDurationLoopback : _retryDuration;
- timer = new Timer(duration, connectNext);
+ timer = Timer(duration, connectNext);
connecting.add(socket);
// Setup handlers for receiving the first write event which
// indicate that the socket is fully connected.
@@ -1136,7 +1134,7 @@
);
connectNext();
- return new ConnectionTask<_NativeSocket>._(result.future, onCancel);
+ return ConnectionTask<_NativeSocket>._(result.future, onCancel);
}
static Future<_NativeSocket> connect(
@@ -1196,7 +1194,7 @@
}
final address = await _resolveHost(host);
- var socket = new _NativeSocket.listen(address);
+ var socket = _NativeSocket.listen(address);
var result;
if (address.type == InternetAddressType.unix) {
var path = address.address;
@@ -1220,7 +1218,7 @@
);
}
if (result is OSError) {
- throw new SocketException(
+ throw SocketException(
"Failed to create server socket",
osError: result,
address: address,
@@ -1244,7 +1242,7 @@
final address = await _resolveHost(host);
- var socket = new _NativeSocket.datagram(address);
+ var socket = _NativeSocket.datagram(address);
var result = socket.nativeCreateBindDatagram(
address._in_addr,
port,
@@ -1253,7 +1251,7 @@
ttl,
);
if (result is OSError) {
- throw new SocketException(
+ throw SocketException(
"Failed to create datagram socket",
osError: result,
address: address,
@@ -1295,8 +1293,8 @@
bool get isTcp => (typeFlags & typeTcpSocket) != 0;
bool get isUdp => (typeFlags & typeUdpSocket) != 0;
- String get _serviceTypePath => throw new UnimplementedError();
- String get _serviceTypeName => throw new UnimplementedError();
+ String get _serviceTypePath => throw UnimplementedError();
+ String get _serviceTypeName => throw UnimplementedError();
Uint8List? read(int? count) {
if (count != null && count <= 0) {
@@ -1431,14 +1429,14 @@
offset = _fixOffset(offset);
if (bytes == null) {
if (offset > buffer.length) {
- throw new RangeError.value(offset);
+ throw RangeError.value(offset);
}
bytes = buffer.length - offset;
}
- if (offset < 0) throw new RangeError.value(offset);
- if (bytes < 0) throw new RangeError.value(bytes);
+ if (offset < 0) throw RangeError.value(offset);
+ if (bytes < 0) throw RangeError.value(bytes);
if ((offset + bytes) > buffer.length) {
- throw new RangeError.value(offset + bytes);
+ throw RangeError.value(offset + bytes);
}
if (isClosing || isClosed) return 0;
if (bytes == 0) return 0;
@@ -1526,14 +1524,14 @@
int? bytes,
List<SocketControlMessage> controlMessages,
) {
- if (offset < 0) throw new RangeError.value(offset);
+ if (offset < 0) throw RangeError.value(offset);
if (bytes != null) {
- if (bytes < 0) throw new RangeError.value(bytes);
+ if (bytes < 0) throw RangeError.value(bytes);
} else {
bytes = buffer.length - offset;
}
if ((offset + bytes) > buffer.length) {
- throw new RangeError.value(offset + bytes);
+ throw RangeError.value(offset + bytes);
}
if (isClosing || isClosed) return 0;
try {
@@ -1577,7 +1575,7 @@
connections--;
tokens++;
returnTokens(listeningTokenBatchSize);
- var socket = new _NativeSocket.normal(address);
+ var socket = _NativeSocket.normal(address);
if (nativeAccept(socket) != true) return null;
socket.localPort = localPort;
return socket;
@@ -1606,7 +1604,7 @@
if (isClosing || isClosed) throw const SocketException.closed();
var result = nativeGetRemotePeer();
var addr = result[0] as List<Object?>;
- var type = new InternetAddressType._from(addr[0] as int);
+ var type = InternetAddressType._from(addr[0] as int);
if (type == InternetAddressType.unix) {
return _InternetAddress.fromString(
addr[1] as String,
@@ -1835,7 +1833,7 @@
close();
break;
default:
- throw new ArgumentError(direction);
+ throw ArgumentError(direction);
}
}
}
@@ -1875,7 +1873,7 @@
void connectToEventHandler() {
assert(!isClosed);
if (eventPort == null) {
- eventPort = new RawReceivePort(multiplex, 'Socket Event Handler');
+ eventPort = RawReceivePort(multiplex, 'Socket Event Handler');
}
}
@@ -1988,7 +1986,7 @@
}
}
// No IPv4 address found on the interface.
- throw new SocketException(
+ throw SocketException(
"The network interface does not have an address "
"of the same family as the multicast address",
);
@@ -2152,14 +2150,14 @@
bool shared,
) {
_throwOnBadPort(port);
- if (backlog < 0) throw new ArgumentError("Invalid backlog $backlog");
+ if (backlog < 0) throw ArgumentError("Invalid backlog $backlog");
return _NativeSocket.bind(
address,
port,
backlog,
v6Only,
shared,
- ).then((socket) => new _RawServerSocket(socket, v6Only));
+ ).then((socket) => _RawServerSocket(socket, v6Only));
}
_RawServerSocket(this._socket, this._v6Only);
@@ -2171,11 +2169,11 @@
bool? cancelOnError,
}) {
if (_controller != null) {
- throw new StateError("Stream was already listened to");
+ throw StateError("Stream was already listened to");
}
var zone = Zone.current;
final controller =
- _controller = new StreamController(
+ _controller = StreamController(
sync: true,
onListen: _onSubscriptionStateChange,
onCancel: _onSubscriptionStateChange,
@@ -2255,7 +2253,7 @@
class _RawSocket extends Stream<RawSocketEvent>
implements RawSocket, _RawSocketBase {
final _NativeSocket _socket;
- final _controller = new StreamController<RawSocketEvent>(sync: true);
+ final _controller = StreamController<RawSocketEvent>(sync: true);
bool _readEventsEnabled = true;
bool _writeEventsEnabled = true;
@@ -2345,17 +2343,17 @@
}
factory _RawSocket._writePipe() {
- var native = new _NativeSocket.pipe();
+ var native = _NativeSocket.pipe();
native.isClosedRead = true;
native.closedReadEventSent = true;
- return new _RawSocket(native);
+ return _RawSocket(native);
}
factory _RawSocket._readPipe(int? fd) {
- var native = new _NativeSocket.pipe();
+ var native = _NativeSocket.pipe();
native.isClosedWrite = true;
if (fd != null) _getStdioHandle(native, fd);
- var result = new _RawSocket(native);
+ var result = _RawSocket(native);
if (fd != null) {
var socketType = _StdIOUtils._nativeSocketType(result._socket);
result._isMacOSTerminalInput =
@@ -2515,7 +2513,7 @@
backlog,
v6Only,
shared,
- ).then((socket) => new _ServerSocket(socket));
+ ).then((socket) => _ServerSocket(socket));
}
_ServerSocket(this._socket);
@@ -2527,7 +2525,7 @@
bool? cancelOnError,
}) {
return _socket
- .map<Socket>((rawSocket) => new _Socket(rawSocket))
+ .map<Socket>((rawSocket) => _Socket(rawSocket))
.listen(
onData,
onError: onError,
@@ -2564,7 +2562,7 @@
sourceAddress: sourceAddress,
sourcePort: sourcePort,
timeout: timeout,
- ).then((socket) => new _Socket(socket));
+ ).then((socket) => _Socket(socket));
}
@patch
@@ -2581,9 +2579,9 @@
sourcePort: sourcePort,
).then((rawTask) {
Future<Socket> socket = rawTask.socket.then(
- (rawSocket) => new _Socket(rawSocket),
+ (rawSocket) => _Socket(rawSocket),
);
- return new ConnectionTask<Socket>._(socket, rawTask._onCancel);
+ return ConnectionTask<Socket>._(socket, rawTask._onCancel);
});
}
}
@@ -2600,7 +2598,7 @@
Future<Socket> addStream(Stream<List<int>> stream) {
socket._ensureRawSocketSubscription();
- final completer = streamCompleter = new Completer<Socket>();
+ final completer = streamCompleter = Completer<Socket>();
if (socket._raw != null) {
subscription = stream.listen(
(data) {
@@ -2640,7 +2638,7 @@
Future<Socket> close() {
socket._consumerDone();
- return new Future.value(socket);
+ return Future.value(socket);
}
bool get _previousWriteHasCompleted {
@@ -2710,7 +2708,7 @@
class _Socket extends Stream<Uint8List> implements Socket {
RawSocket? _raw; // Set to null when the raw socket is closed.
bool _closed = false; // Set to true when the raw socket is closed.
- final _controller = new StreamController<Uint8List>(sync: true);
+ final _controller = StreamController<Uint8List>(sync: true);
bool _controllerClosed = false;
late _SocketStreamConsumer _consumer;
late IOSink _sink;
@@ -2723,8 +2721,8 @@
..onCancel = _onSubscriptionStateChange
..onPause = _onPauseStateChange
..onResume = _onPauseStateChange;
- _consumer = new _SocketStreamConsumer(this);
- _sink = new IOSink(_consumer);
+ _consumer = _SocketStreamConsumer(this);
+ _sink = IOSink(_consumer);
// Disable read events until there is a subscription.
raw.readEventsEnabled = false;
@@ -2734,11 +2732,11 @@
}
factory _Socket._writePipe() {
- return new _Socket(new _RawSocket._writePipe());
+ return _Socket(_RawSocket._writePipe());
}
factory _Socket._readPipe([int? fd]) {
- return new _Socket(new _RawSocket._readPipe(fd));
+ return _Socket(_RawSocket._readPipe(fd));
}
// Note: this code seems a bit suspicious because _raw can be _RawSocket and
@@ -2783,7 +2781,7 @@
/// Throws an [UnsupportedError] because errors cannot be transmitted over a
/// [Socket].
void addError(Object error, [StackTrace? stackTrace]) {
- throw new UnsupportedError("Cannot send errors on sockets");
+ throw UnsupportedError("Cannot send errors on sockets");
}
Future addStream(Stream<List<int>> stream) {
@@ -2992,7 +2990,7 @@
_RawDatagramSocket(this._socket) {
var zone = Zone.current;
- _controller = new StreamController<RawSocketEvent>(
+ _controller = StreamController<RawSocketEvent>(
sync: true,
onListen: _onSubscriptionStateChange,
onCancel: _onSubscriptionStateChange,
@@ -3160,7 +3158,7 @@
int port,
int type,
) {
- return new Datagram(
+ return Datagram(
data,
_InternetAddress(InternetAddressType._from(type), address, null, in_addr),
port,
diff --git a/sdk/lib/_internal/vm/bin/stdio_patch.dart b/sdk/lib/_internal/vm/bin/stdio_patch.dart
index 4cc0160..e9d28a0 100644
--- a/sdk/lib/_internal/vm/bin/stdio_patch.dart
+++ b/sdk/lib/_internal/vm/bin/stdio_patch.dart
@@ -21,11 +21,11 @@
case _stdioHandleTypePipe:
case _stdioHandleTypeSocket:
case _stdioHandleTypeOther:
- return new Stdin._(new _Socket._readPipe(fd), fd);
+ return Stdin._(_Socket._readPipe(fd), fd);
case _stdioHandleTypeFile:
- return new Stdin._(new _FileStream.forStdin(), fd);
+ return Stdin._(_FileStream.forStdin(), fd);
}
- throw new UnsupportedError("Unexpected handle type $type");
+ throw UnsupportedError("Unexpected handle type $type");
}
@patch
@@ -38,7 +38,7 @@
type,
);
}
- return new Stdout._(new IOSink(new _StdConsumer(fd)), fd);
+ return Stdout._(IOSink(_StdConsumer(fd)), fd);
}
@patch
@@ -50,7 +50,7 @@
static int _nativeSocketType(_NativeSocket nativeSocket) {
var result = _getSocketType(nativeSocket);
if (result is OSError) {
- throw new FileSystemException("Error retrieving socket type", "", result);
+ throw FileSystemException("Error retrieving socket type", "", result);
}
return result;
}
@@ -66,7 +66,7 @@
int readByteSync() {
var result = _readByte(_fd);
if (result is OSError) {
- throw new StdinException("Error reading byte from stdin", result);
+ throw StdinException("Error reading byte from stdin", result);
}
return result;
}
@@ -75,7 +75,7 @@
bool get echoMode {
var result = _echoMode(_fd);
if (result is OSError) {
- throw new StdinException("Error getting terminal echo mode", result);
+ throw StdinException("Error getting terminal echo mode", result);
}
return result;
}
@@ -83,13 +83,11 @@
@patch
void set echoMode(bool enabled) {
if (!_EmbedderConfig._maySetEchoMode) {
- throw new UnsupportedError(
- "This embedder disallows setting Stdin.echoMode",
- );
+ throw UnsupportedError("This embedder disallows setting Stdin.echoMode");
}
var result = _setEchoMode(_fd, enabled);
if (result is OSError) {
- throw new StdinException("Error setting terminal echo mode", result);
+ throw StdinException("Error setting terminal echo mode", result);
}
}
@@ -97,10 +95,7 @@
bool get echoNewlineMode {
var result = _echoNewlineMode(_fd);
if (result is OSError) {
- throw new StdinException(
- "Error getting terminal echo newline mode",
- result,
- );
+ throw StdinException("Error getting terminal echo newline mode", result);
}
return result;
}
@@ -108,16 +103,13 @@
@patch
void set echoNewlineMode(bool enabled) {
if (!_EmbedderConfig._maySetEchoNewlineMode) {
- throw new UnsupportedError(
+ throw UnsupportedError(
"This embedder disallows setting Stdin.echoNewlineMode",
);
}
var result = _setEchoNewlineMode(_fd, enabled);
if (result is OSError) {
- throw new StdinException(
- "Error setting terminal echo newline mode",
- result,
- );
+ throw StdinException("Error setting terminal echo newline mode", result);
}
}
@@ -125,7 +117,7 @@
bool get lineMode {
var result = _lineMode(_fd);
if (result is OSError) {
- throw new StdinException("Error getting terminal line mode", result);
+ throw StdinException("Error getting terminal line mode", result);
}
return result;
}
@@ -133,13 +125,11 @@
@patch
void set lineMode(bool enabled) {
if (!_EmbedderConfig._maySetLineMode) {
- throw new UnsupportedError(
- "This embedder disallows setting Stdin.lineMode",
- );
+ throw UnsupportedError("This embedder disallows setting Stdin.lineMode");
}
var result = _setLineMode(_fd, enabled);
if (result is OSError) {
- throw new StdinException("Error setting terminal line mode", result);
+ throw StdinException("Error setting terminal line mode", result);
}
}
@@ -147,7 +137,7 @@
bool get supportsAnsiEscapes {
var result = _supportsAnsiEscapes(_fd);
if (result is OSError) {
- throw new StdinException("Error determining ANSI support", result);
+ throw StdinException("Error determining ANSI support", result);
}
return result;
}
@@ -182,7 +172,7 @@
static List _terminalSize(int fd) {
var size = _getTerminalSize(fd);
if (size is! List) {
- throw new StdoutException("Could not get terminal size", size);
+ throw StdoutException("Could not get terminal size", size);
}
return size;
}
@@ -194,7 +184,7 @@
static bool _supportsAnsiEscapes(int fd) {
var result = _getAnsiSupported(fd);
if (result is! bool) {
- throw new StdoutException("Error determining ANSI support", result);
+ throw StdoutException("Error determining ANSI support", result);
}
return result;
}
diff --git a/sdk/lib/_internal/vm/bin/sync_socket_patch.dart b/sdk/lib/_internal/vm/bin/sync_socket_patch.dart
index 6e3341d..42b7dea 100644
--- a/sdk/lib/_internal/vm/bin/sync_socket_patch.dart
+++ b/sdk/lib/_internal/vm/bin/sync_socket_patch.dart
@@ -19,7 +19,7 @@
static RawSynchronousSocket connectSync(host, int port) {
_throwOnBadPort(port);
- return new _RawSynchronousSocket(
+ return _RawSynchronousSocket(
_NativeSynchronousSocket.connectSync(host, port),
);
}
@@ -65,7 +65,7 @@
static _NativeSynchronousSocket connectSync(host, int port) {
if (host == null) {
- throw new ArgumentError("Parameter host cannot be null");
+ throw ArgumentError("Parameter host cannot be null");
}
late List<_InternetAddress> addresses;
var error = null;
@@ -89,7 +89,7 @@
throw error;
}
var address = it.current;
- var socket = new _NativeSynchronousSocket();
+ var socket = _NativeSynchronousSocket();
socket.localAddress = address;
var result = socket._nativeCreateConnectSync(address._in_addr, port);
if (result is OSError) {
@@ -178,14 +178,14 @@
int? port,
]) {
if (error is OSError) {
- return new SocketException(
+ return SocketException(
message,
osError: error,
address: address,
port: port,
);
} else {
- return new SocketException(message, address: address, port: port);
+ return SocketException(message, address: address, port: port);
}
}
@@ -199,7 +199,7 @@
}
return <_InternetAddress>[
for (int i = 0; i < response.length; ++i)
- new _InternetAddress(
+ _InternetAddress(
InternetAddressType._from(response[i][0]),
response[i][1],
host,
@@ -214,7 +214,7 @@
ArgumentError.checkNotNull(start, "start");
_checkAvailable();
if (isClosedRead) {
- throw new SocketException("Socket is closed for reading");
+ throw SocketException("Socket is closed for reading");
}
end = RangeError.checkValidRange(start, end, buffer.length);
if (end == start) {
@@ -222,7 +222,7 @@
}
var result = _nativeReadInto(buffer, start, end - start);
if (result is OSError) {
- throw new SocketException("readIntoSync failed", osError: result);
+ throw SocketException("readIntoSync failed", osError: result);
}
return result;
}
@@ -230,11 +230,11 @@
List<int>? readSync(int len) {
_checkAvailable();
if (isClosedRead) {
- throw new SocketException("Socket is closed for reading");
+ throw SocketException("Socket is closed for reading");
}
if ((len != null) && (len < 0)) {
- throw new ArgumentError("Illegal length $len");
+ throw ArgumentError("Illegal length $len");
}
if (len == 0) {
return null;
@@ -261,7 +261,7 @@
closeSync();
break;
default:
- throw new ArgumentError(direction);
+ throw ArgumentError(direction);
}
}
@@ -295,7 +295,7 @@
ArgumentError.checkNotNull(start, "start");
_checkAvailable();
if (isClosedWrite) {
- throw new SocketException("Socket is closed for writing");
+ throw SocketException("Socket is closed for writing");
}
end = RangeError.checkValidRange(start, end, buffer.length);
if (end == start) {
@@ -312,7 +312,7 @@
end - (start - bufferAndStart.start),
);
if (result is OSError) {
- throw new SocketException("writeFromSync failed", osError: result);
+ throw SocketException("writeFromSync failed", osError: result);
}
}
diff --git a/sdk/lib/_internal/vm/bin/vmservice_io.dart b/sdk/lib/_internal/vm/bin/vmservice_io.dart
index b56a4d1..32a38b5 100644
--- a/sdk/lib/_internal/vm/bin/vmservice_io.dart
+++ b/sdk/lib/_internal/vm/bin/vmservice_io.dart
@@ -13,65 +13,65 @@
part 'vmservice_server.dart';
// The TCP ip/port that dds listens on.
-@pragma('vm:entry-point', !const bool.fromEnvironment('dart.vm.product'))
+@pragma('vm:entry-point', !bool.fromEnvironment('dart.vm.product'))
int _ddsPort = 0;
-@pragma('vm:entry-point', !const bool.fromEnvironment('dart.vm.product'))
+@pragma('vm:entry-point', !bool.fromEnvironment('dart.vm.product'))
String _ddsIP = '';
// The TCP ip/port that the HTTP server listens on.
-@pragma('vm:entry-point', !const bool.fromEnvironment('dart.vm.product'))
+@pragma('vm:entry-point', !bool.fromEnvironment('dart.vm.product'))
int _port = 0;
-@pragma('vm:entry-point', !const bool.fromEnvironment('dart.vm.product'))
+@pragma('vm:entry-point', !bool.fromEnvironment('dart.vm.product'))
String _ip = '';
// Should the HTTP server auto start?
-@pragma('vm:entry-point', !const bool.fromEnvironment('dart.vm.product'))
+@pragma('vm:entry-point', !bool.fromEnvironment('dart.vm.product'))
bool _autoStart = false;
// Should the HTTP server require an auth code?
-@pragma('vm:entry-point', !const bool.fromEnvironment('dart.vm.product'))
+@pragma('vm:entry-point', !bool.fromEnvironment('dart.vm.product'))
bool _authCodesDisabled = false;
// Should the HTTP server run in devmode?
-@pragma('vm:entry-point', !const bool.fromEnvironment('dart.vm.product'))
+@pragma('vm:entry-point', !bool.fromEnvironment('dart.vm.product'))
bool _originCheckDisabled = false;
// Location of file to output VM service connection info.
-@pragma('vm:entry-point', !const bool.fromEnvironment('dart.vm.product'))
+@pragma('vm:entry-point', !bool.fromEnvironment('dart.vm.product'))
String? _serviceInfoFilename;
-@pragma('vm:entry-point', !const bool.fromEnvironment('dart.vm.product'))
+@pragma('vm:entry-point', !bool.fromEnvironment('dart.vm.product'))
bool _isWindows = false;
-@pragma('vm:entry-point', !const bool.fromEnvironment('dart.vm.product'))
+@pragma('vm:entry-point', !bool.fromEnvironment('dart.vm.product'))
bool _isFuchsia = false;
-@pragma('vm:entry-point', !const bool.fromEnvironment('dart.vm.product'))
+@pragma('vm:entry-point', !bool.fromEnvironment('dart.vm.product'))
Stream<ProcessSignal> Function(ProcessSignal signal)? _signalWatch;
-@pragma('vm:entry-point', !const bool.fromEnvironment('dart.vm.product'))
+@pragma('vm:entry-point', !bool.fromEnvironment('dart.vm.product'))
StreamSubscription<ProcessSignal>? _signalSubscription;
-@pragma('vm:entry-point', !const bool.fromEnvironment('dart.vm.product'))
+@pragma('vm:entry-point', !bool.fromEnvironment('dart.vm.product'))
bool _serveDevtools = true;
-@pragma('vm:entry-point', !const bool.fromEnvironment('dart.vm.product'))
+@pragma('vm:entry-point', !bool.fromEnvironment('dart.vm.product'))
bool _enableServicePortFallback = false;
-@pragma('vm:entry-point', !const bool.fromEnvironment('dart.vm.product'))
+@pragma('vm:entry-point', !bool.fromEnvironment('dart.vm.product'))
bool _waitForDdsToAdvertiseService = false;
-@pragma('vm:entry-point', !const bool.fromEnvironment('dart.vm.product'))
+@pragma('vm:entry-point', !bool.fromEnvironment('dart.vm.product'))
bool _serveObservatory = false;
-@pragma('vm:entry-point', !const bool.fromEnvironment('dart.vm.product'))
+@pragma('vm:entry-point', !bool.fromEnvironment('dart.vm.product'))
bool _printDtd = false;
File? _residentCompilerInfoFile = null;
-@pragma('vm:entry-point', !const bool.fromEnvironment('dart.vm.product'))
+@pragma('vm:entry-point', !bool.fromEnvironment('dart.vm.product'))
void _populateResidentCompilerInfoFile(
/// If either `--resident-compiler-info-file` or `--resident-server-info-file`
/// was supplied on the command line, the CLI argument should be forwarded as
@@ -270,7 +270,7 @@
).listen((_) => _toggleWebServer());
}
-@pragma('vm:entry-point', !const bool.fromEnvironment('dart.vm.product'))
+@pragma('vm:entry-point', !bool.fromEnvironment('dart.vm.product'))
void main() {
// Set embedder hooks.
VMServiceEmbedderHooks.cleanup = cleanupCallback;
diff --git a/sdk/lib/_internal/vm/lib/array.dart b/sdk/lib/_internal/vm/lib/array.dart
index 3cf9551..e31e508 100644
--- a/sdk/lib/_internal/vm/lib/array.dart
+++ b/sdk/lib/_internal/vm/lib/array.dart
@@ -19,7 +19,7 @@
@pragma("vm:prefer-inline")
_List _slice(int start, int count, bool needsTypeArgument) {
if (count <= 64) {
- final result = needsTypeArgument ? new _List<E>(count) : new _List(count);
+ final result = needsTypeArgument ? _List<E>(count) : _List(count);
for (int i = 0; i < result.length; i++) {
result[i] = this[start + i];
}
@@ -44,7 +44,7 @@
@pragma("vm:prefer-inline")
Iterator<E> get iterator {
- return new _ArrayIterator<E>(this);
+ return _ArrayIterator<E>(this);
}
E get first {
@@ -68,12 +68,12 @@
if (length > 0) {
_List result = _slice(0, length, !growable);
if (growable) {
- return new _GrowableList<E>._withData(result).._setLength(length);
+ return _GrowableList<E>._withData(result).._setLength(length);
}
return unsafeCast<_List<E>>(result);
}
// _GrowableList._withData must not be called with empty list.
- return growable ? <E>[] : new _List<E>(0);
+ return growable ? <E>[] : _List<E>(0);
}
}
@@ -195,10 +195,10 @@
// List interface.
void setRange(int start, int end, Iterable<E> iterable, [int skipCount = 0]) {
if (start < 0 || start > this.length) {
- throw new RangeError.range(start, 0, this.length);
+ throw RangeError.range(start, 0, this.length);
}
if (end < start || end > this.length) {
- throw new RangeError.range(end, start, this.length);
+ throw RangeError.range(end, start, this.length);
}
int length = end - start;
if (length == 0) return;
@@ -224,7 +224,7 @@
void setAll(int index, Iterable<E> iterable) {
if (index < 0 || index > this.length) {
- throw new RangeError.range(index, 0, this.length, "index");
+ throw RangeError.range(index, 0, this.length, "index");
}
List<E> iterableAsList;
if (identical(this, iterable)) {
@@ -241,7 +241,7 @@
}
int length = iterableAsList.length;
if (index + length > this.length) {
- throw new RangeError.range(index + length, 0, this.length);
+ throw RangeError.range(index + length, 0, this.length);
}
Lists.copy(iterableAsList, 0, this, index, length);
}
@@ -251,7 +251,7 @@
final int actualEnd = RangeError.checkValidRange(start, end, listLength);
int length = actualEnd - start;
if (length == 0) return <E>[];
- var result = new _GrowableList<E>._withData(_slice(start, length, false));
+ var result = _GrowableList<E>._withData(_slice(start, length, false));
result._setLength(length);
return result;
}
@@ -261,9 +261,7 @@
@pragma("vm:entry-point")
class _ImmutableList<E> extends _Array<E> with UnmodifiableListMixin<E> {
factory _ImmutableList._uninstantiable() {
- throw new UnsupportedError(
- "ImmutableArray can only be allocated by the VM",
- );
+ throw UnsupportedError("ImmutableArray can only be allocated by the VM");
}
@pragma("vm:external-name", "ImmutableList_from")
diff --git a/sdk/lib/_internal/vm/lib/async_patch.dart b/sdk/lib/_internal/vm/lib/async_patch.dart
index 062899c..718b018 100644
--- a/sdk/lib/_internal/vm/lib/async_patch.dart
+++ b/sdk/lib/_internal/vm/lib/async_patch.dart
@@ -141,7 +141,7 @@
controller.close();
}
- _AsyncStarStreamController() : controller = new StreamController(sync: true) {
+ _AsyncStarStreamController() : controller = StreamController(sync: true) {
controller.onListen = this.onListen;
controller.onResume = this.onResume;
controller.onCancel = this.onCancel;
@@ -164,7 +164,7 @@
return null;
}
if (cancellationFuture == null) {
- cancellationFuture = new _Future();
+ cancellationFuture = _Future();
// Only resume the generator if it is suspended at a yield.
// Cancellation does not affect an async generator that is
// suspended at an await.
diff --git a/sdk/lib/_internal/vm/lib/convert_patch.dart b/sdk/lib/_internal/vm/lib/convert_patch.dart
index 6578f0f..c30d429 100644
--- a/sdk/lib/_internal/vm/lib/convert_patch.dart
+++ b/sdk/lib/_internal/vm/lib/convert_patch.dart
@@ -28,8 +28,8 @@
String source,
Object? Function(Object? key, Object? value)? reviver,
) {
- _JsonListener listener = new _JsonListener(reviver);
- var parser = new _JsonStringParser(listener);
+ _JsonListener listener = _JsonListener(reviver);
+ var parser = _JsonStringParser(listener);
parser.chunk = source;
parser.chunkEnd = source.length;
parser.parse(0);
@@ -42,7 +42,7 @@
@patch
Converter<List<int>, T> fuse<T>(Converter<String, T> next) {
if (next is JsonDecoder) {
- return new _JsonUtf8Decoder(
+ return _JsonUtf8Decoder(
(next as JsonDecoder)._reviver,
this._allowMalformed,
)
@@ -66,7 +66,7 @@
}
ByteConversionSink startChunkedConversion(Sink<Object?> sink) {
- return new _JsonUtf8DecoderSink(_reviver, sink, _allowMalformed);
+ return _JsonUtf8DecoderSink(_reviver, sink, _allowMalformed);
}
}
@@ -206,7 +206,7 @@
Uint8List list;
int length = 0;
_NumberBuffer(int initialCapacity)
- : list = new Uint8List(_initialCapacity(initialCapacity));
+ : list = Uint8List(_initialCapacity(initialCapacity));
int get capacity => list.length;
@@ -229,13 +229,13 @@
void ensureCapacity(int newCapacity) {
Uint8List list = this.list;
if (newCapacity <= list.length) return;
- Uint8List newList = new Uint8List(newCapacity);
+ Uint8List newList = Uint8List(newCapacity);
newList.setRange(0, list.length, list, 0);
this.list = newList;
}
String getString() {
- String result = new String.fromCharCodes(list, 0, length);
+ String result = String.fromCharCodes(list, 0, length);
return result;
}
@@ -1251,7 +1251,7 @@
int beginChunkNumber(int state, int start) {
int end = chunkEnd;
int length = end - start;
- var buffer = new _NumberBuffer(length);
+ var buffer = _NumberBuffer(length);
copyCharsToList(start, end, buffer.list, 0);
buffer.length = length;
this.buffer = buffer;
@@ -1460,7 +1460,7 @@
message = "Unexpected character";
if (position == chunkEnd) message = "Unexpected end of input";
}
- throw new FormatException(message, chunk, position);
+ throw FormatException(message, chunk, position);
}
}
@@ -1486,7 +1486,7 @@
}
void beginString() {
- this.buffer = new StringBuffer();
+ this.buffer = StringBuffer();
}
void addSliceToString(int start, int end) {
@@ -1521,7 +1521,7 @@
class JsonDecoder {
@patch
StringConversionSink startChunkedConversion(Sink<Object?> sink) {
- return new _JsonStringDecoderSink(this._reviver, sink);
+ return _JsonStringDecoderSink(this._reviver, sink);
}
}
@@ -1542,7 +1542,7 @@
static _JsonStringParser _createParser(
Object? Function(Object? key, Object? value)? reviver,
) {
- return new _JsonStringParser(new _JsonListener(reviver));
+ return _JsonStringParser(_JsonListener(reviver));
}
void addSlice(String chunk, int start, int end, bool isLast) {
@@ -1564,7 +1564,7 @@
}
ByteConversionSink asUtf8Sink(bool allowMalformed) {
- return new _JsonUtf8DecoderSink(_reviver, _sink, allowMalformed);
+ return _JsonUtf8DecoderSink(_reviver, _sink, allowMalformed);
}
}
@@ -1580,7 +1580,7 @@
int chunkEnd = 0;
_JsonUtf8Parser(_JsonListener listener, bool allowMalformed)
- : decoder = new _Utf8Decoder(allowMalformed),
+ : decoder = _Utf8Decoder(allowMalformed),
super(listener) {
// Starts out checking for an optional BOM (KWD_BOM, count = 0).
partialState =
@@ -1621,7 +1621,7 @@
void beginString() {
decoder.reset();
- this.buffer = new StringBuffer();
+ this.buffer = StringBuffer();
}
void addSliceToString(int start, int end) {
@@ -1671,7 +1671,7 @@
Object? Function(Object? key, Object? value)? reviver,
bool allowMalformed,
) {
- return new _JsonUtf8Parser(new _JsonListener(reviver), allowMalformed);
+ return _JsonUtf8Parser(_JsonListener(reviver), allowMalformed);
}
void addSlice(List<int> chunk, int start, int end, bool isLast) {
diff --git a/sdk/lib/_internal/vm/lib/developer.dart b/sdk/lib/_internal/vm/lib/developer.dart
index 5078932..2f6063f 100644
--- a/sdk/lib/_internal/vm/lib/developer.dart
+++ b/sdk/lib/_internal/vm/lib/developer.dart
@@ -38,11 +38,11 @@
StackTrace? stackTrace,
}) {
if (message is! String) {
- throw new ArgumentError.value(message, "message", "Must be a String");
+ throw ArgumentError.value(message, "message", "Must be a String");
}
- time ??= new DateTime.now();
+ time ??= DateTime.now();
if (time is! DateTime) {
- throw new ArgumentError.value(time, "time", "Must be a DateTime");
+ throw ArgumentError.value(time, "time", "Must be a DateTime");
}
if (sequenceNumber == null) {
sequenceNumber = _nextSequenceNumber++;
@@ -92,7 +92,7 @@
external _registerExtension(String method, ServiceExtensionHandler handler);
// This code is only invoked when there is no other Dart code on the stack.
-@pragma("vm:entry-point", !const bool.fromEnvironment("dart.vm.product"))
+@pragma("vm:entry-point", !bool.fromEnvironment("dart.vm.product"))
_runExtension(
ServiceExtensionHandler handler,
String method,
@@ -111,7 +111,7 @@
response = handler(method, parameters);
} catch (e, st) {
var errorDetails = (st == null) ? '$e' : '$e\n$st';
- response = new ServiceExtensionResponse.error(
+ response = ServiceExtensionResponse.error(
ServiceExtensionResponse.extensionError,
errorDetails,
);
@@ -119,7 +119,7 @@
return;
}
if (response is! Future) {
- response = new ServiceExtensionResponse.error(
+ response = ServiceExtensionResponse.error(
ServiceExtensionResponse.extensionError,
"Extension handler must return a Future",
);
@@ -130,7 +130,7 @@
.catchError((e, st) {
// Catch any errors eagerly and wrap them in a ServiceExtensionResponse.
var errorDetails = (st == null) ? '$e' : '$e\n$st';
- return new ServiceExtensionResponse.error(
+ return ServiceExtensionResponse.error(
ServiceExtensionResponse.extensionError,
errorDetails,
);
@@ -139,7 +139,7 @@
// Post the valid response or the wrapped error after verifying that
// the response is a ServiceExtensionResponse.
if (response is! ServiceExtensionResponse) {
- response = new ServiceExtensionResponse.error(
+ response = ServiceExtensionResponse.error(
ServiceExtensionResponse.extensionError,
"Extension handler must complete to a ServiceExtensionResponse",
);
@@ -169,7 +169,7 @@
return;
}
assert(id != null);
- StringBuffer sb = new StringBuffer();
+ StringBuffer sb = StringBuffer();
sb.write('{"jsonrpc":"2.0",');
if (response.isError()) {
if (trace_service) {
diff --git a/sdk/lib/_internal/vm/lib/double.dart b/sdk/lib/_internal/vm/lib/double.dart
index 7afa43a..9a8ca17 100644
--- a/sdk/lib/_internal/vm/lib/double.dart
+++ b/sdk/lib/_internal/vm/lib/double.dart
@@ -139,29 +139,29 @@
}
double _addFromInteger(int other) {
- return new _Double.fromInteger(other)._add(this);
+ return _Double.fromInteger(other)._add(this);
}
double _subFromInteger(int other) {
- return new _Double.fromInteger(other)._sub(this);
+ return _Double.fromInteger(other)._sub(this);
}
@pragma("vm:recognized", "asm-intrinsic")
@pragma("vm:exact-result-type", "dart:core#_Double")
double _mulFromInteger(int other) {
- return new _Double.fromInteger(other)._mul(this);
+ return _Double.fromInteger(other)._mul(this);
}
int _truncDivFromInteger(int other) {
- return (new _Double.fromInteger(other) / this).truncate();
+ return (_Double.fromInteger(other) / this).truncate();
}
double _moduloFromInteger(int other) {
- return new _Double.fromInteger(other)._modulo(this);
+ return _Double.fromInteger(other)._modulo(this);
}
double _remainderFromInteger(int other) {
- return new _Double.fromInteger(other)._remainder(this);
+ return _Double.fromInteger(other)._remainder(this);
}
@pragma("vm:external-name", "Double_greaterThanFromInteger")
@@ -223,13 +223,13 @@
num clamp(num lowerLimit, num upperLimit) {
// TODO: Remove these null checks once all code is opted into strong nonnullable mode.
if (lowerLimit == null) {
- throw new ArgumentError.notNull("lowerLimit");
+ throw ArgumentError.notNull("lowerLimit");
}
if (upperLimit == null) {
- throw new ArgumentError.notNull("upperLimit");
+ throw ArgumentError.notNull("upperLimit");
}
if (lowerLimit.compareTo(upperLimit) > 0) {
- throw new ArgumentError(lowerLimit);
+ throw ArgumentError(lowerLimit);
}
if (lowerLimit.isNaN) return lowerLimit;
if (this.compareTo(lowerLimit) < 0) return lowerLimit;
@@ -249,7 +249,7 @@
static const int CACHE_LENGTH = 1 << (CACHE_SIZE_LOG2 + 1);
static const int CACHE_MASK = CACHE_LENGTH - 1;
// Each key (double) followed by its toString result.
- static final List _cache = new List.filled(CACHE_LENGTH, null);
+ static final List _cache = List.filled(CACHE_LENGTH, null);
static int _cacheEvictIndex = 0;
@pragma("vm:external-name", "Double_toString")
@@ -280,12 +280,12 @@
// TODO: Remove these null checks once all code is opted into strong nonnullable mode.
if (fractionDigits == null) {
- throw new ArgumentError.notNull("fractionDigits");
+ throw ArgumentError.notNull("fractionDigits");
}
// Step 2.
if (fractionDigits < 0 || fractionDigits > 20) {
- throw new RangeError.range(fractionDigits, 0, 20, "fractionDigits");
+ throw RangeError.range(fractionDigits, 0, 20, "fractionDigits");
}
// Step 3.
@@ -317,7 +317,7 @@
// Step 7.
if (fractionDigits != null) {
if (fractionDigits < 0 || fractionDigits > 20) {
- throw new RangeError.range(fractionDigits, 0, 20, "fractionDigits");
+ throw RangeError.range(fractionDigits, 0, 20, "fractionDigits");
}
}
@@ -339,7 +339,7 @@
// See ECMAScript-262, 15.7.4.7 for details.
if (precision == null) {
- throw new ArgumentError.notNull("precision");
+ throw ArgumentError.notNull("precision");
}
// The EcmaScript specification checks for NaN and Infinity before looking
// at the fractionDigits. In Dart we are consistent with toStringAsFixed and
@@ -347,7 +347,7 @@
// Step 8.
if (precision < 1 || precision > 21) {
- throw new RangeError.range(precision, 1, 21, "precision");
+ throw RangeError.range(precision, 1, 21, "precision");
}
if (isNaN) return "NaN";
diff --git a/sdk/lib/_internal/vm/lib/double_patch.dart b/sdk/lib/_internal/vm/lib/double_patch.dart
index 0adb20f..de1382f 100644
--- a/sdk/lib/_internal/vm/lib/double_patch.dart
+++ b/sdk/lib/_internal/vm/lib/double_patch.dart
@@ -109,7 +109,7 @@
static double parse(String source) {
var result = _parse(source);
if (result == null) {
- throw new FormatException("Invalid double", source);
+ throw FormatException("Invalid double", source);
}
return result;
}
diff --git a/sdk/lib/_internal/vm/lib/errors_patch.dart b/sdk/lib/_internal/vm/lib/errors_patch.dart
index a2a87c4..812b7b8 100644
--- a/sdk/lib/_internal/vm/lib/errors_patch.dart
+++ b/sdk/lib/_internal/vm/lib/errors_patch.dart
@@ -141,7 +141,7 @@
@pragma("vm:entry-point")
class UnsupportedError {
static Never _throwNew(String msg) {
- throw new UnsupportedError(msg);
+ throw UnsupportedError(msg);
}
}
@@ -150,7 +150,7 @@
class StateError {
@pragma("vm:entry-point")
static Never _throwNew(String msg) {
- throw new StateError(msg);
+ throw StateError(msg);
}
}
@@ -168,7 +168,7 @@
NoSuchMethodError._withInvocation(this._receiver, this._invocation);
static Never _throwNewInvocation(Object? receiver, Invocation invocation) {
- throw new NoSuchMethodError.withInvocation(receiver, invocation);
+ throw NoSuchMethodError.withInvocation(receiver, invocation);
}
// The compiler emits a call to _throwNew when it cannot resolve a static
@@ -184,7 +184,7 @@
List? arguments,
List? argumentNames,
) {
- throw new NoSuchMethodError._withType(
+ throw NoSuchMethodError._withType(
receiver,
memberName,
invocationType,
@@ -200,11 +200,11 @@
List arguments,
List argumentNames,
) {
- Map<Symbol, dynamic> namedArguments = new Map<Symbol, dynamic>();
+ Map<Symbol, dynamic> namedArguments = Map<Symbol, dynamic>();
int numPositionalArguments = arguments.length - argumentNames.length;
for (int i = 0; i < argumentNames.length; i++) {
final argValue = arguments[numPositionalArguments + i];
- namedArguments[new Symbol(argumentNames[i])] = argValue;
+ namedArguments[Symbol(argumentNames[i])] = argValue;
}
return namedArguments;
}
@@ -222,8 +222,8 @@
Object? typeArguments,
List? arguments,
List? argumentNames,
- ) : this._invocation = new _InvocationMirror._withType(
- new Symbol(memberName),
+ ) : this._invocation = _InvocationMirror._withType(
+ Symbol(memberName),
invocationType,
_InvocationMirror._unpackTypeArguments(
typeArguments,
@@ -262,7 +262,7 @@
StringBuffer? typeArgumentsBuf = null;
final typeArguments = localInvocation.typeArguments;
if ((typeArguments != null) && (typeArguments.length > 0)) {
- final argsBuf = new StringBuffer();
+ final argsBuf = StringBuffer();
argsBuf.write("<");
for (int i = 0; i < typeArguments.length; i++) {
if (i > 0) {
@@ -273,7 +273,7 @@
argsBuf.write(">");
typeArgumentsBuf = argsBuf;
}
- StringBuffer argumentsBuf = new StringBuffer();
+ StringBuffer argumentsBuf = StringBuffer();
var positionalArguments = localInvocation.positionalArguments;
int argumentCount = 0;
if (positionalArguments != null) {
@@ -320,7 +320,7 @@
])[kind];
}
- StringBuffer msgBuf = new StringBuffer("NoSuchMethodError: ");
+ StringBuffer msgBuf = StringBuffer("NoSuchMethodError: ");
bool isTypeCall = false;
switch (level) {
case _InvocationMirror._DYNAMIC:
diff --git a/sdk/lib/_internal/vm/lib/expando_patch.dart b/sdk/lib/_internal/vm/lib/expando_patch.dart
index 387240b..7c36d3e 100644
--- a/sdk/lib/_internal/vm/lib/expando_patch.dart
+++ b/sdk/lib/_internal/vm/lib/expando_patch.dart
@@ -20,11 +20,11 @@
@patch
Expando([String? name])
: name = name,
- _data = new List<_WeakProperty?>.filled(_minSize, null),
+ _data = List<_WeakProperty?>.filled(_minSize, null),
_used = 0;
static const _minSize = 8;
- static final _deletedEntry = new _WeakProperty();
+ static final _deletedEntry = _WeakProperty();
@patch
T? operator [](Object object) {
@@ -93,7 +93,7 @@
}
if (_used < _limit) {
- var ephemeron = new _WeakProperty();
+ var ephemeron = _WeakProperty();
ephemeron.key = object;
ephemeron.value = value;
_data[idx] = ephemeron;
@@ -130,7 +130,7 @@
// Reset the mappings to empty so that we can just add the existing
// valid entries.
- _data = new List<_WeakProperty?>.filled(new_size, null);
+ _data = List<_WeakProperty?>.filled(new_size, null);
_used = 0;
for (var i = 0; i < old_data.length; i++) {
diff --git a/sdk/lib/_internal/vm/lib/growable_array.dart b/sdk/lib/_internal/vm/lib/growable_array.dart
index c512cc3..1500789 100644
--- a/sdk/lib/_internal/vm/lib/growable_array.dart
+++ b/sdk/lib/_internal/vm/lib/growable_array.dart
@@ -8,7 +8,7 @@
class _GrowableList<T> extends ListBase<T> {
void insert(int index, T element) {
if ((index < 0) || (index > length)) {
- throw new RangeError.range(index, 0, length);
+ throw RangeError.range(index, 0, length);
}
int oldLength = this.length;
add(element);
@@ -41,7 +41,7 @@
void insertAll(int index, Iterable<T> iterable) {
if (index < 0 || index > length) {
- throw new RangeError.range(index, 0, length);
+ throw RangeError.range(index, 0, length);
}
// TODO(floitsch): we can probably detect more cases.
if (iterable is! List && iterable is! Set && iterable is! SubListIterable) {
@@ -84,11 +84,11 @@
final int actualEnd = RangeError.checkValidRange(start, end, this.length);
int length = actualEnd - start;
if (length == 0) return <T>[];
- final list = new _List(length);
+ final list = _List(length);
for (int i = 0; i < length; i++) {
list[i] = this[start + i];
}
- final result = new _GrowableList<T>._withData(list);
+ final result = _GrowableList<T>._withData(list);
result._setLength(length);
return result;
}
@@ -96,7 +96,7 @@
@pragma('dyn-module:language-impl:callable')
factory _GrowableList(int length) {
var data = _allocateData(length);
- var result = new _GrowableList<T>._withData(data);
+ var result = _GrowableList<T>._withData(data);
if (length > 0) {
result._setLength(length);
}
@@ -105,7 +105,7 @@
factory _GrowableList.withCapacity(int capacity) {
var data = _allocateData(capacity);
- return new _GrowableList<T>._withData(data);
+ return _GrowableList<T>._withData(data);
}
// Specialization of List.empty constructor for growable == true.
@@ -314,7 +314,7 @@
}
if (isVMList) {
if (identical(iterable, this)) {
- throw new ConcurrentModificationError(this);
+ throw ConcurrentModificationError(this);
}
this._setLength(newLen);
final ListBase<T> iterableAsList = iterable as ListBase<T>;
@@ -332,7 +332,7 @@
this._setLength(newLen);
this[len] = it.current;
if (!it.moveNext()) return;
- if (this.length != newLen) throw new ConcurrentModificationError(this);
+ if (this.length != newLen) throw ConcurrentModificationError(this);
len = newLen;
}
_growToNextCapacity();
@@ -364,7 +364,7 @@
}
// Shared array used as backing for new empty growable arrays.
- static final _List _emptyList = new _List(0);
+ static final _List _emptyList = _List(0);
static _List _allocateData(int capacity) {
if (capacity == 0) {
@@ -423,7 +423,7 @@
int initialLength = length;
for (int i = 0; i < length; i++) {
f(this[i]);
- if (length != initialLength) throw new ConcurrentModificationError(this);
+ if (length != initialLength) throw ConcurrentModificationError(this);
}
}
@@ -458,7 +458,7 @@
}
// Not all elements are strings, so allocate a new backing array.
- final list = new _List(length);
+ final list = _List(length);
for (int copyIndex = 0; copyIndex < i; copyIndex++) {
list[copyIndex] = this[copyIndex];
}
@@ -485,7 +485,7 @@
}
String _joinWithSeparator(String separator) {
- StringBuffer buffer = new StringBuffer();
+ StringBuffer buffer = StringBuffer();
buffer.write(this[0]);
for (int i = 1; i < this.length; i++) {
buffer.write(separator);
@@ -512,7 +512,7 @@
@pragma("vm:prefer-inline")
Iterator<T> get iterator {
- return new ListIterator<T>(this);
+ return ListIterator<T>(this);
}
List<T> toList({bool growable = true}) {
@@ -527,18 +527,18 @@
final length = this.length;
if (growable) {
if (length > 0) {
- final data = new _List(_adjustedCapacity(length));
+ final data = _List(_adjustedCapacity(length));
for (int i = 0; i < length; i++) {
data[i] = this[i];
}
- final result = new _GrowableList<T>._withData(data);
+ final result = _GrowableList<T>._withData(data);
result._setLength(length);
return result;
}
return <T>[];
} else {
if (length > 0) {
- final list = new _List<T>(length);
+ final list = _List<T>(length);
for (int i = 0; i < length; i++) {
list[i] = this[i];
}
@@ -549,14 +549,14 @@
}
Set<T> toSet() {
- return new Set<T>.of(this);
+ return Set<T>.of(this);
}
// Factory constructing a mutable List from a parser generated List literal.
// [elements] contains elements that are already type checked.
@pragma("vm:entry-point", "call")
factory _GrowableList._literal(_List elements) {
- final result = new _GrowableList<T>._withData(elements);
+ final result = _GrowableList<T>._withData(elements);
result._setLength(elements.length);
return result;
}
@@ -567,7 +567,7 @@
factory _GrowableList._literal1(T e0) {
_List elements = _List(1);
elements[0] = e0;
- final result = new _GrowableList<T>._withData(elements);
+ final result = _GrowableList<T>._withData(elements);
result._setLength(1);
return result;
}
@@ -577,7 +577,7 @@
_List elements = _List(2);
elements[0] = e0;
elements[1] = e1;
- final result = new _GrowableList<T>._withData(elements);
+ final result = _GrowableList<T>._withData(elements);
result._setLength(2);
return result;
}
@@ -588,7 +588,7 @@
elements[0] = e0;
elements[1] = e1;
elements[2] = e2;
- final result = new _GrowableList<T>._withData(elements);
+ final result = _GrowableList<T>._withData(elements);
result._setLength(3);
return result;
}
@@ -600,7 +600,7 @@
elements[1] = e1;
elements[2] = e2;
elements[3] = e3;
- final result = new _GrowableList<T>._withData(elements);
+ final result = _GrowableList<T>._withData(elements);
result._setLength(4);
return result;
}
@@ -613,7 +613,7 @@
elements[2] = e2;
elements[3] = e3;
elements[4] = e4;
- final result = new _GrowableList<T>._withData(elements);
+ final result = _GrowableList<T>._withData(elements);
result._setLength(5);
return result;
}
@@ -627,7 +627,7 @@
elements[3] = e3;
elements[4] = e4;
elements[5] = e5;
- final result = new _GrowableList<T>._withData(elements);
+ final result = _GrowableList<T>._withData(elements);
result._setLength(6);
return result;
}
@@ -642,7 +642,7 @@
elements[4] = e4;
elements[5] = e5;
elements[6] = e6;
- final result = new _GrowableList<T>._withData(elements);
+ final result = _GrowableList<T>._withData(elements);
result._setLength(7);
return result;
}
@@ -667,7 +667,7 @@
elements[5] = e5;
elements[6] = e6;
elements[7] = e7;
- final result = new _GrowableList<T>._withData(elements);
+ final result = _GrowableList<T>._withData(elements);
result._setLength(8);
return result;
}
diff --git a/sdk/lib/_internal/vm/lib/integers.dart b/sdk/lib/_internal/vm/lib/integers.dart
index a6fb086..1084285 100644
--- a/sdk/lib/_internal/vm/lib/integers.dart
+++ b/sdk/lib/_internal/vm/lib/integers.dart
@@ -264,10 +264,10 @@
num clamp(num lowerLimit, num upperLimit) {
// TODO: Remove these null checks once all code is opted into strong nonnullable mode.
if (lowerLimit == null) {
- throw new ArgumentError.notNull("lowerLimit");
+ throw ArgumentError.notNull("lowerLimit");
}
if (upperLimit == null) {
- throw new ArgumentError.notNull("upperLimit");
+ throw ArgumentError.notNull("upperLimit");
}
// Special case for integers.
if (lowerLimit is int && upperLimit is int && lowerLimit <= upperLimit) {
@@ -277,7 +277,7 @@
}
// Generic case involving doubles, and invalid integer ranges.
if (lowerLimit.compareTo(upperLimit) > 0) {
- throw new ArgumentError(lowerLimit);
+ throw ArgumentError(lowerLimit);
}
if (lowerLimit.isNaN) return lowerLimit;
// Note that we don't need to care for -0.0 for the lower limit.
@@ -293,7 +293,7 @@
@pragma("vm:recognized", "other")
@pragma("vm:exact-result-type", _Double)
double toDouble() {
- return new _Double.fromInteger(this);
+ return _Double.fromInteger(this);
}
String toStringAsFixed(int fractionDigits) {
@@ -312,7 +312,7 @@
String toRadixString(int radix) {
if (radix < 2 || 36 < radix) {
- throw new RangeError.range(radix, 2, 36, "radix");
+ throw RangeError.range(radix, 2, 36, "radix");
}
if (radix & (radix - 1) == 0) {
return _toPow2String(radix);
@@ -395,13 +395,13 @@
int modPow(int e, int m) {
// TODO: Remove these null checks once all code is opted into strong nonnullable mode.
if (e == null) {
- throw new ArgumentError.notNull("exponent");
+ throw ArgumentError.notNull("exponent");
}
if (m == null) {
- throw new ArgumentError.notNull("modulus");
+ throw ArgumentError.notNull("modulus");
}
- if (e < 0) throw new RangeError.range(e, 0, null, "exponent");
- if (m <= 0) throw new RangeError.range(m, 1, null, "modulus");
+ if (e < 0) throw RangeError.range(e, 0, null, "exponent");
+ if (m <= 0) throw RangeError.range(m, 1, null, "modulus");
if (e == 0) return 1;
// This is floor(sqrt(2^63)).
@@ -486,7 +486,7 @@
} while (u != 0);
if (!inv) return v << s;
if (v != 1) {
- throw new Exception("Not coprime");
+ throw Exception("Not coprime");
}
if (d < 0) {
d += x;
@@ -502,15 +502,15 @@
int modInverse(int m) {
// TODO: Remove these null checks once all code is opted into strong nonnullable mode.
if (m == null) {
- throw new ArgumentError.notNull("modulus");
+ throw ArgumentError.notNull("modulus");
}
- 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);
}
@@ -519,7 +519,7 @@
int gcd(int other) {
// TODO: Remove these null checks once all code is opted into strong nonnullable mode.
if (other == null) {
- throw new ArgumentError.notNull("other");
+ throw ArgumentError.notNull("other");
}
int x = this.abs();
int y = other.abs();
@@ -558,7 +558,7 @@
* Get the digits of `n`, with `0 <= n < 100`, as
* `_digitTable[n * 2]` and `_digitTable[n * 2 + 1]`.
*/
- static const _digitTable = const [
+ static const _digitTable = [
0x30, 0x30, 0x30, 0x31, 0x30, 0x32, 0x30, 0x33, //
0x30, 0x34, 0x30, 0x35, 0x30, 0x36, 0x30, 0x37, //
0x30, 0x38, 0x30, 0x39, 0x31, 0x30, 0x31, 0x31, //
@@ -589,7 +589,7 @@
/**
* Result of int.toString for -99, -98, ..., 98, 99.
*/
- static const _smallLookupTable = const [
+ static const _smallLookupTable = [
"-99", "-98", "-97", "-96", "-95", "-94", "-93", "-92", "-91", "-90", //
"-89", "-88", "-87", "-86", "-85", "-84", "-83", "-82", "-81", "-80", //
"-79", "-78", "-77", "-76", "-75", "-74", "-73", "-72", "-71", "-70", //
diff --git a/sdk/lib/_internal/vm/lib/internal_patch.dart b/sdk/lib/_internal/vm/lib/internal_patch.dart
index fb3da3e..ff2b231 100644
--- a/sdk/lib/_internal/vm/lib/internal_patch.dart
+++ b/sdk/lib/_internal/vm/lib/internal_patch.dart
@@ -206,22 +206,22 @@
class LateError {
@pragma("vm:entry-point")
static Never _throwFieldAlreadyInitialized(String fieldName) {
- throw new LateError.fieldAI(fieldName);
+ throw LateError.fieldAI(fieldName);
}
@pragma("vm:entry-point")
static Never _throwLocalNotInitialized(String localName) {
- throw new LateError.localNI(localName);
+ throw LateError.localNI(localName);
}
@pragma("vm:entry-point")
static Never _throwLocalAlreadyInitialized(String localName) {
- throw new LateError.localAI(localName);
+ throw LateError.localAI(localName);
}
@pragma("vm:entry-point")
static Never _throwLocalAssignedDuringInitialization(String localName) {
- throw new LateError.localADI(localName);
+ throw LateError.localADI(localName);
}
}
@@ -234,7 +234,7 @@
(object is Pointer) ||
(object is Struct) ||
(object is Union)) {
- throw new ArgumentError.value(
+ throw ArgumentError.value(
object,
name,
"Cannot be a string, number, boolean, record, null, Pointer, Struct or Union",
diff --git a/sdk/lib/_internal/vm/lib/invocation_mirror_patch.dart b/sdk/lib/_internal/vm/lib/invocation_mirror_patch.dart
index ee820e6..d285ddc 100644
--- a/sdk/lib/_internal/vm/lib/invocation_mirror_patch.dart
+++ b/sdk/lib/_internal/vm/lib/invocation_mirror_patch.dart
@@ -73,16 +73,14 @@
}
if (funcName.startsWith("get:")) {
_type |= _GETTER;
- _memberName = new internal.Symbol.unvalidated(funcName.substring(4));
+ _memberName = internal.Symbol.unvalidated(funcName.substring(4));
} else if (funcName.startsWith("set:")) {
_type |= _SETTER;
- _memberName = new internal.Symbol.unvalidated(
- funcName.substring(4) + "=",
- );
+ _memberName = internal.Symbol.unvalidated(funcName.substring(4) + "=");
} else {
_type |=
_isSuperInvocation ? (_SUPER << _LEVEL_SHIFT) | _METHOD : _METHOD;
- _memberName = new internal.Symbol.unvalidated(funcName);
+ _memberName = internal.Symbol.unvalidated(funcName);
}
}
@@ -130,7 +128,7 @@
// Exclude receiver and type args in the returned list.
var receiverIndex = _typeArgsLen > 0 ? 1 : 0;
var args = _arguments!;
- _positionalArguments = new _ImmutableList._from(
+ _positionalArguments = _ImmutableList._from(
args,
receiverIndex + 1,
numPositionalArguments,
@@ -151,15 +149,15 @@
return _namedArguments = const {};
}
var receiverIndex = _typeArgsLen > 0 ? 1 : 0;
- final namedArguments = new Map<Symbol, Object?>();
+ final namedArguments = Map<Symbol, Object?>();
for (var i = 0; i < numNamedArguments; i++) {
var namedEntryIndex = _FIRST_NAMED_ENTRY + 2 * i;
var pos = argsDescriptor[namedEntryIndex + 1] as int;
var arg_name = argsDescriptor[namedEntryIndex] as String;
var arg_value = _arguments![receiverIndex + pos];
- namedArguments[new internal.Symbol.unvalidated(arg_name)] = arg_value;
+ namedArguments[internal.Symbol.unvalidated(arg_name)] = arg_value;
}
- _namedArguments = new Map.unmodifiable(namedArguments);
+ _namedArguments = Map.unmodifiable(namedArguments);
}
return _namedArguments!;
}
@@ -218,7 +216,7 @@
bool isSuperInvocation, [
int type = _UNINITIALIZED,
]) {
- return new _InvocationMirror(
+ return _InvocationMirror(
functionName,
argumentsDescriptor,
arguments,
@@ -240,7 +238,7 @@
int? type,
int delayedTypeArgumentsLen,
) {
- return new _InvocationMirror(
+ return _InvocationMirror(
functionName,
argumentsDescriptor,
arguments,
diff --git a/sdk/lib/_internal/vm/lib/isolate_patch.dart b/sdk/lib/_internal/vm/lib/isolate_patch.dart
index ebb7cc74..2fe0966 100644
--- a/sdk/lib/_internal/vm/lib/isolate_patch.dart
+++ b/sdk/lib/_internal/vm/lib/isolate_patch.dart
@@ -16,12 +16,11 @@
@patch
class ReceivePort {
@patch
- factory ReceivePort([String debugName = '']) =>
- new _ReceivePortImpl(debugName);
+ factory ReceivePort([String debugName = '']) => _ReceivePortImpl(debugName);
@patch
factory ReceivePort.fromRawReceivePort(RawReceivePort rawPort) {
- return new _ReceivePortImpl.fromRawReceivePort(rawPort);
+ return _ReceivePortImpl.fromRawReceivePort(rawPort);
}
}
@@ -29,7 +28,7 @@
@pragma("vm:entry-point")
class Capability {
@patch
- factory Capability() => new _Capability();
+ factory Capability() => _Capability();
}
@pragma("vm:entry-point")
@@ -62,7 +61,7 @@
*/
@patch
factory RawReceivePort([Function? handler, String debugName = '']) {
- _RawReceivePort result = new _RawReceivePort(debugName);
+ _RawReceivePort result = _RawReceivePort(debugName);
result.handler = handler;
return result;
}
@@ -70,10 +69,10 @@
final class _ReceivePortImpl extends Stream implements ReceivePort {
_ReceivePortImpl([String debugName = ''])
- : this.fromRawReceivePort(new RawReceivePort(null, debugName));
+ : this.fromRawReceivePort(RawReceivePort(null, debugName));
_ReceivePortImpl.fromRawReceivePort(this._rawPort)
- : _controller = new StreamController(sync: true) {
+ : _controller = StreamController(sync: true) {
_controller.onCancel = close;
_rawPort.handler = _controller.add;
}
@@ -341,7 +340,7 @@
static Uri? get packageConfigSync {
var hook = VMLibraryHooks.packageConfigUriSync;
if (hook == null) {
- throw new UnsupportedError("Isolate.packageConfig");
+ throw UnsupportedError("Isolate.packageConfig");
}
return hook();
}
@@ -355,7 +354,7 @@
static Uri? resolvePackageUriSync(Uri packageUri) {
var hook = VMLibraryHooks.resolvePackageUriSync;
if (hook == null) {
- throw new UnsupportedError("Isolate.resolvePackageUriSync");
+ throw UnsupportedError("Isolate.resolvePackageUriSync");
}
return hook(packageUri);
}
@@ -383,7 +382,7 @@
if (script == null) {
// We do not have enough information to support spawning the new
// isolate.
- throw new UnsupportedError("Isolate.spawn");
+ throw UnsupportedError("Isolate.spawn");
}
if (script.isScheme("package")) {
if (Isolate._packageSupported()) {
@@ -393,7 +392,7 @@
}
}
- final RawReceivePort readyPort = new RawReceivePort(
+ final RawReceivePort readyPort = RawReceivePort(
null,
'Isolate.spawn ready',
);
@@ -413,7 +412,7 @@
return await _spawnCommon(readyPort);
} catch (e, st) {
readyPort.close();
- return await new Future<Isolate>.error(e, st);
+ return await Future<Isolate>.error(e, st);
}
}
@@ -448,20 +447,20 @@
String? debugName,
}) async {
if (environment != null) {
- throw new UnimplementedError("environment");
+ throw UnimplementedError("environment");
}
// Verify that no mutually exclusive arguments have been passed.
if (automaticPackageResolution) {
if (packageRoot != null) {
- throw new ArgumentError(
+ throw ArgumentError(
"Cannot simultaneously request "
"automaticPackageResolution and specify a "
"packageRoot.",
);
}
if (packageConfig != null) {
- throw new ArgumentError(
+ throw ArgumentError(
"Cannot simultaneously request "
"automaticPackageResolution and specify a "
"packageConfig.",
@@ -469,7 +468,7 @@
}
} else {
if ((packageRoot != null) && (packageConfig != null)) {
- throw new ArgumentError(
+ throw ArgumentError(
"Cannot simultaneously specify a "
"packageRoot and a packageConfig.",
);
@@ -497,7 +496,7 @@
// The VM will invoke [_startIsolate] and not `main`.
final packageConfigString = packageConfig?.toString();
- final RawReceivePort readyPort = new RawReceivePort(
+ final RawReceivePort readyPort = RawReceivePort(
null,
'Isolate.spawnUri ready',
);
@@ -526,14 +525,14 @@
}
static Future<Isolate> _spawnCommon(RawReceivePort readyPort) {
- final completer = new Completer<Isolate>.sync();
+ final completer = Completer<Isolate>.sync();
readyPort.handler = (readyMessage) {
readyPort.close();
if (readyMessage is List && readyMessage.length == 2) {
SendPort controlPort = readyMessage[0];
List capabilities = readyMessage[1];
completer.complete(
- new Isolate(
+ Isolate(
controlPort,
pauseCapability: capabilities[0],
terminateCapability: capabilities[1],
@@ -542,12 +541,12 @@
} else if (readyMessage is String) {
// We encountered an error while starting the new isolate.
completer.completeError(
- new IsolateSpawnException('Unable to spawn isolate: ${readyMessage}'),
+ IsolateSpawnException('Unable to spawn isolate: ${readyMessage}'),
);
} else {
// This shouldn't happen.
completer.completeError(
- new IsolateSpawnException(
+ IsolateSpawnException(
"Internal error: unexpected format for ready message: "
"'${readyMessage}'",
),
@@ -599,7 +598,7 @@
// _sendOOB expects a fixed length array and hence we create a fixed
// length array and assign values to it instead of using [ ... ].
var msg =
- new List<Object?>.filled(4, null)
+ List<Object?>.filled(4, null)
..[0] =
0 // Make room for OOB message type.
..[1] = _PAUSE
@@ -611,7 +610,7 @@
@patch
void resume(Capability resumeCapability) {
var msg =
- new List<Object?>.filled(4, null)
+ List<Object?>.filled(4, null)
..[0] =
0 // Make room for OOB message type.
..[1] = _RESUME
@@ -623,7 +622,7 @@
@patch
void addOnExitListener(SendPort responsePort, {Object? response}) {
var msg =
- new List<Object?>.filled(4, null)
+ List<Object?>.filled(4, null)
..[0] =
0 // Make room for OOB message type.
..[1] = _ADD_EXIT
@@ -635,7 +634,7 @@
@patch
void removeOnExitListener(SendPort responsePort) {
var msg =
- new List<Object?>.filled(3, null)
+ List<Object?>.filled(3, null)
..[0] =
0 // Make room for OOB message type.
..[1] = _DEL_EXIT
@@ -646,7 +645,7 @@
@patch
void setErrorsFatal(bool errorsAreFatal) {
var msg =
- new List<Object?>.filled(4, null)
+ List<Object?>.filled(4, null)
..[0] =
0 // Make room for OOB message type.
..[1] = _ERROR_FATAL
@@ -658,7 +657,7 @@
@patch
void kill({int priority = beforeNextEvent}) {
var msg =
- new List<Object?>.filled(4, null)
+ List<Object?>.filled(4, null)
..[0] =
0 // Make room for OOB message type.
..[1] = _KILL
@@ -674,7 +673,7 @@
int priority = immediate,
}) {
var msg =
- new List<Object?>.filled(5, null)
+ List<Object?>.filled(5, null)
..[0] =
0 // Make room for OOM message type.
..[1] = _PING
@@ -687,7 +686,7 @@
@patch
void addErrorListener(SendPort port) {
var msg =
- new List<Object?>.filled(3, null)
+ List<Object?>.filled(3, null)
..[0] =
0 // Make room for OOB message type.
..[1] = _ADD_ERROR
@@ -698,7 +697,7 @@
@patch
void removeErrorListener(SendPort port) {
var msg =
- new List<Object?>.filled(3, null)
+ List<Object?>.filled(3, null)
..[0] =
0 // Make room for OOB message type.
..[1] = _DEL_ERROR
@@ -708,7 +707,7 @@
static Isolate _getCurrentIsolate() {
List portAndCapabilities = _getPortAndCapabilitiesOfCurrentIsolate();
- return new Isolate(
+ return Isolate(
portAndCapabilities[0],
pauseCapability: portAndCapabilities[1],
terminateCapability: portAndCapabilities[2],
diff --git a/sdk/lib/_internal/vm/lib/lib_prefix.dart b/sdk/lib/_internal/vm/lib/lib_prefix.dart
index 1400eec..e434a79 100644
--- a/sdk/lib/_internal/vm/lib/lib_prefix.dart
+++ b/sdk/lib/_internal/vm/lib/lib_prefix.dart
@@ -20,7 +20,7 @@
@pragma("vm:external-name", "LibraryPrefix_issueLoad")
external static void _issueLoad(Object unit);
- static final _loads = new Map<Object, Completer<void>>();
+ static final _loads = Map<Object, Completer<void>>();
}
class _DeferredNotLoadedError extends Error implements NoSuchMethodError {
@@ -46,7 +46,7 @@
Completer<void>? load = _LibraryPrefix._loads[unit];
if (load == null) {
// Embedder loaded even though prefix.loadLibrary() wasn't called.
- _LibraryPrefix._loads[unit] = load = new Completer<void>();
+ _LibraryPrefix._loads[unit] = load = Completer<void>();
}
if (errorMessage == null) {
load.complete(null);
@@ -54,7 +54,7 @@
if (transientError) {
_LibraryPrefix._loads.remove(unit);
}
- load.completeError(new DeferredLoadException(errorMessage));
+ load.completeError(DeferredLoadException(errorMessage));
}
}
@@ -69,7 +69,7 @@
if (unit != 1) {
Completer<void>? load = _LibraryPrefix._loads[unit];
if (load == null) {
- _LibraryPrefix._loads[unit] = load = new Completer<void>();
+ _LibraryPrefix._loads[unit] = load = Completer<void>();
_LibraryPrefix._issueLoad(unit);
}
await load.future;
@@ -78,7 +78,7 @@
// Ensure the prefix's future does not complete until the next Turn even
// when loading is a no-op or synchronous. Helps applications avoid writing
// code that only works when loading isn't really deferred.
- await new Future<void>(() {
+ await Future<void>(() {
prefix._setLoaded();
});
}
@@ -87,6 +87,6 @@
@pragma("vm:never-inline") // Don't duplicate prefix checking code.
void _checkLoaded(_LibraryPrefix prefix) {
if (!prefix._isLoaded()) {
- throw new _DeferredNotLoadedError(prefix);
+ throw _DeferredNotLoadedError(prefix);
}
}
diff --git a/sdk/lib/_internal/vm/lib/math_patch.dart b/sdk/lib/_internal/vm/lib/math_patch.dart
index a5a7960..ea2832a 100644
--- a/sdk/lib/_internal/vm/lib/math_patch.dart
+++ b/sdk/lib/_internal/vm/lib/math_patch.dart
@@ -178,7 +178,7 @@
factory Random([int? seed]) {
var state = _Random._setupSeed((seed == null) ? _Random._nextSeed() : seed);
// Crank a couple of times to distribute the seed bits a bit further.
- return new _Random._withState(state)
+ return _Random._withState(state)
.._nextState()
.._nextState()
.._nextState()
@@ -207,7 +207,7 @@
int nextInt(int max) {
const limit = 0x3FFFFFFF;
if ((max <= 0) || ((max > limit) && (max > _POW2_32))) {
- throw new RangeError.range(
+ throw RangeError.range(
max,
1,
_POW2_32,
@@ -245,7 +245,7 @@
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 final _prng = new _Random._withState(_initialSeed());
+ static final _prng = _Random._withState(_initialSeed());
// Thomas Wang 64-bit mix.
// http://www.concentric.net/~Ttwang/tech/inthash.htm
diff --git a/sdk/lib/_internal/vm/lib/mirrors_impl.dart b/sdk/lib/_internal/vm/lib/mirrors_impl.dart
index c0a7b29..ea32c24 100644
--- a/sdk/lib/_internal/vm/lib/mirrors_impl.dart
+++ b/sdk/lib/_internal/vm/lib/mirrors_impl.dart
@@ -15,12 +15,12 @@
String _n(Symbol symbol) => internal.Symbol.getName(symbol as internal.Symbol);
Symbol _s(String name) {
- return new internal.Symbol.unvalidated(name);
+ return internal.Symbol.unvalidated(name);
}
Symbol? _sOpt(String? name) {
if (name == null) return null;
- return new internal.Symbol.unvalidated(name);
+ return internal.Symbol.unvalidated(name);
}
Symbol _computeQualifiedName(DeclarationMirror? owner, Symbol simpleName) {
@@ -32,7 +32,7 @@
TypeMirror returnType,
List<ParameterMirror> parameters,
) {
- StringBuffer buf = new StringBuffer();
+ StringBuffer buf = StringBuffer();
buf.write('(');
bool found_optional_positional = false;
bool found_optional_named = false;
@@ -78,25 +78,25 @@
for (var reflectee in reflectees) {
mirrors.add(reflect(reflectee));
}
- return new UnmodifiableListView<InstanceMirror>(mirrors);
+ return UnmodifiableListView<InstanceMirror>(mirrors);
}
@pragma("vm:external-name", "TypeMirror_subtypeTest")
external bool _subtypeTest(Type a, Type b);
class _MirrorSystem extends MirrorSystem {
- final TypeMirror dynamicType = new _SpecialTypeMirror._('dynamic');
- final TypeMirror voidType = new _SpecialTypeMirror._('void');
- final TypeMirror neverType = new _SpecialTypeMirror._('Never');
+ final TypeMirror dynamicType = _SpecialTypeMirror._('dynamic');
+ final TypeMirror voidType = _SpecialTypeMirror._('void');
+ final TypeMirror neverType = _SpecialTypeMirror._('Never');
var _libraries;
Map<Uri, LibraryMirror> get libraries {
if ((_libraries == null) || _dirty) {
- _libraries = new Map<Uri, LibraryMirror>();
+ _libraries = Map<Uri, LibraryMirror>();
for (LibraryMirror lib in _computeLibraries()) {
_libraries[lib.uri] = lib;
}
- _libraries = new UnmodifiableMapView<Uri, LibraryMirror>(_libraries);
+ _libraries = UnmodifiableMapView<Uri, LibraryMirror>(_libraries);
_dirty = false;
}
return _libraries;
@@ -147,7 +147,7 @@
var result = _loadUri(uri.toString());
if (result == null) {
// Censored library.
- throw new Exception("Cannot load $uri");
+ throw Exception("Cannot load $uri");
}
return result;
}
@@ -195,8 +195,8 @@
TypeMirror get returnType => _target.type;
List<ParameterMirror> get parameters {
if (isGetter) return const <ParameterMirror>[];
- return new UnmodifiableListView<ParameterMirror>(<ParameterMirror>[
- new _SyntheticSetterParameter(this, this._target),
+ return UnmodifiableListView<ParameterMirror>(<ParameterMirror>[
+ _SyntheticSetterParameter(this, this._target),
]);
}
@@ -247,9 +247,9 @@
int numPositionalArguments = positionalArguments.length;
int numNamedArguments = namedArguments.length;
int numArguments = numPositionalArguments + numNamedArguments;
- List arguments = new List<dynamic>.filled(numArguments, null);
+ List arguments = List<dynamic>.filled(numArguments, null);
arguments.setRange(0, numPositionalArguments, positionalArguments);
- List names = new List<dynamic>.filled(numNamedArguments, null);
+ List names = List<dynamic>.filled(numNamedArguments, null);
int argumentIndex = numPositionalArguments;
int nameIndex = 0;
if (numNamedArguments > 0) {
@@ -343,10 +343,10 @@
int numPositionalArguments = positionalArguments.length + 1; // Receiver.
int numNamedArguments = namedArguments.length;
int numArguments = numPositionalArguments + numNamedArguments;
- List arguments = new List<dynamic>.filled(numArguments, null);
+ List arguments = List<dynamic>.filled(numArguments, null);
arguments[0] = _reflectee; // Receiver.
arguments.setRange(1, numPositionalArguments, positionalArguments);
- List names = new List<dynamic>.filled(numNamedArguments, null);
+ List names = List<dynamic>.filled(numNamedArguments, null);
int argumentIndex = numPositionalArguments;
int nameIndex = 0;
if (numNamedArguments > 0) {
@@ -433,9 +433,7 @@
bool get hasReflectedType => !_isGenericDeclaration;
Type get reflectedType {
if (!hasReflectedType) {
- throw new UnsupportedError(
- "Declarations of generics have no reflected type",
- );
+ throw UnsupportedError("Declarations of generics have no reflected type");
}
return _reflectedType;
}
@@ -510,7 +508,7 @@
for (var interfaceType in interfaceTypes) {
interfaceMirrors.add(reflectType(interfaceType) as ClassMirror);
}
- return _superinterfaces = new UnmodifiableListView<ClassMirror>(
+ return _superinterfaces = UnmodifiableListView<ClassMirror>(
interfaceMirrors,
);
}
@@ -550,7 +548,7 @@
var m = _cachedStaticMembers;
if (m != null) m;
- var result = new Map<Symbol, MethodMirror>();
+ var result = Map<Symbol, MethodMirror>();
var library = this.owner as LibraryMirror;
declarations.values.forEach((decl) {
if (decl is MethodMirror && decl.isStatic && !decl.isConstructor) {
@@ -558,7 +556,7 @@
}
if (decl is VariableMirror && decl.isStatic) {
var getterName = decl.simpleName;
- result[getterName] = new _SyntheticAccessor(
+ result[getterName] = _SyntheticAccessor(
this,
getterName,
true,
@@ -568,7 +566,7 @@
);
if (!decl.isFinal) {
var setterName = _asSetter(decl.simpleName, library);
- result[setterName] = new _SyntheticAccessor(
+ result[setterName] = _SyntheticAccessor(
this,
setterName,
false,
@@ -579,7 +577,7 @@
}
}
});
- return _cachedStaticMembers = new UnmodifiableMapView<Symbol, MethodMirror>(
+ return _cachedStaticMembers = UnmodifiableMapView<Symbol, MethodMirror>(
result,
);
}
@@ -589,7 +587,7 @@
var m = _cachedInstanceMembers;
if (m != null) return m;
- var result = new Map<Symbol, MethodMirror>();
+ var result = Map<Symbol, MethodMirror>();
var library = this.owner as LibraryMirror;
var sup = superclass;
if (sup != null) {
@@ -604,7 +602,7 @@
}
if (decl is VariableMirror && !decl.isStatic) {
var getterName = decl.simpleName;
- result[getterName] = new _SyntheticAccessor(
+ result[getterName] = _SyntheticAccessor(
this,
getterName,
true,
@@ -614,7 +612,7 @@
);
if (!decl.isFinal) {
var setterName = _asSetter(decl.simpleName, library);
- result[setterName] = new _SyntheticAccessor(
+ result[setterName] = _SyntheticAccessor(
this,
setterName,
false,
@@ -625,8 +623,9 @@
}
}
});
- return _cachedInstanceMembers =
- new UnmodifiableMapView<Symbol, MethodMirror>(result);
+ return _cachedInstanceMembers = UnmodifiableMapView<Symbol, MethodMirror>(
+ result,
+ );
}
Map<Symbol, DeclarationMirror>? _declarations;
@@ -634,7 +633,7 @@
var d = _declarations;
if (d != null) return d;
- var decls = new Map<Symbol, DeclarationMirror>();
+ var decls = Map<Symbol, DeclarationMirror>();
var members = _computeMembers(mixin, _instantiator, _reflectee);
for (var member in members) {
@@ -652,7 +651,7 @@
decls[typeVariable.simpleName] = typeVariable;
}
- return _declarations = new UnmodifiableMapView<Symbol, DeclarationMirror>(
+ return _declarations = UnmodifiableMapView<Symbol, DeclarationMirror>(
decls,
);
}
@@ -677,12 +676,10 @@
ClassMirror owner = originalDeclaration;
var mirror;
for (var i = 0; i < params.length; i += 2) {
- mirror = new _TypeVariableMirror._(params[i + 1], params[i], owner);
+ mirror = _TypeVariableMirror._(params[i + 1], params[i], owner);
result.add(mirror);
}
- return _typeVariables = new UnmodifiableListView<TypeVariableMirror>(
- result,
- );
+ return _typeVariables = UnmodifiableListView<TypeVariableMirror>(result);
}
List<TypeMirror>? _typeArguments;
@@ -694,7 +691,7 @@
(!_isTransformedMixinApplication && _isAnonymousMixinApplication)) {
return _typeArguments = const <TypeMirror>[];
} else {
- return _typeArguments = new UnmodifiableListView<TypeMirror>(
+ return _typeArguments = UnmodifiableListView<TypeMirror>(
_computeTypeArguments(_reflectedType).cast<TypeMirror>(),
);
}
@@ -722,9 +719,9 @@
int numPositionalArguments = positionalArguments.length;
int numNamedArguments = namedArguments.length;
int numArguments = numPositionalArguments + numNamedArguments;
- List arguments = new List<dynamic>.filled(numArguments, null);
+ List arguments = List<dynamic>.filled(numArguments, null);
arguments.setRange(0, numPositionalArguments, positionalArguments);
- List names = new List<dynamic>.filled(numNamedArguments, null);
+ List names = List<dynamic>.filled(numNamedArguments, null);
int argumentIndex = numPositionalArguments;
int nameIndex = 0;
if (numNamedArguments > 0) {
@@ -777,7 +774,7 @@
bool isSubclassOf(ClassMirror other) {
// TODO: Remove these null checks once all code is opted into strong nonnullable mode.
if (other == null) {
- throw new ArgumentError.notNull('other');
+ throw ArgumentError.notNull('other');
}
ClassMirror otherDeclaration = other.originalDeclaration as ClassMirror;
ClassMirror? c = this;
@@ -886,7 +883,7 @@
List<ParameterMirror> get parameters {
var p = _parameters;
if (p != null) return p;
- return _parameters = new UnmodifiableListView<ParameterMirror>(
+ return _parameters = UnmodifiableListView<ParameterMirror>(
_FunctionTypeMirror_parameters(
_signatureReflectee,
).cast<ParameterMirror>(),
@@ -972,7 +969,7 @@
bool get hasReflectedType => false;
Type get reflectedType {
- throw new UnsupportedError('Type variables have no reflected type');
+ throw UnsupportedError('Type variables have no reflected type');
}
Type get _reflectedType => _reflectee;
@@ -1044,13 +1041,13 @@
var d = _declarations;
if (d != null) return d;
- var decls = new Map<Symbol, DeclarationMirror>();
+ var decls = Map<Symbol, DeclarationMirror>();
var members = _computeMembers(_reflectee);
for (var member in members) {
decls[member.simpleName] = member;
}
- return _declarations = new UnmodifiableMapView<Symbol, DeclarationMirror>(
+ return _declarations = UnmodifiableMapView<Symbol, DeclarationMirror>(
decls,
);
}
@@ -1076,7 +1073,7 @@
var d = _cachedLibraryDependencies;
if (d != null) return d;
return _cachedLibraryDependencies =
- new UnmodifiableListView<LibraryDependencyMirror>(
+ UnmodifiableListView<LibraryDependencyMirror>(
_libraryDependencies(_reflectee).cast<LibraryDependencyMirror>(),
);
}
@@ -1116,7 +1113,7 @@
this.isDeferred,
List<dynamic> unwrappedMetadata,
) : prefix = _sOpt(prefixString),
- combinators = new UnmodifiableListView<CombinatorMirror>(
+ combinators = UnmodifiableListView<CombinatorMirror>(
mutableCombinators.cast<CombinatorMirror>(),
),
metadata = _wrapMetadata(unwrappedMetadata);
@@ -1136,7 +1133,7 @@
Future<LibraryMirror> loadLibrary() {
if (_targetMirrorOrPrefix is _LibraryMirror) {
- return new Future.value(_targetMirrorOrPrefix);
+ return Future.value(_targetMirrorOrPrefix);
}
var savedPrefix = _targetMirrorOrPrefix;
return savedPrefix.loadLibrary().then((_) {
@@ -1155,7 +1152,7 @@
final bool isShow;
_CombinatorMirror._(identifierString, this.isShow)
- : this.identifiers = new UnmodifiableListView<Symbol>(<Symbol>[
+ : this.identifiers = UnmodifiableListView<Symbol>(<Symbol>[
_s(identifierString),
]);
@@ -1206,7 +1203,7 @@
bool get isExtensionTypeMember =>
0 != (_kindFlags & (1 << kExtensionTypeMember));
- static const _operators = const [
+ static const _operators = [
"%", "&", "*", "+", "-", "/", "<", "<<", //
"<=", "==", ">", ">=", ">>", "[]", "[]=",
"^", "|", "~", "unary-", "~/",
@@ -1244,7 +1241,7 @@
List<ParameterMirror> get parameters {
var p = _parameters;
if (p != null) return p;
- return _parameters = new UnmodifiableListView<ParameterMirror>(
+ return _parameters = UnmodifiableListView<ParameterMirror>(
_MethodMirror_parameters(_reflectee).cast<ParameterMirror>(),
);
}
@@ -1261,7 +1258,7 @@
} else {
var parts = MirrorSystem.getName(simpleName).split('.');
if (parts.length > 2) {
- throw new _InternalMirrorError(
+ throw _InternalMirrorError(
'Internal error in MethodMirror.constructorName: '
'malformed name <$simpleName>',
);
@@ -1334,7 +1331,7 @@
} else if (o is _LibraryMirror) {
return o._instantiator;
} else {
- throw new UnsupportedError("unexpected owner ${owner}");
+ throw UnsupportedError("unexpected owner ${owner}");
}
}
@@ -1395,7 +1392,7 @@
bool get hasDefaultValue => _defaultValueReflectee != null;
SourceLocation? get location {
- throw new UnsupportedError("ParameterMirror.location unimplemented");
+ throw UnsupportedError("ParameterMirror.location unimplemented");
}
List<InstanceMirror> get metadata {
@@ -1440,7 +1437,7 @@
bool get hasReflectedType => simpleName == #dynamic;
Type get reflectedType {
if (simpleName == #dynamic) return dynamic;
- throw new UnsupportedError("void has no reflected type");
+ throw UnsupportedError("void has no reflected type");
}
List<TypeVariableMirror> get typeVariables => const <TypeVariableMirror>[];
@@ -1472,7 +1469,7 @@
}
class _Mirrors {
- static MirrorSystem _currentMirrorSystem = new _MirrorSystem();
+ static MirrorSystem _currentMirrorSystem = _MirrorSystem();
static MirrorSystem currentMirrorSystem() {
return _currentMirrorSystem;
}
@@ -1480,8 +1477,8 @@
// Creates a new local mirror for some Object.
static InstanceMirror reflect(dynamic reflectee) {
return reflectee is Function
- ? new _ClosureMirror._(reflectee)
- : new _InstanceMirror._(reflectee);
+ ? _ClosureMirror._(reflectee)
+ : _InstanceMirror._(reflectee);
}
@pragma("vm:external-name", "Mirrors_makeLocalClassMirror")
@@ -1491,8 +1488,8 @@
@pragma("vm:external-name", "Mirrors_instantiateGenericType")
external static Type _instantiateGenericType(Type key, typeArguments);
- static Expando<_ClassMirror> _declarationCache = new Expando("ClassMirror");
- static Expando<TypeMirror> _instantiationCache = new Expando("TypeMirror");
+ static Expando<_ClassMirror> _declarationCache = Expando("ClassMirror");
+ static Expando<TypeMirror> _instantiationCache = Expando("TypeMirror");
static ClassMirror reflectClass(Type key) {
var classMirror = _declarationCache[key];
@@ -1523,7 +1520,7 @@
static Type _instantiateType(Type key, List<Type> typeArguments) {
if (typeArguments.isEmpty) {
- throw new ArgumentError.value(
+ throw ArgumentError.value(
typeArguments,
'typeArguments',
'Type arguments list cannot be empty.',
diff --git a/sdk/lib/_internal/vm/lib/mirrors_patch.dart b/sdk/lib/_internal/vm/lib/mirrors_patch.dart
index 7bfbafd..0d94520 100644
--- a/sdk/lib/_internal/vm/lib/mirrors_patch.dart
+++ b/sdk/lib/_internal/vm/lib/mirrors_patch.dart
@@ -66,12 +66,12 @@
}
if (candidates.length > 1) {
var uris = candidates.map((lib) => lib.uri.toString()).toList();
- throw new Exception(
+ throw Exception(
"There are multiple libraries named "
"'${getName(libraryName)}': $uris",
);
}
- throw new Exception("There is no library named '${getName(libraryName)}'");
+ throw Exception("There is no library named '${getName(libraryName)}'");
}
@patch
@@ -83,12 +83,12 @@
static Symbol getSymbol(String name, [LibraryMirror? library]) {
if ((library != null && library is! _LibraryMirror) ||
((name.length > 0) && (name[0] == '_') && (library == null))) {
- throw new ArgumentError(library);
+ throw ArgumentError(library);
}
if (library != null) {
name = _mangleName(name, (library as _LibraryMirror)._reflectee);
}
- return new internal.Symbol.unvalidated(name);
+ return internal.Symbol.unvalidated(name);
}
@pragma("vm:external-name", "Mirrors_mangleName")
diff --git a/sdk/lib/_internal/vm/lib/object_patch.dart b/sdk/lib/_internal/vm/lib/object_patch.dart
index cb1ff94..44150d3 100644
--- a/sdk/lib/_internal/vm/lib/object_patch.dart
+++ b/sdk/lib/_internal/vm/lib/object_patch.dart
@@ -35,7 +35,7 @@
@pragma("vm:entry-point", "call")
dynamic noSuchMethod(Invocation invocation) {
// TODO(regis): Remove temp constructor identifier 'withInvocation'.
- throw new NoSuchMethodError.withInvocation(this, invocation);
+ throw NoSuchMethodError.withInvocation(this, invocation);
}
@patch
diff --git a/sdk/lib/_internal/vm/lib/print_patch.dart b/sdk/lib/_internal/vm/lib/print_patch.dart
index 9722839..bc0b00d 100644
--- a/sdk/lib/_internal/vm/lib/print_patch.dart
+++ b/sdk/lib/_internal/vm/lib/print_patch.dart
@@ -14,7 +14,7 @@
}
void _unsupportedPrint(String line) {
- throw new UnsupportedError("'print' is not supported");
+ throw UnsupportedError("'print' is not supported");
}
// _printClosure can be overwritten by the embedder to supply a different
diff --git a/sdk/lib/_internal/vm/lib/profiler.dart b/sdk/lib/_internal/vm/lib/profiler.dart
index ec7ed53..9c04690 100644
--- a/sdk/lib/_internal/vm/lib/profiler.dart
+++ b/sdk/lib/_internal/vm/lib/profiler.dart
@@ -8,7 +8,7 @@
class UserTag {
@patch
factory UserTag(String label) {
- return new _UserTag(label);
+ return _UserTag(label);
}
@patch
static UserTag get defaultTag => _getDefaultTag();
diff --git a/sdk/lib/_internal/vm/lib/regexp_patch.dart b/sdk/lib/_internal/vm/lib/regexp_patch.dart
index 5a80d10..3e01bcd 100644
--- a/sdk/lib/_internal/vm/lib/regexp_patch.dart
+++ b/sdk/lib/_internal/vm/lib/regexp_patch.dart
@@ -14,7 +14,7 @@
bool unicode = false,
bool dotAll = false,
}) {
- return new _RegExp(
+ return _RegExp(
source,
multiLine: multiLine,
caseSensitive: caseSensitive,
@@ -59,7 +59,7 @@
// If the text contains no characters needing escape, return it directly.
if (escapeCharIndex == text.length) return text;
- var buffer = new StringBuffer();
+ var buffer = StringBuffer();
int previousSliceEndIndex = 0;
do {
// Copy characters from previous escape to current escape into result.
@@ -96,7 +96,7 @@
String? group(int groupIdx) {
if (groupIdx < 0 || groupIdx > _regexp._groupCount) {
- throw new RangeError.value(groupIdx);
+ throw RangeError.value(groupIdx);
}
int startIndex = _start(groupIdx);
int endIndex = _end(groupIdx);
@@ -112,7 +112,7 @@
}
List<String?> groups(List<int> groupsSpec) {
- var groupsList = new List<String?>.filled(groupsSpec.length, null);
+ var groupsList = List<String?>.filled(groupsSpec.length, null);
for (int i = 0; i < groupsSpec.length; i++) {
groupsList[i] = group(groupsSpec[i]);
}
@@ -156,46 +156,46 @@
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');
+ if (input == null) throw ArgumentError.notNull('input');
final match = _ExecuteMatch(input, 0);
if (match == null) {
return null;
}
- return new _RegExpMatch._(this, input, match);
+ return _RegExpMatch._(this, input, match);
}
Iterable<RegExpMatch> allMatches(String string, [int start = 0]) {
// TODO: Remove these null checks once all code is opted into strong nonnullable mode.
- if (string == null) throw new ArgumentError.notNull('string');
- if (start == null) throw new ArgumentError.notNull('start');
+ if (string == null) throw ArgumentError.notNull('string');
+ if (start == null) throw ArgumentError.notNull('start');
if (0 > start || 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? matchAsPrefix(String string, [int start = 0]) {
// TODO: Remove these null checks once all code is opted into strong nonnullable mode.
- if (string == null) throw new ArgumentError.notNull('string');
- if (start == null) throw new ArgumentError.notNull('start');
+ if (string == null) throw ArgumentError.notNull('string');
+ if (start == null) throw ArgumentError.notNull('start');
if (start < 0 || start > string.length) {
- throw new RangeError.range(start, 0, string.length);
+ throw RangeError.range(start, 0, string.length);
}
final list = _ExecuteMatchSticky(string, start);
if (list == null) return null;
- return new _RegExpMatch._(this, string, list);
+ return _RegExpMatch._(this, string, list);
}
bool hasMatch(String input) {
// TODO: Remove these null checks once all code is opted into strong nonnullable mode.
- if (input == null) throw new ArgumentError.notNull('input');
+ if (input == null) throw ArgumentError.notNull('input');
List? match = _ExecuteMatch(input, 0);
return (match == null) ? false : true;
}
String? stringMatch(String input) {
// TODO: Remove these null checks once all code is opted into strong nonnullable mode.
- if (input == null) throw new ArgumentError.notNull('input');
+ if (input == null) throw ArgumentError.notNull('input');
List? match = _ExecuteMatch(input, 0);
if (match == null) {
return null;
@@ -253,7 +253,7 @@
// Byte map of one byte characters with a 0xff if the character is a word
// character (digit, letter or underscore) and 0x00 otherwise.
// Used by generated RegExp code.
- static const List<int> _wordCharacterMap = const <int>[
+ static const List<int> _wordCharacterMap = <int>[
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -337,8 +337,7 @@
_AllMatchesIterable(this._re, this._str, this._start);
- Iterator<RegExpMatch> get iterator =>
- new _AllMatchesIterator(_re, _str, _start);
+ Iterator<RegExpMatch> get iterator => _AllMatchesIterator(_re, _str, _start);
}
class _AllMatchesIterator implements Iterator<RegExpMatch> {
@@ -365,7 +364,7 @@
if (_nextIndex <= _str.length) {
final match = re._ExecuteMatch(_str, _nextIndex);
if (match != null) {
- var current = new _RegExpMatch._(re, _str, match);
+ var current = _RegExpMatch._(re, _str, match);
_current = current;
_nextIndex = current.end;
if (_nextIndex == current.start) {
diff --git a/sdk/lib/_internal/vm/lib/schedule_microtask_patch.dart b/sdk/lib/_internal/vm/lib/schedule_microtask_patch.dart
index 956826e..dd5bb1a 100644
--- a/sdk/lib/_internal/vm/lib/schedule_microtask_patch.dart
+++ b/sdk/lib/_internal/vm/lib/schedule_microtask_patch.dart
@@ -10,7 +10,7 @@
static void _scheduleImmediate(void callback()) {
final closure = _ScheduleImmediate._closure;
if (closure == null) {
- throw new UnsupportedError("Microtasks are not supported");
+ throw UnsupportedError("Microtasks are not supported");
}
closure(callback);
}
diff --git a/sdk/lib/_internal/vm/lib/string_patch.dart b/sdk/lib/_internal/vm/lib/string_patch.dart
index cf8291b..df611c3 100644
--- a/sdk/lib/_internal/vm/lib/string_patch.dart
+++ b/sdk/lib/_internal/vm/lib/string_patch.dart
@@ -20,8 +20,8 @@
int? end,
]) {
// TODO: Remove these null checks once all code is opted into strong nonnullable mode.
- if (charCodes == null) throw new ArgumentError.notNull("charCodes");
- if (start == null) throw new ArgumentError.notNull("start");
+ if (charCodes == null) throw ArgumentError.notNull("charCodes");
+ if (start == null) throw ArgumentError.notNull("start");
return _StringBase.createFromCharCodes(charCodes, start, end, null);
}
@@ -43,7 +43,7 @@
.._setAt(1, low);
}
}
- throw new RangeError.range(charCode, 0, 0x10ffff);
+ throw RangeError.range(charCode, 0, 0x10ffff);
}
@patch
@@ -96,7 +96,7 @@
static const int _maxJoinReplaceOneByteStringLength = 500;
factory _StringBase._uninstantiable() {
- throw new UnsupportedError("_StringBase can't be instantiated");
+ throw UnsupportedError("_StringBase can't be instantiated");
}
@pragma("vm:recognized", "asm-intrinsic")
@@ -170,7 +170,7 @@
final int actualLimit = limit ?? _scanCodeUnits(typedCharCodes, start, end);
if (actualLimit < 0) {
- throw new ArgumentError(typedCharCodes);
+ throw ArgumentError(typedCharCodes);
}
if (actualLimit <= _maxLatin1) {
return _createOneByteString(typedCharCodes, start, len);
@@ -192,7 +192,7 @@
int bits = 0;
for (int i = start; i < end; i++) {
int code = charCodes[i];
- if (code is! _Smi) throw new ArgumentError(charCodes);
+ if (code is! _Smi) throw ArgumentError(charCodes);
bits |= code;
}
return bits;
@@ -375,7 +375,7 @@
bool startsWith(Pattern pattern, [int index = 0]) {
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) {
return _substringMatches(index, pattern);
@@ -417,7 +417,7 @@
if (start == null) {
start = this.length;
} 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;
@@ -580,7 +580,7 @@
String operator *(int times) {
if (times <= 0) return "";
if (times == 1) return this;
- StringBuffer buffer = new StringBuffer(this);
+ StringBuffer buffer = StringBuffer(this);
for (int i = 1; i < times; i++) {
buffer.write(this);
}
@@ -590,7 +590,7 @@
String padLeft(int width, [String padding = ' ']) {
int delta = width - this.length;
if (delta <= 0) return this;
- StringBuffer buffer = new StringBuffer();
+ StringBuffer buffer = StringBuffer();
for (int i = 0; i < delta; i++) {
buffer.write(padding);
}
@@ -601,7 +601,7 @@
String padRight(int width, [String padding = ' ']) {
int delta = width - this.length;
if (delta <= 0) return this;
- StringBuffer buffer = new StringBuffer(this);
+ StringBuffer buffer = StringBuffer(this);
for (int i = 0; i < delta; i++) {
buffer.write(padding);
}
@@ -671,8 +671,8 @@
}
String replaceAll(Pattern pattern, String replacement) {
- if (pattern == null) throw new ArgumentError.notNull("pattern");
- if (replacement == null) throw new ArgumentError.notNull("replacement");
+ if (pattern == null) throw ArgumentError.notNull("pattern");
+ if (replacement == null) throw ArgumentError.notNull("replacement");
int startIndex = 0;
// String fragments that replace the prefix [this] up to [startIndex].
@@ -770,8 +770,8 @@
);
String replaceAllMapped(Pattern pattern, String replace(Match match)) {
- if (pattern == null) throw new ArgumentError.notNull("pattern");
- if (replace == null) throw new ArgumentError.notNull("replace");
+ if (pattern == null) throw ArgumentError.notNull("pattern");
+ if (replace == null) throw ArgumentError.notNull("replace");
List matches = [];
int length = 0;
int startIndex = 0;
@@ -805,9 +805,9 @@
String replace(Match match), [
int startIndex = 0,
]) {
- if (pattern == null) throw new ArgumentError.notNull("pattern");
- if (replace == null) throw new ArgumentError.notNull("replace");
- if (startIndex == null) throw new ArgumentError.notNull("startIndex");
+ if (pattern == null) throw ArgumentError.notNull("pattern");
+ if (replace == null) throw ArgumentError.notNull("replace");
+ if (startIndex == null) throw ArgumentError.notNull("startIndex");
RangeError.checkValueInInterval(startIndex, 0, this.length, "startIndex");
var matches = pattern.allMatches(this, startIndex).iterator;
@@ -825,12 +825,12 @@
String onNonMatch(String nonMatch),
) {
// Pattern is the empty string.
- StringBuffer buffer = new StringBuffer();
+ StringBuffer buffer = StringBuffer();
int length = this.length;
int i = 0;
buffer.write(onNonMatch(""));
while (i < length) {
- buffer.write(onMatch(new _StringMatch(i, this, "")));
+ buffer.write(onMatch(_StringMatch(i, this, "")));
// Special case to avoid splitting a surrogate pair.
int code = this.codeUnitAt(i);
if ((code & ~0x3FF) == 0xD800 && length > i + 1) {
@@ -846,7 +846,7 @@
buffer.write(onNonMatch(this[i]));
i++;
}
- buffer.write(onMatch(new _StringMatch(i, this, "")));
+ buffer.write(onMatch(_StringMatch(i, this, "")));
buffer.write(onNonMatch(""));
return buffer.toString();
}
@@ -857,7 +857,7 @@
String onNonMatch(String nonMatch)?,
}) {
if (pattern == null) {
- throw new ArgumentError.notNull("pattern");
+ throw ArgumentError.notNull("pattern");
}
onMatch ??= _matchString;
onNonMatch ??= _stringIdentity;
@@ -867,7 +867,7 @@
return _splitMapJoinEmptyString(onMatch, onNonMatch);
}
}
- StringBuffer buffer = new StringBuffer();
+ StringBuffer buffer = StringBuffer();
int startIndex = 0;
for (Match match in pattern.allMatches(this)) {
buffer.write(onNonMatch(this.substring(startIndex, match.start)));
@@ -932,23 +932,19 @@
static ArgumentError _interpolationError(Object? o, Object? result) {
// Since Dart 2.0, [result] can only be null.
- return new ArgumentError.value(
- o,
- "object",
- "toString method returned 'null'",
- );
+ return ArgumentError.value(o, "object", "toString method returned 'null'");
}
Iterable<Match> allMatches(String string, [int start = 0]) {
if (start < 0 || start > string.length) {
- throw new RangeError.range(start, 0, string.length, "start");
+ throw RangeError.range(start, 0, string.length, "start");
}
- return new _StringAllMatchesIterable(string, this, start);
+ return _StringAllMatchesIterable(string, this, 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;
for (int i = 0; i < this.length; i++) {
@@ -956,12 +952,12 @@
return null;
}
}
- return new _StringMatch(start, string, this);
+ return _StringMatch(start, string, this);
}
List<String> split(Pattern pattern) {
if ((pattern is String) && pattern.isEmpty) {
- List<String> result = new List<String>.generate(
+ List<String> result = List<String>.generate(
this.length,
(int i) => this[i],
);
@@ -999,9 +995,9 @@
return result;
}
- List<int> get codeUnits => new CodeUnits(this);
+ List<int> get codeUnits => CodeUnits(this);
- Runes get runes => new Runes(this);
+ Runes get runes => Runes(this);
@pragma("vm:external-name", "String_toUpperCase")
external String toUpperCase();
@@ -1446,7 +1442,7 @@
String group(int group) {
if (group != 0) {
- throw new RangeError.value(group);
+ throw RangeError.value(group);
}
return pattern;
}
@@ -1472,12 +1468,12 @@
_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 = _input.indexOf(_pattern, _index);
if (index >= 0) {
- return new _StringMatch(index, _input, _pattern);
+ return _StringMatch(index, _input, _pattern);
}
throw IterableElementError.noElement();
}
@@ -1503,7 +1499,7 @@
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;
diff --git a/sdk/lib/_internal/vm/lib/symbol_patch.dart b/sdk/lib/_internal/vm/lib/symbol_patch.dart
index 47667de..b9837ff 100644
--- a/sdk/lib/_internal/vm/lib/symbol_patch.dart
+++ b/sdk/lib/_internal/vm/lib/symbol_patch.dart
@@ -24,7 +24,7 @@
// Class._constructor@xxx -> Class._constructor
// _Class@xxx._constructor@xxx -> _Class._constructor
// lib._S@xxx with lib._M1@xxx, lib._M2@xxx -> lib._S with lib._M1, lib._M2
- StringBuffer result = new StringBuffer();
+ StringBuffer result = StringBuffer();
bool add_setter_suffix = false;
var pos = 0;
if (string.length >= 4 && string[3] == ':') {
diff --git a/sdk/lib/_internal/vm/lib/timer_impl.dart b/sdk/lib/_internal/vm/lib/timer_impl.dart
index d430296..6de42705 100644
--- a/sdk/lib/_internal/vm/lib/timer_impl.dart
+++ b/sdk/lib/_internal/vm/lib/timer_impl.dart
@@ -133,7 +133,7 @@
// 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 final _heap = new _TimerHeap();
+ static final _heap = _TimerHeap();
static _Timer? _firstZeroTimer;
static _Timer _lastZeroTimer = _sentinelTimer;
@@ -198,7 +198,7 @@
int now = VMLibraryHooks.timerMillisecondClock();
int wakeupTime = (milliSeconds == 0) ? now : (now + 1 + milliSeconds);
- _Timer timer = new _Timer._internal(
+ _Timer timer = _Timer._internal(
callback,
wakeupTime,
milliSeconds,
@@ -491,9 +491,9 @@
bool repeating,
) {
if (repeating) {
- return new _Timer.periodic(milliSeconds, callback);
+ return _Timer.periodic(milliSeconds, callback);
}
- return new _Timer(milliSeconds, callback);
+ return _Timer(milliSeconds, callback);
}
}
diff --git a/sdk/lib/_internal/vm/lib/timer_patch.dart b/sdk/lib/_internal/vm/lib/timer_patch.dart
index f1767a8..4842130 100644
--- a/sdk/lib/_internal/vm/lib/timer_patch.dart
+++ b/sdk/lib/_internal/vm/lib/timer_patch.dart
@@ -10,7 +10,7 @@
static Timer _createTimer(Duration duration, void callback()) {
final factory = VMLibraryHooks.timerFactory;
if (factory == null) {
- throw new UnsupportedError("Timer interface not supported.");
+ throw UnsupportedError("Timer interface not supported.");
}
int milliseconds = duration.inMilliseconds;
if (milliseconds < 0) milliseconds = 0;
@@ -26,7 +26,7 @@
) {
final factory = VMLibraryHooks.timerFactory;
if (factory == null) {
- throw new UnsupportedError("Timer interface not supported.");
+ throw UnsupportedError("Timer interface not supported.");
}
int milliseconds = duration.inMilliseconds;
if (milliseconds < 0) milliseconds = 0;
diff --git a/sdk/lib/_internal/vm/lib/typed_data_patch.dart b/sdk/lib/_internal/vm/lib/typed_data_patch.dart
index 02d83ce..1e22f6b 100644
--- a/sdk/lib/_internal/vm/lib/typed_data_patch.dart
+++ b/sdk/lib/_internal/vm/lib/typed_data_patch.dart
@@ -39,14 +39,14 @@
@patch
@pragma("vm:recognized", "other")
factory ByteData(int length) {
- final list = new Uint8List(length) as _TypedList;
+ final list = Uint8List(length) as _TypedList;
_rangeCheck(list.lengthInBytes, 0, length);
- return new _ByteDataView._(list, 0, length);
+ return _ByteDataView._(list, 0, length);
}
factory ByteData._view(_TypedList typedData, int offsetInBytes, int length) {
_rangeCheck(typedData.lengthInBytes, offsetInBytes, length);
- return new _ByteDataView._(typedData, offsetInBytes, length);
+ return _ByteDataView._(typedData, offsetInBytes, length);
}
}
@@ -69,7 +69,7 @@
// Method(s) implementing the Collection interface.
String join([String separator = ""]) {
- StringBuffer buffer = new StringBuffer();
+ StringBuffer buffer = StringBuffer();
buffer.writeAll(this as Iterable, separator);
return buffer.toString();
}
@@ -83,23 +83,23 @@
// Method(s) implementing the List interface.
set length(newLength) {
- throw new UnsupportedError("Cannot resize a fixed-length list");
+ throw UnsupportedError("Cannot resize a fixed-length list");
}
void clear() {
- throw new UnsupportedError("Cannot remove from a fixed-length list");
+ throw UnsupportedError("Cannot remove from a fixed-length list");
}
bool remove(Object? element) {
- throw new UnsupportedError("Cannot remove from a fixed-length list");
+ throw UnsupportedError("Cannot remove from a fixed-length list");
}
void removeRange(int start, int end) {
- throw new UnsupportedError("Cannot remove from a fixed-length list");
+ throw UnsupportedError("Cannot remove from a fixed-length list");
}
void replaceRange(int start, int end, Iterable iterable) {
- throw new UnsupportedError("Cannot remove from a fixed-length list");
+ throw UnsupportedError("Cannot remove from a fixed-length list");
}
@pragma("vm:prefer-inline")
@@ -235,10 +235,10 @@
int get offsetInBytes;
_ByteBuffer get buffer;
- Iterable<T> whereType<T>() => new WhereTypeIterable<T>(this);
+ Iterable<T> whereType<T>() => WhereTypeIterable<T>(this);
Iterable<int> followedBy(Iterable<int> other) =>
- new FollowedByIterable<int>.firstEfficient(this, other);
+ FollowedByIterable<int>.firstEfficient(this, other);
List<R> cast<R>() => List.castFrom<int, R>(this);
void set first(int value) {
@@ -279,7 +279,7 @@
}
void shuffle([Random? random]) {
- random ??= new Random();
+ random ??= Random();
var i = this.length;
while (i > 1) {
int pos = random.nextInt(i);
@@ -290,35 +290,35 @@
}
}
- Iterable<int> where(bool f(int element)) => new WhereIterable<int>(this, f);
+ Iterable<int> where(bool f(int element)) => WhereIterable<int>(this, f);
- Iterable<int> take(int n) => new SubListIterable<int>(this, 0, n);
+ Iterable<int> take(int n) => SubListIterable<int>(this, 0, n);
Iterable<int> takeWhile(bool test(int element)) =>
- new TakeWhileIterable<int>(this, test);
+ TakeWhileIterable<int>(this, test);
- Iterable<int> skip(int n) => new SubListIterable<int>(this, n, null);
+ Iterable<int> skip(int n) => SubListIterable<int>(this, n, null);
Iterable<int> skipWhile(bool test(int element)) =>
- new SkipWhileIterable<int>(this, test);
+ SkipWhileIterable<int>(this, test);
- Iterable<int> get reversed => new ReversedListIterable<int>(this);
+ Iterable<int> get reversed => ReversedListIterable<int>(this);
- Map<int, int> asMap() => new ListMapView<int>(this);
+ Map<int, int> asMap() => ListMapView<int>(this);
Iterable<int> getRange(int start, [int? end]) {
int endIndex = RangeError.checkValidRange(start, end, this.length);
- return new SubListIterable<int>(this, start, endIndex);
+ return SubListIterable<int>(this, start, endIndex);
}
- Iterator<int> get iterator => new _TypedListIterator<int>(this);
+ Iterator<int> get iterator => _TypedListIterator<int>(this);
List<int> toList({bool growable = true}) {
- return new List<int>.of(this, growable: growable);
+ return List<int>.of(this, growable: growable);
}
Set<int> toSet() {
- return new Set<int>.of(this);
+ return Set<int>.of(this);
}
void forEach(void f(int element)) {
@@ -346,10 +346,10 @@
return initialValue;
}
- Iterable<T> map<T>(T f(int element)) => new MappedIterable<int, T>(this, f);
+ Iterable<T> map<T>(T f(int element)) => MappedIterable<int, T>(this, f);
Iterable<T> expand<T>(Iterable<T> f(int element)) =>
- new ExpandIterable<int, T>(this, f);
+ ExpandIterable<int, T>(this, f);
bool every(bool f(int element)) {
var len = this.length;
@@ -413,19 +413,19 @@
}
void add(int value) {
- throw new UnsupportedError("Cannot add to a fixed-length list");
+ throw UnsupportedError("Cannot add to a fixed-length list");
}
void addAll(Iterable<int> value) {
- throw new UnsupportedError("Cannot add to a fixed-length list");
+ throw UnsupportedError("Cannot add to a fixed-length list");
}
void insert(int index, int value) {
- throw new UnsupportedError("Cannot insert into a fixed-length list");
+ throw UnsupportedError("Cannot insert into a fixed-length list");
}
void insertAll(int index, Iterable<int> values) {
- throw new UnsupportedError("Cannot insert into a fixed-length list");
+ throw UnsupportedError("Cannot insert into a fixed-length list");
}
void sort([int compare(int a, int b)?]) {
@@ -454,19 +454,19 @@
}
int removeLast() {
- throw new UnsupportedError("Cannot remove from a fixed-length list");
+ throw UnsupportedError("Cannot remove from a fixed-length list");
}
int removeAt(int index) {
- throw new UnsupportedError("Cannot remove from a fixed-length list");
+ throw UnsupportedError("Cannot remove from a fixed-length list");
}
void removeWhere(bool test(int element)) {
- throw new UnsupportedError("Cannot remove from a fixed-length list");
+ throw UnsupportedError("Cannot remove from a fixed-length list");
}
void retainWhere(bool test(int element)) {
- throw new UnsupportedError("Cannot remove from a fixed-length list");
+ throw UnsupportedError("Cannot remove from a fixed-length list");
}
int get first {
@@ -569,10 +569,10 @@
int get offsetInBytes;
_ByteBuffer get buffer;
- Iterable<T> whereType<T>() => new WhereTypeIterable<T>(this);
+ Iterable<T> whereType<T>() => WhereTypeIterable<T>(this);
Iterable<double> followedBy(Iterable<double> other) =>
- new FollowedByIterable<double>.firstEfficient(this, other);
+ FollowedByIterable<double>.firstEfficient(this, other);
List<R> cast<R>() => List.castFrom<double, R>(this);
void set first(double value) {
@@ -613,7 +613,7 @@
}
void shuffle([Random? random]) {
- random ??= new Random();
+ random ??= Random();
var i = this.length;
while (i > 1) {
int pos = random.nextInt(i);
@@ -625,35 +625,35 @@
}
Iterable<double> where(bool f(double element)) =>
- new WhereIterable<double>(this, f);
+ WhereIterable<double>(this, f);
- Iterable<double> take(int n) => new SubListIterable<double>(this, 0, n);
+ Iterable<double> take(int n) => SubListIterable<double>(this, 0, n);
Iterable<double> takeWhile(bool test(double element)) =>
- new TakeWhileIterable<double>(this, test);
+ TakeWhileIterable<double>(this, test);
- Iterable<double> skip(int n) => new SubListIterable<double>(this, n, null);
+ Iterable<double> skip(int n) => SubListIterable<double>(this, n, null);
Iterable<double> skipWhile(bool test(double element)) =>
- new SkipWhileIterable<double>(this, test);
+ SkipWhileIterable<double>(this, test);
- Iterable<double> get reversed => new ReversedListIterable<double>(this);
+ Iterable<double> get reversed => ReversedListIterable<double>(this);
- Map<int, double> asMap() => new ListMapView<double>(this);
+ Map<int, double> asMap() => ListMapView<double>(this);
Iterable<double> getRange(int start, [int? end]) {
int endIndex = RangeError.checkValidRange(start, end, this.length);
- return new SubListIterable<double>(this, start, endIndex);
+ return SubListIterable<double>(this, start, endIndex);
}
- Iterator<double> get iterator => new _TypedListIterator<double>(this);
+ Iterator<double> get iterator => _TypedListIterator<double>(this);
List<double> toList({bool growable = true}) {
- return new List<double>.of(this, growable: growable);
+ return List<double>.of(this, growable: growable);
}
Set<double> toSet() {
- return new Set<double>.of(this);
+ return Set<double>.of(this);
}
void forEach(void f(double element)) {
@@ -681,11 +681,10 @@
return initialValue;
}
- Iterable<T> map<T>(T f(double element)) =>
- new MappedIterable<double, T>(this, f);
+ Iterable<T> map<T>(T f(double element)) => MappedIterable<double, T>(this, f);
Iterable<T> expand<T>(Iterable<T> f(double element)) =>
- new ExpandIterable<double, T>(this, f);
+ ExpandIterable<double, T>(this, f);
bool every(bool f(double element)) {
var len = this.length;
@@ -749,19 +748,19 @@
}
void add(double value) {
- throw new UnsupportedError("Cannot add to a fixed-length list");
+ throw UnsupportedError("Cannot add to a fixed-length list");
}
void addAll(Iterable<double> value) {
- throw new UnsupportedError("Cannot add to a fixed-length list");
+ throw UnsupportedError("Cannot add to a fixed-length list");
}
void insert(int index, double value) {
- throw new UnsupportedError("Cannot insert into a fixed-length list");
+ throw UnsupportedError("Cannot insert into a fixed-length list");
}
void insertAll(int index, Iterable<double> values) {
- throw new UnsupportedError("Cannot insert into a fixed-length list");
+ throw UnsupportedError("Cannot insert into a fixed-length list");
}
void sort([int compare(double a, double b)?]) {
@@ -790,19 +789,19 @@
}
double removeLast() {
- throw new UnsupportedError("Cannot remove from a fixed-length list");
+ throw UnsupportedError("Cannot remove from a fixed-length list");
}
double removeAt(int index) {
- throw new UnsupportedError("Cannot remove from a fixed-length list");
+ throw UnsupportedError("Cannot remove from a fixed-length list");
}
void removeWhere(bool test(double element)) {
- throw new UnsupportedError("Cannot remove from a fixed-length list");
+ throw UnsupportedError("Cannot remove from a fixed-length list");
}
void retainWhere(bool test(double element)) {
- throw new UnsupportedError("Cannot remove from a fixed-length list");
+ throw UnsupportedError("Cannot remove from a fixed-length list");
}
double get first {
@@ -914,10 +913,10 @@
Float32x4List _createList(int length);
- Iterable<T> whereType<T>() => new WhereTypeIterable<T>(this);
+ Iterable<T> whereType<T>() => WhereTypeIterable<T>(this);
Iterable<Float32x4> followedBy(Iterable<Float32x4> other) =>
- new FollowedByIterable<Float32x4>.firstEfficient(this, other);
+ FollowedByIterable<Float32x4>.firstEfficient(this, other);
List<R> cast<R>() => List.castFrom<Float32x4, R>(this);
void set first(Float32x4 value) {
@@ -958,7 +957,7 @@
}
void shuffle([Random? random]) {
- random ??= new Random();
+ random ??= Random();
var i = this.length;
while (i > 1) {
int pos = random.nextInt(i);
@@ -1015,36 +1014,35 @@
}
Iterable<Float32x4> where(bool f(Float32x4 element)) =>
- new WhereIterable<Float32x4>(this, f);
+ WhereIterable<Float32x4>(this, f);
- Iterable<Float32x4> take(int n) => new SubListIterable<Float32x4>(this, 0, n);
+ Iterable<Float32x4> take(int n) => SubListIterable<Float32x4>(this, 0, n);
Iterable<Float32x4> takeWhile(bool test(Float32x4 element)) =>
- new TakeWhileIterable<Float32x4>(this, test);
+ TakeWhileIterable<Float32x4>(this, test);
- Iterable<Float32x4> skip(int n) =>
- new SubListIterable<Float32x4>(this, n, null);
+ Iterable<Float32x4> skip(int n) => SubListIterable<Float32x4>(this, n, null);
Iterable<Float32x4> skipWhile(bool test(Float32x4 element)) =>
- new SkipWhileIterable<Float32x4>(this, test);
+ SkipWhileIterable<Float32x4>(this, test);
- Iterable<Float32x4> get reversed => new ReversedListIterable<Float32x4>(this);
+ Iterable<Float32x4> get reversed => ReversedListIterable<Float32x4>(this);
- Map<int, Float32x4> asMap() => new ListMapView<Float32x4>(this);
+ Map<int, Float32x4> asMap() => ListMapView<Float32x4>(this);
Iterable<Float32x4> getRange(int start, [int? end]) {
int endIndex = RangeError.checkValidRange(start, end, this.length);
- return new SubListIterable<Float32x4>(this, start, endIndex);
+ return SubListIterable<Float32x4>(this, start, endIndex);
}
- Iterator<Float32x4> get iterator => new _TypedListIterator<Float32x4>(this);
+ Iterator<Float32x4> get iterator => _TypedListIterator<Float32x4>(this);
List<Float32x4> toList({bool growable = true}) {
- return new List<Float32x4>.of(this, growable: growable);
+ return List<Float32x4>.of(this, growable: growable);
}
Set<Float32x4> toSet() {
- return new Set<Float32x4>.of(this);
+ return Set<Float32x4>.of(this);
}
void forEach(void f(Float32x4 element)) {
@@ -1073,10 +1071,10 @@
}
Iterable<T> map<T>(T f(Float32x4 element)) =>
- new MappedIterable<Float32x4, T>(this, f);
+ MappedIterable<Float32x4, T>(this, f);
Iterable<T> expand<T>(Iterable<T> f(Float32x4 element)) =>
- new ExpandIterable<Float32x4, T>(this, f);
+ ExpandIterable<Float32x4, T>(this, f);
bool every(bool f(Float32x4 element)) {
var len = this.length;
@@ -1140,19 +1138,19 @@
}
void add(Float32x4 value) {
- throw new UnsupportedError("Cannot add to a fixed-length list");
+ throw UnsupportedError("Cannot add to a fixed-length list");
}
void addAll(Iterable<Float32x4> value) {
- throw new UnsupportedError("Cannot add to a fixed-length list");
+ throw UnsupportedError("Cannot add to a fixed-length list");
}
void insert(int index, Float32x4 value) {
- throw new UnsupportedError("Cannot insert into a fixed-length list");
+ throw UnsupportedError("Cannot insert into a fixed-length list");
}
void insertAll(int index, Iterable<Float32x4> values) {
- throw new UnsupportedError("Cannot insert into a fixed-length list");
+ throw UnsupportedError("Cannot insert into a fixed-length list");
}
void sort([int compare(Float32x4 a, Float32x4 b)?]) {
@@ -1184,19 +1182,19 @@
}
Float32x4 removeLast() {
- throw new UnsupportedError("Cannot remove from a fixed-length list");
+ throw UnsupportedError("Cannot remove from a fixed-length list");
}
Float32x4 removeAt(int index) {
- throw new UnsupportedError("Cannot remove from a fixed-length list");
+ throw UnsupportedError("Cannot remove from a fixed-length list");
}
void removeWhere(bool test(Float32x4 element)) {
- throw new UnsupportedError("Cannot remove from a fixed-length list");
+ throw UnsupportedError("Cannot remove from a fixed-length list");
}
void retainWhere(bool test(Float32x4 element)) {
- throw new UnsupportedError("Cannot remove from a fixed-length list");
+ throw UnsupportedError("Cannot remove from a fixed-length list");
}
Float32x4 get first {
@@ -1256,10 +1254,10 @@
Int32x4List _createList(int length);
- Iterable<T> whereType<T>() => new WhereTypeIterable<T>(this);
+ Iterable<T> whereType<T>() => WhereTypeIterable<T>(this);
Iterable<Int32x4> followedBy(Iterable<Int32x4> other) =>
- new FollowedByIterable<Int32x4>.firstEfficient(this, other);
+ FollowedByIterable<Int32x4>.firstEfficient(this, other);
List<R> cast<R>() => List.castFrom<Int32x4, R>(this);
void set first(Int32x4 value) {
@@ -1300,7 +1298,7 @@
}
void shuffle([Random? random]) {
- random ??= new Random();
+ random ??= Random();
var i = this.length;
while (i > 1) {
int pos = random.nextInt(i);
@@ -1357,35 +1355,35 @@
}
Iterable<Int32x4> where(bool f(Int32x4 element)) =>
- new WhereIterable<Int32x4>(this, f);
+ WhereIterable<Int32x4>(this, f);
- Iterable<Int32x4> take(int n) => new SubListIterable<Int32x4>(this, 0, n);
+ Iterable<Int32x4> take(int n) => SubListIterable<Int32x4>(this, 0, n);
Iterable<Int32x4> takeWhile(bool test(Int32x4 element)) =>
- new TakeWhileIterable<Int32x4>(this, test);
+ TakeWhileIterable<Int32x4>(this, test);
- Iterable<Int32x4> skip(int n) => new SubListIterable<Int32x4>(this, n, null);
+ Iterable<Int32x4> skip(int n) => SubListIterable<Int32x4>(this, n, null);
Iterable<Int32x4> skipWhile(bool test(Int32x4 element)) =>
- new SkipWhileIterable<Int32x4>(this, test);
+ SkipWhileIterable<Int32x4>(this, test);
- Iterable<Int32x4> get reversed => new ReversedListIterable<Int32x4>(this);
+ Iterable<Int32x4> get reversed => ReversedListIterable<Int32x4>(this);
- Map<int, Int32x4> asMap() => new ListMapView<Int32x4>(this);
+ Map<int, Int32x4> asMap() => ListMapView<Int32x4>(this);
Iterable<Int32x4> getRange(int start, [int? end]) {
int endIndex = RangeError.checkValidRange(start, end, this.length);
- return new SubListIterable<Int32x4>(this, start, endIndex);
+ return SubListIterable<Int32x4>(this, start, endIndex);
}
- Iterator<Int32x4> get iterator => new _TypedListIterator<Int32x4>(this);
+ Iterator<Int32x4> get iterator => _TypedListIterator<Int32x4>(this);
List<Int32x4> toList({bool growable = true}) {
- return new List<Int32x4>.of(this, growable: growable);
+ return List<Int32x4>.of(this, growable: growable);
}
Set<Int32x4> toSet() {
- return new Set<Int32x4>.of(this);
+ return Set<Int32x4>.of(this);
}
void forEach(void f(Int32x4 element)) {
@@ -1414,10 +1412,10 @@
}
Iterable<T> map<T>(T f(Int32x4 element)) =>
- new MappedIterable<Int32x4, T>(this, f);
+ MappedIterable<Int32x4, T>(this, f);
Iterable<T> expand<T>(Iterable<T> f(Int32x4 element)) =>
- new ExpandIterable<Int32x4, T>(this, f);
+ ExpandIterable<Int32x4, T>(this, f);
bool every(bool f(Int32x4 element)) {
var len = this.length;
@@ -1481,19 +1479,19 @@
}
void add(Int32x4 value) {
- throw new UnsupportedError("Cannot add to a fixed-length list");
+ throw UnsupportedError("Cannot add to a fixed-length list");
}
void addAll(Iterable<Int32x4> value) {
- throw new UnsupportedError("Cannot add to a fixed-length list");
+ throw UnsupportedError("Cannot add to a fixed-length list");
}
void insert(int index, Int32x4 value) {
- throw new UnsupportedError("Cannot insert into a fixed-length list");
+ throw UnsupportedError("Cannot insert into a fixed-length list");
}
void insertAll(int index, Iterable<Int32x4> values) {
- throw new UnsupportedError("Cannot insert into a fixed-length list");
+ throw UnsupportedError("Cannot insert into a fixed-length list");
}
void sort([int compare(Int32x4 a, Int32x4 b)?]) {
@@ -1525,19 +1523,19 @@
}
Int32x4 removeLast() {
- throw new UnsupportedError("Cannot remove from a fixed-length list");
+ throw UnsupportedError("Cannot remove from a fixed-length list");
}
Int32x4 removeAt(int index) {
- throw new UnsupportedError("Cannot remove from a fixed-length list");
+ throw UnsupportedError("Cannot remove from a fixed-length list");
}
void removeWhere(bool test(Int32x4 element)) {
- throw new UnsupportedError("Cannot remove from a fixed-length list");
+ throw UnsupportedError("Cannot remove from a fixed-length list");
}
void retainWhere(bool test(Int32x4 element)) {
- throw new UnsupportedError("Cannot remove from a fixed-length list");
+ throw UnsupportedError("Cannot remove from a fixed-length list");
}
Int32x4 get first {
@@ -1597,10 +1595,10 @@
Float64x2List _createList(int length);
- Iterable<T> whereType<T>() => new WhereTypeIterable<T>(this);
+ Iterable<T> whereType<T>() => WhereTypeIterable<T>(this);
Iterable<Float64x2> followedBy(Iterable<Float64x2> other) =>
- new FollowedByIterable<Float64x2>.firstEfficient(this, other);
+ FollowedByIterable<Float64x2>.firstEfficient(this, other);
List<R> cast<R>() => List.castFrom<Float64x2, R>(this);
void set first(Float64x2 value) {
@@ -1641,7 +1639,7 @@
}
void shuffle([Random? random]) {
- random ??= new Random();
+ random ??= Random();
var i = this.length;
while (i > 1) {
int pos = random.nextInt(i);
@@ -1698,36 +1696,35 @@
}
Iterable<Float64x2> where(bool f(Float64x2 element)) =>
- new WhereIterable<Float64x2>(this, f);
+ WhereIterable<Float64x2>(this, f);
- Iterable<Float64x2> take(int n) => new SubListIterable<Float64x2>(this, 0, n);
+ Iterable<Float64x2> take(int n) => SubListIterable<Float64x2>(this, 0, n);
Iterable<Float64x2> takeWhile(bool test(Float64x2 element)) =>
- new TakeWhileIterable<Float64x2>(this, test);
+ TakeWhileIterable<Float64x2>(this, test);
- Iterable<Float64x2> skip(int n) =>
- new SubListIterable<Float64x2>(this, n, null);
+ Iterable<Float64x2> skip(int n) => SubListIterable<Float64x2>(this, n, null);
Iterable<Float64x2> skipWhile(bool test(Float64x2 element)) =>
- new SkipWhileIterable<Float64x2>(this, test);
+ SkipWhileIterable<Float64x2>(this, test);
- Iterable<Float64x2> get reversed => new ReversedListIterable<Float64x2>(this);
+ Iterable<Float64x2> get reversed => ReversedListIterable<Float64x2>(this);
- Map<int, Float64x2> asMap() => new ListMapView<Float64x2>(this);
+ Map<int, Float64x2> asMap() => ListMapView<Float64x2>(this);
Iterable<Float64x2> getRange(int start, [int? end]) {
int endIndex = RangeError.checkValidRange(start, end, this.length);
- return new SubListIterable<Float64x2>(this, start, endIndex);
+ return SubListIterable<Float64x2>(this, start, endIndex);
}
- Iterator<Float64x2> get iterator => new _TypedListIterator<Float64x2>(this);
+ Iterator<Float64x2> get iterator => _TypedListIterator<Float64x2>(this);
List<Float64x2> toList({bool growable = true}) {
- return new List<Float64x2>.of(this, growable: growable);
+ return List<Float64x2>.of(this, growable: growable);
}
Set<Float64x2> toSet() {
- return new Set<Float64x2>.of(this);
+ return Set<Float64x2>.of(this);
}
void forEach(void f(Float64x2 element)) {
@@ -1756,10 +1753,10 @@
}
Iterable<T> map<T>(T f(Float64x2 element)) =>
- new MappedIterable<Float64x2, T>(this, f);
+ MappedIterable<Float64x2, T>(this, f);
Iterable<T> expand<T>(Iterable<T> f(Float64x2 element)) =>
- new ExpandIterable<Float64x2, T>(this, f);
+ ExpandIterable<Float64x2, T>(this, f);
bool every(bool f(Float64x2 element)) {
var len = this.length;
@@ -1823,19 +1820,19 @@
}
void add(Float64x2 value) {
- throw new UnsupportedError("Cannot add to a fixed-length list");
+ throw UnsupportedError("Cannot add to a fixed-length list");
}
void addAll(Iterable<Float64x2> value) {
- throw new UnsupportedError("Cannot add to a fixed-length list");
+ throw UnsupportedError("Cannot add to a fixed-length list");
}
void insert(int index, Float64x2 value) {
- throw new UnsupportedError("Cannot insert into a fixed-length list");
+ throw UnsupportedError("Cannot insert into a fixed-length list");
}
void insertAll(int index, Iterable<Float64x2> values) {
- throw new UnsupportedError("Cannot insert into a fixed-length list");
+ throw UnsupportedError("Cannot insert into a fixed-length list");
}
void sort([int compare(Float64x2 a, Float64x2 b)?]) {
@@ -1867,19 +1864,19 @@
}
Float64x2 removeLast() {
- throw new UnsupportedError("Cannot remove from a fixed-length list");
+ throw UnsupportedError("Cannot remove from a fixed-length list");
}
Float64x2 removeAt(int index) {
- throw new UnsupportedError("Cannot remove from a fixed-length list");
+ throw UnsupportedError("Cannot remove from a fixed-length list");
}
void removeWhere(bool test(Float64x2 element)) {
- throw new UnsupportedError("Cannot remove from a fixed-length list");
+ throw UnsupportedError("Cannot remove from a fixed-length list");
}
void retainWhere(bool test(Float64x2 element)) {
- throw new UnsupportedError("Cannot remove from a fixed-length list");
+ throw UnsupportedError("Cannot remove from a fixed-length list");
}
Float64x2 get first {
@@ -1938,7 +1935,7 @@
_ByteBuffer(this._data);
@pragma("vm:entry-point")
- factory _ByteBuffer._New(data) => new _ByteBuffer(data);
+ factory _ByteBuffer._New(data) => _ByteBuffer(data);
// Forward calls to _data.
int get lengthInBytes => _data.lengthInBytes;
@@ -1949,7 +1946,7 @@
ByteData asByteData([int offsetInBytes = 0, int? length]) {
length ??= this.lengthInBytes - offsetInBytes;
_rangeCheck(this._data.lengthInBytes, offsetInBytes, length);
- return new _ByteDataView._(this._data, offsetInBytes, length);
+ return _ByteDataView._(this._data, offsetInBytes, length);
}
Int8List asInt8List([int offsetInBytes = 0, int? length]) {
@@ -1959,7 +1956,7 @@
offsetInBytes,
length * Int8List.bytesPerElement,
);
- return new _Int8ArrayView._(this._data, offsetInBytes, length);
+ return _Int8ArrayView._(this._data, offsetInBytes, length);
}
Uint8List asUint8List([int offsetInBytes = 0, int? length]) {
@@ -1970,7 +1967,7 @@
offsetInBytes,
length * Uint8List.bytesPerElement,
);
- return new _Uint8ArrayView._(this._data, offsetInBytes, length);
+ return _Uint8ArrayView._(this._data, offsetInBytes, length);
}
Uint8ClampedList asUint8ClampedList([int offsetInBytes = 0, int? length]) {
@@ -1982,7 +1979,7 @@
offsetInBytes,
length * Uint8ClampedList.bytesPerElement,
);
- return new _Uint8ClampedArrayView._(this._data, offsetInBytes, length);
+ return _Uint8ClampedArrayView._(this._data, offsetInBytes, length);
}
Int16List asInt16List([int offsetInBytes = 0, int? length]) {
@@ -1994,7 +1991,7 @@
length * Int16List.bytesPerElement,
);
_offsetAlignmentCheck(offsetInBytes, Int16List.bytesPerElement);
- return new _Int16ArrayView._(this._data, offsetInBytes, length);
+ return _Int16ArrayView._(this._data, offsetInBytes, length);
}
Uint16List asUint16List([int offsetInBytes = 0, int? length]) {
@@ -2006,7 +2003,7 @@
length * Uint16List.bytesPerElement,
);
_offsetAlignmentCheck(offsetInBytes, Uint16List.bytesPerElement);
- return new _Uint16ArrayView._(this._data, offsetInBytes, length);
+ return _Uint16ArrayView._(this._data, offsetInBytes, length);
}
Int32List asInt32List([int offsetInBytes = 0, int? length]) {
@@ -2018,7 +2015,7 @@
length * Int32List.bytesPerElement,
);
_offsetAlignmentCheck(offsetInBytes, Int32List.bytesPerElement);
- return new _Int32ArrayView._(this._data, offsetInBytes, length);
+ return _Int32ArrayView._(this._data, offsetInBytes, length);
}
Uint32List asUint32List([int offsetInBytes = 0, int? length]) {
@@ -2030,7 +2027,7 @@
length * Uint32List.bytesPerElement,
);
_offsetAlignmentCheck(offsetInBytes, Uint32List.bytesPerElement);
- return new _Uint32ArrayView._(this._data, offsetInBytes, length);
+ return _Uint32ArrayView._(this._data, offsetInBytes, length);
}
Int64List asInt64List([int offsetInBytes = 0, int? length]) {
@@ -2042,7 +2039,7 @@
length * Int64List.bytesPerElement,
);
_offsetAlignmentCheck(offsetInBytes, Int64List.bytesPerElement);
- return new _Int64ArrayView._(this._data, offsetInBytes, length);
+ return _Int64ArrayView._(this._data, offsetInBytes, length);
}
Uint64List asUint64List([int offsetInBytes = 0, int? length]) {
@@ -2054,7 +2051,7 @@
length * Uint64List.bytesPerElement,
);
_offsetAlignmentCheck(offsetInBytes, Uint64List.bytesPerElement);
- return new _Uint64ArrayView._(this._data, offsetInBytes, length);
+ return _Uint64ArrayView._(this._data, offsetInBytes, length);
}
Float32List asFloat32List([int offsetInBytes = 0, int? length]) {
@@ -2066,7 +2063,7 @@
length * Float32List.bytesPerElement,
);
_offsetAlignmentCheck(offsetInBytes, Float32List.bytesPerElement);
- return new _Float32ArrayView._(this._data, offsetInBytes, length);
+ return _Float32ArrayView._(this._data, offsetInBytes, length);
}
Float64List asFloat64List([int offsetInBytes = 0, int? length]) {
@@ -2078,7 +2075,7 @@
length * Float64List.bytesPerElement,
);
_offsetAlignmentCheck(offsetInBytes, Float64List.bytesPerElement);
- return new _Float64ArrayView._(this._data, offsetInBytes, length);
+ return _Float64ArrayView._(this._data, offsetInBytes, length);
}
Float32x4List asFloat32x4List([int offsetInBytes = 0, int? length]) {
@@ -2090,7 +2087,7 @@
length * Float32x4List.bytesPerElement,
);
_offsetAlignmentCheck(offsetInBytes, Float32x4List.bytesPerElement);
- return new _Float32x4ArrayView._(this._data, offsetInBytes, length);
+ return _Float32x4ArrayView._(this._data, offsetInBytes, length);
}
Int32x4List asInt32x4List([int offsetInBytes = 0, int? length]) {
@@ -2102,7 +2099,7 @@
length * Int32x4List.bytesPerElement,
);
_offsetAlignmentCheck(offsetInBytes, Int32x4List.bytesPerElement);
- return new _Int32x4ArrayView._(this._data, offsetInBytes, length);
+ return _Int32x4ArrayView._(this._data, offsetInBytes, length);
}
Float64x2List asFloat64x2List([int offsetInBytes = 0, int? length]) {
@@ -2114,7 +2111,7 @@
length * Float64x2List.bytesPerElement,
);
_offsetAlignmentCheck(offsetInBytes, Float64x2List.bytesPerElement);
- return new _Float64x2ArrayView._(this._data, offsetInBytes, length);
+ return _Float64x2ArrayView._(this._data, offsetInBytes, length);
}
}
@@ -2130,7 +2127,7 @@
return length * elementSizeInBytes;
}
- _ByteBuffer get buffer => new _ByteBuffer(this);
+ _ByteBuffer get buffer => _ByteBuffer(this);
// Internal utility methods.
@@ -2344,8 +2341,7 @@
@patch
factory Int8List.fromList(List<int> elements) {
- return new Int8List(elements.length)
- ..setRange(0, elements.length, elements);
+ return Int8List(elements.length)..setRange(0, elements.length, elements);
}
}
@@ -2380,7 +2376,7 @@
// Internal utility methods.
Int8List _createList(int length) {
- return new Int8List(length);
+ return Int8List(length);
}
@pragma("vm:prefer-inline")
@@ -2402,8 +2398,7 @@
@patch
factory Uint8List.fromList(List<int> elements) {
- return new Uint8List(elements.length)
- ..setRange(0, elements.length, elements);
+ return Uint8List(elements.length)..setRange(0, elements.length, elements);
}
}
@@ -2438,7 +2433,7 @@
// Internal utility methods.
Uint8List _createList(int length) {
- return new Uint8List(length);
+ return Uint8List(length);
}
@pragma("vm:prefer-inline")
@@ -2463,7 +2458,7 @@
@patch
factory Uint8ClampedList.fromList(List<int> elements) {
- return new Uint8ClampedList(elements.length)
+ return Uint8ClampedList(elements.length)
..setRange(0, elements.length, elements);
}
}
@@ -2500,7 +2495,7 @@
// Internal utility methods.
Uint8ClampedList _createList(int length) {
- return new Uint8ClampedList(length);
+ return Uint8ClampedList(length);
}
@pragma("vm:prefer-inline")
@@ -2528,8 +2523,7 @@
@patch
factory Int16List.fromList(List<int> elements) {
- return new Int16List(elements.length)
- ..setRange(0, elements.length, elements);
+ return Int16List(elements.length)..setRange(0, elements.length, elements);
}
}
@@ -2577,7 +2571,7 @@
// Internal utility methods.
Int16List _createList(int length) {
- return new Int16List(length);
+ return Int16List(length);
}
@pragma("vm:prefer-inline")
@@ -2599,8 +2593,7 @@
@patch
factory Uint16List.fromList(List<int> elements) {
- return new Uint16List(elements.length)
- ..setRange(0, elements.length, elements);
+ return Uint16List(elements.length)..setRange(0, elements.length, elements);
}
}
@@ -2648,7 +2641,7 @@
// Internal utility methods.
Uint16List _createList(int length) {
- return new Uint16List(length);
+ return Uint16List(length);
}
@pragma("vm:prefer-inline")
@@ -2670,8 +2663,7 @@
@patch
factory Int32List.fromList(List<int> elements) {
- return new Int32List(elements.length)
- ..setRange(0, elements.length, elements);
+ return Int32List(elements.length)..setRange(0, elements.length, elements);
}
}
@@ -2705,7 +2697,7 @@
// Internal utility methods.
Int32List _createList(int length) {
- return new Int32List(length);
+ return Int32List(length);
}
@pragma("vm:prefer-inline")
@@ -2727,8 +2719,7 @@
@patch
factory Uint32List.fromList(List<int> elements) {
- return new Uint32List(elements.length)
- ..setRange(0, elements.length, elements);
+ return Uint32List(elements.length)..setRange(0, elements.length, elements);
}
}
@@ -2762,7 +2753,7 @@
// Internal utility methods.
Uint32List _createList(int length) {
- return new Uint32List(length);
+ return Uint32List(length);
}
@pragma("vm:prefer-inline")
@@ -2784,8 +2775,7 @@
@patch
factory Int64List.fromList(List<int> elements) {
- return new Int64List(elements.length)
- ..setRange(0, elements.length, elements);
+ return Int64List(elements.length)..setRange(0, elements.length, elements);
}
}
@@ -2819,7 +2809,7 @@
// Internal utility methods.
Int64List _createList(int length) {
- return new Int64List(length);
+ return Int64List(length);
}
@pragma("vm:prefer-inline")
@@ -2841,8 +2831,7 @@
@patch
factory Uint64List.fromList(List<int> elements) {
- return new Uint64List(elements.length)
- ..setRange(0, elements.length, elements);
+ return Uint64List(elements.length)..setRange(0, elements.length, elements);
}
}
@@ -2876,7 +2865,7 @@
// Internal utility methods.
Uint64List _createList(int length) {
- return new Uint64List(length);
+ return Uint64List(length);
}
@pragma("vm:prefer-inline")
@@ -2898,8 +2887,7 @@
@patch
factory Float32List.fromList(List<double> elements) {
- return new Float32List(elements.length)
- ..setRange(0, elements.length, elements);
+ return Float32List(elements.length)..setRange(0, elements.length, elements);
}
}
@@ -2934,7 +2922,7 @@
// Internal utility methods.
Float32List _createList(int length) {
- return new Float32List(length);
+ return Float32List(length);
}
@pragma("vm:prefer-inline")
@@ -2956,8 +2944,7 @@
@patch
factory Float64List.fromList(List<double> elements) {
- return new Float64List(elements.length)
- ..setRange(0, elements.length, elements);
+ return Float64List(elements.length)..setRange(0, elements.length, elements);
}
}
@@ -2992,7 +2979,7 @@
// Internal utility methods.
Float64List _createList(int length) {
- return new Float64List(length);
+ return Float64List(length);
}
@pragma("vm:prefer-inline")
@@ -3014,7 +3001,7 @@
@patch
factory Float32x4List.fromList(List<Float32x4> elements) {
- return new Float32x4List(elements.length)
+ return Float32x4List(elements.length)
..setRange(0, elements.length, elements);
}
}
@@ -3049,7 +3036,7 @@
// Internal utility methods.
Float32x4List _createList(int length) {
- return new Float32x4List(length);
+ return Float32x4List(length);
}
@pragma("vm:prefer-inline")
@@ -3071,8 +3058,7 @@
@patch
factory Int32x4List.fromList(List<Int32x4> elements) {
- return new Int32x4List(elements.length)
- ..setRange(0, elements.length, elements);
+ return Int32x4List(elements.length)..setRange(0, elements.length, elements);
}
}
@@ -3106,7 +3092,7 @@
// Internal utility methods.
Int32x4List _createList(int length) {
- return new Int32x4List(length);
+ return Int32x4List(length);
}
@pragma("vm:prefer-inline")
@@ -3128,7 +3114,7 @@
@patch
factory Float64x2List.fromList(List<Float64x2> elements) {
- return new Float64x2List(elements.length)
+ return Float64x2List(elements.length)
..setRange(0, elements.length, elements);
}
}
@@ -3163,7 +3149,7 @@
// Internal utility methods.
Float64x2List _createList(int length) {
- return new Float64x2List(length);
+ return Float64x2List(length);
}
@pragma("vm:prefer-inline")
@@ -3205,7 +3191,7 @@
// Internal utility methods.
Int8List _createList(int length) {
- return new Int8List(length);
+ return Int8List(length);
}
@pragma("vm:prefer-inline")
@@ -3248,7 +3234,7 @@
// Internal utility methods.
Uint8List _createList(int length) {
- return new Uint8List(length);
+ return Uint8List(length);
}
@pragma("vm:prefer-inline")
@@ -3295,7 +3281,7 @@
// Internal utility methods.
Uint8ClampedList _createList(int length) {
- return new Uint8ClampedList(length);
+ return Uint8ClampedList(length);
}
@pragma("vm:prefer-inline")
@@ -3343,7 +3329,7 @@
// Internal utility methods.
Int16List _createList(int length) {
- return new Int16List(length);
+ return Int16List(length);
}
@pragma("vm:prefer-inline")
@@ -3385,7 +3371,7 @@
// Internal utility methods.
Uint16List _createList(int length) {
- return new Uint16List(length);
+ return Uint16List(length);
}
@pragma("vm:prefer-inline")
@@ -3426,7 +3412,7 @@
// Internal utility methods.
Int32List _createList(int length) {
- return new Int32List(length);
+ return Int32List(length);
}
@pragma("vm:prefer-inline")
@@ -3467,7 +3453,7 @@
// Internal utility methods.
Uint32List _createList(int length) {
- return new Uint32List(length);
+ return Uint32List(length);
}
@pragma("vm:prefer-inline")
@@ -3508,7 +3494,7 @@
// Internal utility methods.
Int64List _createList(int length) {
- return new Int64List(length);
+ return Int64List(length);
}
@pragma("vm:prefer-inline")
@@ -3549,7 +3535,7 @@
// Internal utility methods.
Uint64List _createList(int length) {
- return new Uint64List(length);
+ return Uint64List(length);
}
@pragma("vm:prefer-inline")
@@ -3591,7 +3577,7 @@
// Internal utility methods.
Float32List _createList(int length) {
- return new Float32List(length);
+ return Float32List(length);
}
@pragma("vm:prefer-inline")
@@ -3633,7 +3619,7 @@
// Internal utility methods.
Float64List _createList(int length) {
- return new Float64List(length);
+ return Float64List(length);
}
@pragma("vm:prefer-inline")
@@ -3675,7 +3661,7 @@
// Internal utility methods.
Float32x4List _createList(int length) {
- return new Float32x4List(length);
+ return Float32x4List(length);
}
@pragma("vm:prefer-inline")
@@ -3717,7 +3703,7 @@
// Internal utility methods.
Int32x4List _createList(int length) {
- return new Int32x4List(length);
+ return Int32x4List(length);
}
@pragma("vm:prefer-inline")
@@ -3759,7 +3745,7 @@
// Internal utility methods.
Float64x2List _createList(int length) {
- return new Float64x2List(length);
+ return Float64x2List(length);
}
@pragma("vm:prefer-inline")
@@ -4339,7 +4325,7 @@
// Internal utility methods.
Int8List _createList(int length) {
- return new Int8List(length);
+ return Int8List(length);
}
@pragma("vm:prefer-inline")
@@ -4392,7 +4378,7 @@
// Internal utility methods.
Uint8List _createList(int length) {
- return new Uint8List(length);
+ return Uint8List(length);
}
@pragma("vm:prefer-inline")
@@ -4449,7 +4435,7 @@
// Internal utility methods.
Uint8ClampedList _createList(int length) {
- return new Uint8ClampedList(length);
+ return Uint8ClampedList(length);
}
@pragma("vm:prefer-inline")
@@ -4522,7 +4508,7 @@
// Internal utility methods.
Int16List _createList(int length) {
- return new Int16List(length);
+ return Int16List(length);
}
@pragma("vm:prefer-inline")
@@ -4589,7 +4575,7 @@
// Internal utility methods.
Uint16List _createList(int length) {
- return new Uint16List(length);
+ return Uint16List(length);
}
@pragma("vm:prefer-inline")
@@ -4641,7 +4627,7 @@
// Internal utility methods.
Int32List _createList(int length) {
- return new Int32List(length);
+ return Int32List(length);
}
@pragma("vm:prefer-inline")
@@ -4693,7 +4679,7 @@
// Internal utility methods.
Uint32List _createList(int length) {
- return new Uint32List(length);
+ return Uint32List(length);
}
@pragma("vm:prefer-inline")
@@ -4745,7 +4731,7 @@
// Internal utility methods.
Int64List _createList(int length) {
- return new Int64List(length);
+ return Int64List(length);
}
@pragma("vm:prefer-inline")
@@ -4797,7 +4783,7 @@
// Internal utility methods.
Uint64List _createList(int length) {
- return new Uint64List(length);
+ return Uint64List(length);
}
@pragma("vm:prefer-inline")
@@ -4850,7 +4836,7 @@
// Internal utility methods.
Float32List _createList(int length) {
- return new Float32List(length);
+ return Float32List(length);
}
@pragma("vm:prefer-inline")
@@ -4903,7 +4889,7 @@
// Internal utility methods.
Float64List _createList(int length) {
- return new Float64List(length);
+ return Float64List(length);
}
@pragma("vm:prefer-inline")
@@ -4955,7 +4941,7 @@
// Internal utility methods.
Float32x4List _createList(int length) {
- return new Float32x4List(length);
+ return Float32x4List(length);
}
@pragma("vm:prefer-inline")
@@ -5007,7 +4993,7 @@
// Internal utility methods.
Int32x4List _createList(int length) {
- return new Int32x4List(length);
+ return Int32x4List(length);
}
@pragma("vm:prefer-inline")
@@ -5059,7 +5045,7 @@
// Internal utility methods.
Float64x2List _createList(int length) {
- return new Float64x2List(length);
+ return Float64x2List(length);
}
@pragma("vm:prefer-inline")
@@ -5390,10 +5376,10 @@
return (_byteSwap32(value) << 32) | _byteSwap32(value >> 32);
}
-final _convU32 = new Uint32List(2);
-final _convU64 = new Uint64List.view(_convU32.buffer);
-final _convF32 = new Float32List.view(_convU32.buffer);
-final _convF64 = new Float64List.view(_convU32.buffer);
+final _convU32 = Uint32List(2);
+final _convU64 = Uint64List.view(_convU32.buffer);
+final _convF32 = Float32List.view(_convU32.buffer);
+final _convF64 = Float64List.view(_convU32.buffer);
// Top level utility methods.
@pragma("vm:exact-result-type", "dart:core#_Smi")
@@ -5408,7 +5394,7 @@
@pragma("vm:prefer-inline")
int _typedDataIndexCheck(Object indexable, int index, int length) {
if (index < 0 || index >= length) {
- throw new IndexError.withLength(
+ throw IndexError.withLength(
index,
length,
indexable: indexable,
@@ -5423,7 +5409,7 @@
@pragma("vm:prefer-inline")
int _byteDataByteOffsetCheck(ByteData indexable, int byteOffset, int length) {
if (byteOffset < 0 || byteOffset >= length) {
- throw new IndexError.withLength(
+ throw IndexError.withLength(
byteOffset,
length,
indexable: indexable,
@@ -5438,19 +5424,19 @@
// otherwise).
void _rangeCheck(int listLength, int start, int length) {
if (length < 0) {
- throw new RangeError.value(length);
+ throw RangeError.value(length);
}
if (start < 0) {
- throw new RangeError.value(start);
+ throw RangeError.value(start);
}
if (start + length > listLength) {
- throw new RangeError.value(start + length);
+ throw RangeError.value(start + length);
}
}
void _offsetAlignmentCheck(int offset, int alignment) {
if ((offset % alignment) != 0) {
- throw new RangeError(
+ throw RangeError(
'Offset ($offset) must be a multiple of '
'BYTES_PER_ELEMENT ($alignment)',
);
@@ -5471,17 +5457,17 @@
@pragma("vm:prefer-inline")
factory _UnmodifiableInt8ArrayView(Int8List list) =>
- new _UnmodifiableInt8ArrayView._(
+ _UnmodifiableInt8ArrayView._(
unsafeCast<_TypedListBase>(list)._typedData,
list.offsetInBytes,
list.length,
);
void operator []=(int index, int value) {
- throw new UnsupportedError("Cannot modify an unmodifiable list");
+ throw UnsupportedError("Cannot modify an unmodifiable list");
}
- _ByteBuffer get buffer => new _UnmodifiableByteBufferView(_typedData.buffer);
+ _ByteBuffer get buffer => _UnmodifiableByteBufferView(_typedData.buffer);
Int8List asUnmodifiableView() => this;
}
@@ -5500,17 +5486,17 @@
@pragma("vm:prefer-inline")
factory _UnmodifiableUint8ArrayView(Uint8List list) =>
- new _UnmodifiableUint8ArrayView._(
+ _UnmodifiableUint8ArrayView._(
unsafeCast<_TypedListBase>(list)._typedData,
list.offsetInBytes,
list.length,
);
void operator []=(int index, int value) {
- throw new UnsupportedError("Cannot modify an unmodifiable list");
+ throw UnsupportedError("Cannot modify an unmodifiable list");
}
- _ByteBuffer get buffer => new _UnmodifiableByteBufferView(_typedData.buffer);
+ _ByteBuffer get buffer => _UnmodifiableByteBufferView(_typedData.buffer);
Uint8List asUnmodifiableView() => this;
}
@@ -5529,17 +5515,17 @@
@pragma("vm:prefer-inline")
factory _UnmodifiableUint8ClampedArrayView(Uint8ClampedList list) =>
- new _UnmodifiableUint8ClampedArrayView._(
+ _UnmodifiableUint8ClampedArrayView._(
unsafeCast<_TypedListBase>(list)._typedData,
list.offsetInBytes,
list.length,
);
void operator []=(int index, int value) {
- throw new UnsupportedError("Cannot modify an unmodifiable list");
+ throw UnsupportedError("Cannot modify an unmodifiable list");
}
- _ByteBuffer get buffer => new _UnmodifiableByteBufferView(_typedData.buffer);
+ _ByteBuffer get buffer => _UnmodifiableByteBufferView(_typedData.buffer);
Uint8ClampedList asUnmodifiableView() => this;
}
@@ -5558,17 +5544,17 @@
@pragma("vm:prefer-inline")
factory _UnmodifiableInt16ArrayView(Int16List list) =>
- new _UnmodifiableInt16ArrayView._(
+ _UnmodifiableInt16ArrayView._(
unsafeCast<_TypedListBase>(list)._typedData,
list.offsetInBytes,
list.length,
);
void operator []=(int index, int value) {
- throw new UnsupportedError("Cannot modify an unmodifiable list");
+ throw UnsupportedError("Cannot modify an unmodifiable list");
}
- _ByteBuffer get buffer => new _UnmodifiableByteBufferView(_typedData.buffer);
+ _ByteBuffer get buffer => _UnmodifiableByteBufferView(_typedData.buffer);
Int16List asUnmodifiableView() => this;
}
@@ -5587,17 +5573,17 @@
@pragma("vm:prefer-inline")
factory _UnmodifiableUint16ArrayView(Uint16List list) =>
- new _UnmodifiableUint16ArrayView._(
+ _UnmodifiableUint16ArrayView._(
unsafeCast<_TypedListBase>(list)._typedData,
list.offsetInBytes,
list.length,
);
void operator []=(int index, int value) {
- throw new UnsupportedError("Cannot modify an unmodifiable list");
+ throw UnsupportedError("Cannot modify an unmodifiable list");
}
- _ByteBuffer get buffer => new _UnmodifiableByteBufferView(_typedData.buffer);
+ _ByteBuffer get buffer => _UnmodifiableByteBufferView(_typedData.buffer);
Uint16List asUnmodifiableView() => this;
}
@@ -5616,17 +5602,17 @@
@pragma("vm:prefer-inline")
factory _UnmodifiableInt32ArrayView(Int32List list) =>
- new _UnmodifiableInt32ArrayView._(
+ _UnmodifiableInt32ArrayView._(
unsafeCast<_TypedListBase>(list)._typedData,
list.offsetInBytes,
list.length,
);
void operator []=(int index, int value) {
- throw new UnsupportedError("Cannot modify an unmodifiable list");
+ throw UnsupportedError("Cannot modify an unmodifiable list");
}
- _ByteBuffer get buffer => new _UnmodifiableByteBufferView(_typedData.buffer);
+ _ByteBuffer get buffer => _UnmodifiableByteBufferView(_typedData.buffer);
Int32List asUnmodifiableView() => this;
}
@@ -5645,17 +5631,17 @@
@pragma("vm:prefer-inline")
factory _UnmodifiableUint32ArrayView(Uint32List list) =>
- new _UnmodifiableUint32ArrayView._(
+ _UnmodifiableUint32ArrayView._(
unsafeCast<_TypedListBase>(list)._typedData,
list.offsetInBytes,
list.length,
);
void operator []=(int index, int value) {
- throw new UnsupportedError("Cannot modify an unmodifiable list");
+ throw UnsupportedError("Cannot modify an unmodifiable list");
}
- _ByteBuffer get buffer => new _UnmodifiableByteBufferView(_typedData.buffer);
+ _ByteBuffer get buffer => _UnmodifiableByteBufferView(_typedData.buffer);
Uint32List asUnmodifiableView() => this;
}
@@ -5674,17 +5660,17 @@
@pragma("vm:prefer-inline")
factory _UnmodifiableInt64ArrayView(Int64List list) =>
- new _UnmodifiableInt64ArrayView._(
+ _UnmodifiableInt64ArrayView._(
unsafeCast<_TypedListBase>(list)._typedData,
list.offsetInBytes,
list.length,
);
void operator []=(int index, int value) {
- throw new UnsupportedError("Cannot modify an unmodifiable list");
+ throw UnsupportedError("Cannot modify an unmodifiable list");
}
- _ByteBuffer get buffer => new _UnmodifiableByteBufferView(_typedData.buffer);
+ _ByteBuffer get buffer => _UnmodifiableByteBufferView(_typedData.buffer);
Int64List asUnmodifiableView() => this;
}
@@ -5703,17 +5689,17 @@
@pragma("vm:prefer-inline")
factory _UnmodifiableUint64ArrayView(Uint64List list) =>
- new _UnmodifiableUint64ArrayView._(
+ _UnmodifiableUint64ArrayView._(
unsafeCast<_TypedListBase>(list)._typedData,
list.offsetInBytes,
list.length,
);
void operator []=(int index, int value) {
- throw new UnsupportedError("Cannot modify an unmodifiable list");
+ throw UnsupportedError("Cannot modify an unmodifiable list");
}
- _ByteBuffer get buffer => new _UnmodifiableByteBufferView(_typedData.buffer);
+ _ByteBuffer get buffer => _UnmodifiableByteBufferView(_typedData.buffer);
Uint64List asUnmodifiableView() => this;
}
@@ -5732,17 +5718,17 @@
@pragma("vm:prefer-inline")
factory _UnmodifiableFloat32ArrayView(Float32List list) =>
- new _UnmodifiableFloat32ArrayView._(
+ _UnmodifiableFloat32ArrayView._(
unsafeCast<_TypedListBase>(list)._typedData,
list.offsetInBytes,
list.length,
);
void operator []=(int index, double value) {
- throw new UnsupportedError("Cannot modify an unmodifiable list");
+ throw UnsupportedError("Cannot modify an unmodifiable list");
}
- _ByteBuffer get buffer => new _UnmodifiableByteBufferView(_typedData.buffer);
+ _ByteBuffer get buffer => _UnmodifiableByteBufferView(_typedData.buffer);
Float32List asUnmodifiableView() => this;
}
@@ -5761,17 +5747,17 @@
@pragma("vm:prefer-inline")
factory _UnmodifiableFloat64ArrayView(Float64List list) =>
- new _UnmodifiableFloat64ArrayView._(
+ _UnmodifiableFloat64ArrayView._(
unsafeCast<_TypedListBase>(list)._typedData,
list.offsetInBytes,
list.length,
);
void operator []=(int index, double value) {
- throw new UnsupportedError("Cannot modify an unmodifiable list");
+ throw UnsupportedError("Cannot modify an unmodifiable list");
}
- _ByteBuffer get buffer => new _UnmodifiableByteBufferView(_typedData.buffer);
+ _ByteBuffer get buffer => _UnmodifiableByteBufferView(_typedData.buffer);
Float64List asUnmodifiableView() => this;
}
@@ -5790,17 +5776,17 @@
@pragma("vm:prefer-inline")
factory _UnmodifiableFloat32x4ArrayView(Float32x4List list) =>
- new _UnmodifiableFloat32x4ArrayView._(
+ _UnmodifiableFloat32x4ArrayView._(
unsafeCast<_TypedListBase>(list)._typedData,
list.offsetInBytes,
list.length,
);
void operator []=(int index, Float32x4 value) {
- throw new UnsupportedError("Cannot modify an unmodifiable list");
+ throw UnsupportedError("Cannot modify an unmodifiable list");
}
- _ByteBuffer get buffer => new _UnmodifiableByteBufferView(_typedData.buffer);
+ _ByteBuffer get buffer => _UnmodifiableByteBufferView(_typedData.buffer);
Float32x4List asUnmodifiableView() => this;
}
@@ -5819,17 +5805,17 @@
@pragma("vm:prefer-inline")
factory _UnmodifiableInt32x4ArrayView(Int32x4List list) =>
- new _UnmodifiableInt32x4ArrayView._(
+ _UnmodifiableInt32x4ArrayView._(
unsafeCast<_TypedListBase>(list)._typedData,
list.offsetInBytes,
list.length,
);
void operator []=(int index, Int32x4 value) {
- throw new UnsupportedError("Cannot modify an unmodifiable list");
+ throw UnsupportedError("Cannot modify an unmodifiable list");
}
- _ByteBuffer get buffer => new _UnmodifiableByteBufferView(_typedData.buffer);
+ _ByteBuffer get buffer => _UnmodifiableByteBufferView(_typedData.buffer);
Int32x4List asUnmodifiableView() => this;
}
@@ -5848,17 +5834,17 @@
@pragma("vm:prefer-inline")
factory _UnmodifiableFloat64x2ArrayView(Float64x2List list) =>
- new _UnmodifiableFloat64x2ArrayView._(
+ _UnmodifiableFloat64x2ArrayView._(
unsafeCast<_TypedListBase>(list)._typedData,
list.offsetInBytes,
list.length,
);
void operator []=(int index, Float64x2 value) {
- throw new UnsupportedError("Cannot modify an unmodifiable list");
+ throw UnsupportedError("Cannot modify an unmodifiable list");
}
- _ByteBuffer get buffer => new _UnmodifiableByteBufferView(_typedData.buffer);
+ _ByteBuffer get buffer => _UnmodifiableByteBufferView(_typedData.buffer);
Float64x2List asUnmodifiableView() => this;
}
@@ -5877,50 +5863,50 @@
@pragma("vm:prefer-inline")
factory _UnmodifiableByteDataView(ByteData data) =>
- new _UnmodifiableByteDataView._(
+ _UnmodifiableByteDataView._(
unsafeCast<_ByteDataView>(data).buffer._data,
data.offsetInBytes,
data.lengthInBytes,
);
void setInt8(int byteOffset, int value) {
- throw new UnsupportedError("Cannot modify an unmodifiable list");
+ throw UnsupportedError("Cannot modify an unmodifiable list");
}
void setUint8(int byteOffset, int value) {
- throw new UnsupportedError("Cannot modify an unmodifiable list");
+ throw UnsupportedError("Cannot modify an unmodifiable list");
}
void setInt16(int byteOffset, int value, [Endian endian = Endian.big]) {
- throw new UnsupportedError("Cannot modify an unmodifiable list");
+ throw UnsupportedError("Cannot modify an unmodifiable list");
}
void setUint16(int byteOffset, int value, [Endian endian = Endian.big]) {
- throw new UnsupportedError("Cannot modify an unmodifiable list");
+ throw UnsupportedError("Cannot modify an unmodifiable list");
}
void setInt32(int byteOffset, int value, [Endian endian = Endian.big]) {
- throw new UnsupportedError("Cannot modify an unmodifiable list");
+ throw UnsupportedError("Cannot modify an unmodifiable list");
}
void setUint32(int byteOffset, int value, [Endian endian = Endian.big]) {
- throw new UnsupportedError("Cannot modify an unmodifiable list");
+ throw UnsupportedError("Cannot modify an unmodifiable list");
}
void setInt64(int byteOffset, int value, [Endian endian = Endian.big]) {
- throw new UnsupportedError("Cannot modify an unmodifiable list");
+ throw UnsupportedError("Cannot modify an unmodifiable list");
}
void setUint64(int byteOffset, int value, [Endian endian = Endian.big]) {
- throw new UnsupportedError("Cannot modify an unmodifiable list");
+ throw UnsupportedError("Cannot modify an unmodifiable list");
}
void setFloat32(int byteOffset, double value, [Endian endian = Endian.big]) {
- throw new UnsupportedError("Cannot modify an unmodifiable list");
+ throw UnsupportedError("Cannot modify an unmodifiable list");
}
void setFloat64(int byteOffset, double value, [Endian endian = Endian.big]) {
- throw new UnsupportedError("Cannot modify an unmodifiable list");
+ throw UnsupportedError("Cannot modify an unmodifiable list");
}
void setFloat32x4(
@@ -5928,10 +5914,10 @@
Float32x4 value, [
Endian endian = Endian.big,
]) {
- throw new UnsupportedError("Cannot modify an unmodifiable list");
+ throw UnsupportedError("Cannot modify an unmodifiable list");
}
- _ByteBuffer get buffer => new _UnmodifiableByteBufferView(_typedData.buffer);
+ _ByteBuffer get buffer => _UnmodifiableByteBufferView(_typedData.buffer);
ByteData asUnmodifiableView() => this;
}
@@ -5941,65 +5927,53 @@
: super(unsafeCast<_ByteBuffer>(data)._data);
Uint8List asUint8List([int offsetInBytes = 0, int? length]) =>
- new _UnmodifiableUint8ArrayView(super.asUint8List(offsetInBytes, length));
+ _UnmodifiableUint8ArrayView(super.asUint8List(offsetInBytes, length));
Int8List asInt8List([int offsetInBytes = 0, int? length]) =>
- new _UnmodifiableInt8ArrayView(super.asInt8List(offsetInBytes, length));
+ _UnmodifiableInt8ArrayView(super.asInt8List(offsetInBytes, length));
Uint8ClampedList asUint8ClampedList([int offsetInBytes = 0, int? length]) =>
- new _UnmodifiableUint8ClampedArrayView(
+ _UnmodifiableUint8ClampedArrayView(
super.asUint8ClampedList(offsetInBytes, length),
);
Uint16List asUint16List([int offsetInBytes = 0, int? length]) =>
- new _UnmodifiableUint16ArrayView(
- super.asUint16List(offsetInBytes, length),
- );
+ _UnmodifiableUint16ArrayView(super.asUint16List(offsetInBytes, length));
Int16List asInt16List([int offsetInBytes = 0, int? length]) =>
- new _UnmodifiableInt16ArrayView(super.asInt16List(offsetInBytes, length));
+ _UnmodifiableInt16ArrayView(super.asInt16List(offsetInBytes, length));
Uint32List asUint32List([int offsetInBytes = 0, int? length]) =>
- new _UnmodifiableUint32ArrayView(
- super.asUint32List(offsetInBytes, length),
- );
+ _UnmodifiableUint32ArrayView(super.asUint32List(offsetInBytes, length));
Int32List asInt32List([int offsetInBytes = 0, int? length]) =>
- new _UnmodifiableInt32ArrayView(super.asInt32List(offsetInBytes, length));
+ _UnmodifiableInt32ArrayView(super.asInt32List(offsetInBytes, length));
Uint64List asUint64List([int offsetInBytes = 0, int? length]) =>
- new _UnmodifiableUint64ArrayView(
- super.asUint64List(offsetInBytes, length),
- );
+ _UnmodifiableUint64ArrayView(super.asUint64List(offsetInBytes, length));
Int64List asInt64List([int offsetInBytes = 0, int? length]) =>
- new _UnmodifiableInt64ArrayView(super.asInt64List(offsetInBytes, length));
+ _UnmodifiableInt64ArrayView(super.asInt64List(offsetInBytes, length));
Int32x4List asInt32x4List([int offsetInBytes = 0, int? length]) =>
- new _UnmodifiableInt32x4ArrayView(
- super.asInt32x4List(offsetInBytes, length),
- );
+ _UnmodifiableInt32x4ArrayView(super.asInt32x4List(offsetInBytes, length));
Float32List asFloat32List([int offsetInBytes = 0, int? length]) =>
- new _UnmodifiableFloat32ArrayView(
- super.asFloat32List(offsetInBytes, length),
- );
+ _UnmodifiableFloat32ArrayView(super.asFloat32List(offsetInBytes, length));
Float64List asFloat64List([int offsetInBytes = 0, int? length]) =>
- new _UnmodifiableFloat64ArrayView(
- super.asFloat64List(offsetInBytes, length),
- );
+ _UnmodifiableFloat64ArrayView(super.asFloat64List(offsetInBytes, length));
Float32x4List asFloat32x4List([int offsetInBytes = 0, int? length]) =>
- new _UnmodifiableFloat32x4ArrayView(
+ _UnmodifiableFloat32x4ArrayView(
super.asFloat32x4List(offsetInBytes, length),
);
Float64x2List asFloat64x2List([int offsetInBytes = 0, int? length]) =>
- new _UnmodifiableFloat64x2ArrayView(
+ _UnmodifiableFloat64x2ArrayView(
super.asFloat64x2List(offsetInBytes, length),
);
ByteData asByteData([int offsetInBytes = 0, int? length]) =>
- new _UnmodifiableByteDataView(super.asByteData(offsetInBytes, length));
+ _UnmodifiableByteDataView(super.asByteData(offsetInBytes, length));
}
diff --git a/sdk/lib/_internal/vm/lib/uri_patch.dart b/sdk/lib/_internal/vm/lib/uri_patch.dart
index 740ee277..fdac943 100644
--- a/sdk/lib/_internal/vm/lib/uri_patch.dart
+++ b/sdk/lib/_internal/vm/lib/uri_patch.dart
@@ -7,7 +7,7 @@
typedef Uri _UriBaseClosure();
Uri _unsupportedUriBase() {
- throw new UnsupportedError("'Uri.base' is not supported");
+ throw UnsupportedError("'Uri.base' is not supported");
}
// _uriBaseClosure can be overwritten by the embedder to supply a different
@@ -57,7 +57,7 @@
// Encode the string into bytes then generate an ASCII only string
// by percent encoding selected bytes.
- StringBuffer result = new StringBuffer();
+ StringBuffer result = StringBuffer();
for (int j = 0; j < i; j++) {
result.writeCharCode(text.codeUnitAt(j));
}
diff --git a/sdk/lib/_internal/vm_shared/lib/bigint_patch.dart b/sdk/lib/_internal/vm_shared/lib/bigint_patch.dart
index cfee4ae..cd3b41f 100644
--- a/sdk/lib/_internal/vm_shared/lib/bigint_patch.dart
+++ b/sdk/lib/_internal/vm_shared/lib/bigint_patch.dart
@@ -56,14 +56,14 @@
_BigIntImpl._tryParse(source, radix: radix);
@patch
- factory BigInt.from(num value) => new _BigIntImpl.from(value);
+ factory BigInt.from(num value) => _BigIntImpl.from(value);
}
int _max(int a, int b) => a > b ? a : b;
int _min(int a, int b) => a < b ? a : b;
/// Allocate a new digits list of even length.
-Uint32List _newDigits(int length) => new Uint32List(length + (length & 1));
+Uint32List _newDigits(int length) => Uint32List(length + (length & 1));
/**
* An implementation for the arbitrarily large integer.
@@ -81,14 +81,14 @@
static const int _halfDigitBits = _digitBits >> 1;
static const int _halfDigitMask = (1 << _halfDigitBits) - 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 _oneDigitMask = new _BigIntImpl._fromInt(_digitMask);
+ static final _BigIntImpl _oneDigitMask = _BigIntImpl._fromInt(_digitMask);
static final _BigIntImpl _twoDigitMask = (one << (2 * _digitBits)) - one;
- static final _BigIntImpl _oneBillion = new _BigIntImpl._fromInt(1000000000);
+ static final _BigIntImpl _oneBillion = _BigIntImpl._fromInt(1000000000);
static const int _minInt = -0x8000000000000000;
static const int _maxInt = 0x7fffffffffffffff;
@@ -101,7 +101,7 @@
/// Note that [_isIntrinsified] is still false if intrinsification occurs,
/// so it should be used only inside methods which are replaced by
/// intrinsification.
- static final bool _isIntrinsified = new bool.fromEnvironment(
+ static final bool _isIntrinsified = bool.fromEnvironment(
'dart.vm.not.a.compile.time.constant',
);
@@ -167,7 +167,7 @@
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;
}
@@ -188,7 +188,7 @@
for (int i = 0; i < source.length; i++) {
part = part * 10 + source.codeUnitAt(i) - _0;
if (++digitInPartCount == 9) {
- result = result * _oneBillion + new _BigIntImpl._fromInt(part);
+ result = result * _oneBillion + _BigIntImpl._fromInt(part);
part = 0;
digitInPartCount = 0;
}
@@ -252,7 +252,7 @@
digits[digitIndex--] = digit;
}
if (used == 1 && digits[0] == 0) return zero;
- return new _BigIntImpl._(isNegative, used, digits);
+ return _BigIntImpl._(isNegative, used, digits);
}
/// Parses the given [source] as a [radix] literal.
@@ -261,11 +261,11 @@
/// 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 value = _codeUnitToRadixValue(source.codeUnitAt(i));
if (value >= radix) return null;
- result = result * base + new _BigIntImpl._fromInt(value);
+ result = result * base + _BigIntImpl._fromInt(value);
}
if (isNegative) return -result;
return result;
@@ -305,7 +305,7 @@
}
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);
@@ -372,12 +372,12 @@
if (value == 2) return two;
if (value.abs() < 0x100000000) {
- return new _BigIntImpl._fromInt(value.toInt());
+ return _BigIntImpl._fromInt(value.toInt());
}
if (value is double) {
- return new _BigIntImpl._fromDouble(value);
+ return _BigIntImpl._fromDouble(value);
}
- return new _BigIntImpl._fromInt(value as int);
+ return _BigIntImpl._fromInt(value as int);
}
factory _BigIntImpl._fromInt(int value) {
@@ -389,28 +389,28 @@
// positive.
if (value == _minInt) {
digits[1] = 0x80000000;
- return new _BigIntImpl._(true, 2, digits);
+ return _BigIntImpl._(true, 2, digits);
}
value = -value;
}
if (value < _digitBase) {
digits[0] = value;
- return new _BigIntImpl._(isNegative, 1, digits);
+ return _BigIntImpl._(isNegative, 1, digits);
}
digits[0] = value & _digitMask;
digits[1] = value >> _digitBits;
- return new _BigIntImpl._(isNegative, 2, digits);
+ return _BigIntImpl._(isNegative, 2, 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;
@@ -436,7 +436,7 @@
unshiftedDigits[1] =
((0x10 | (bits[6] & 0xF)) << 16) + (bits[5] << 8) + bits[4];
- var unshiftedBig = new _BigIntImpl._normalized(false, 2, unshiftedDigits);
+ var unshiftedBig = _BigIntImpl._normalized(false, 2, unshiftedDigits);
_BigIntImpl absResult = unshiftedBig;
if (exponent < 0) {
absResult = unshiftedBig >> -exponent;
@@ -455,7 +455,7 @@
*/
_BigIntImpl operator -() {
if (_used == 0) return this;
- return new _BigIntImpl._(!_isNegative, _used, _digits);
+ return _BigIntImpl._(!_isNegative, _used, _digits);
}
/**
@@ -477,7 +477,7 @@
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.
@@ -526,7 +526,7 @@
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++) {
@@ -607,7 +607,7 @@
*/
_BigIntImpl operator <<(int shiftAmount) {
if (shiftAmount < 0) {
- throw new ArgumentError("shift-amount must be positive $shiftAmount");
+ throw ArgumentError("shift-amount must be positive $shiftAmount");
}
if (_isZero) return this;
final digitShift = shiftAmount ~/ _digitBits;
@@ -620,7 +620,7 @@
// The 64-bit intrinsic requires one extra pair to work with.
var resultDigits = _newDigits(resultUsed + 1);
_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.
@@ -690,7 +690,7 @@
*/
_BigIntImpl operator >>(int shiftAmount) {
if (shiftAmount < 0) {
- throw new ArgumentError("shift-amount must be positive $shiftAmount");
+ throw ArgumentError("shift-amount must be positive $shiftAmount");
}
if (_isZero) return this;
final digitShift = shiftAmount ~/ _digitBits;
@@ -707,7 +707,7 @@
// The 64-bit intrinsic requires one extra pair to work with.
final resultDigits = _newDigits(resultUsed + 1);
_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) {
@@ -867,7 +867,7 @@
var resultUsed = used + 1;
var resultDigits = _newDigits(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].
@@ -886,7 +886,7 @@
}
var resultDigits = _newDigits(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].
@@ -898,7 +898,7 @@
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].
@@ -914,7 +914,7 @@
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].
@@ -940,7 +940,7 @@
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].
@@ -966,7 +966,7 @@
for (var i = m; i < resultUsed; i++) {
resultDigits[i] = lDigits[i];
}
- return new _BigIntImpl._(isNegative, resultUsed, resultDigits);
+ return _BigIntImpl._(isNegative, resultUsed, resultDigits);
}
/**
@@ -1283,7 +1283,7 @@
while (i < otherUsed) {
i += _mulAdd(otherDigits, i, digits, 0, resultDigits, i, used);
}
- return new _BigIntImpl._(
+ return _BigIntImpl._(
_isNegative != other._isNegative,
resultUsed,
resultDigits,
@@ -1396,7 +1396,7 @@
_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;
}
@@ -1419,7 +1419,7 @@
_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.
}
@@ -1869,7 +1869,7 @@
_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;
@@ -1899,10 +1899,10 @@
final exponent = _ensureSystemBigInt(bigExponent, 'bigExponent');
final modulus = _ensureSystemBigInt(bigModulus, 'bigModulus');
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;
@@ -1912,8 +1912,8 @@
if (cannotUseMontgomery || exponentBitlen < 64) {
_BigIntReduction z =
(cannotUseMontgomery || exponentBitlen < 8)
- ? new _BigIntClassicReduction(modulus)
- : new _BigIntMontgomeryReduction(modulus);
+ ? _BigIntClassicReduction(modulus)
+ : _BigIntMontgomeryReduction(modulus);
var resultDigits = _newDigits(2 * z._normModulusUsed + 2);
var result2Digits = _newDigits(2 * z._normModulusUsed + 2);
var gDigits = _newDigits(z._normModulusUsed);
@@ -1958,12 +1958,12 @@
k = 5;
else
k = 6;
- _BigIntReduction z = new _BigIntMontgomeryReduction(modulus);
+ _BigIntReduction z = _BigIntMontgomeryReduction(modulus);
var n = 3;
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);
+ List gDigits = List.filled(km + 1, null);
+ List gUsed = List.filled(km + 1, null);
gDigits[1] = _newDigits(z._normModulusUsed);
gUsed[1] = z._convert(this, gDigits[1]);
if (k > 1) {
@@ -2076,14 +2076,14 @@
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)))
@@ -2284,13 +2284,13 @@
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) {
@@ -2309,7 +2309,7 @@
_absSub(dDigits, abcdUsed, xDigits, maxUsed, dDigits);
}
}
- return new _BigIntImpl._(false, maxUsed, dDigits);
+ return _BigIntImpl._(false, maxUsed, dDigits);
}
/**
@@ -2324,7 +2324,7 @@
_BigIntImpl modInverse(BigInt bigInt) {
final modulus = _ensureSystemBigInt(bigInt, 'bigInt');
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;
@@ -2464,7 +2464,7 @@
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) {
@@ -2611,7 +2611,7 @@
* The [radix] argument must be an integer in the range 2 to 36.
*/
String toRadixString(int radix) {
- if (radix < 2 || radix > 36) throw new RangeError.range(radix, 2, 36);
+ if (radix < 2 || radix > 36) throw RangeError.range(radix, 2, 36);
if (_used == 0) return "0";
@@ -2623,7 +2623,7 @@
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) {
@@ -2631,7 +2631,7 @@
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;
}
@@ -2654,7 +2654,7 @@
const _dash = 45;
chars.add(_dash);
}
- return new String.fromCharCodes(chars.reversed);
+ return String.fromCharCodes(chars.reversed);
}
static _BigIntImpl _ensureSystemBigInt(BigInt bigInt, String parameterName) {
@@ -2829,7 +2829,7 @@
resultDigits[i] = xDigits[i];
}
var resultUsed = _reduce(resultDigits, xUsed);
- return new _BigIntImpl._(false, resultUsed, resultDigits);
+ return _BigIntImpl._(false, resultUsed, resultDigits);
}
// x = x/R mod _modulus.
@@ -3002,7 +3002,7 @@
}
_BigIntImpl _revert(Uint32List xDigits, int xUsed) {
- return new _BigIntImpl._(false, xUsed, xDigits);
+ return _BigIntImpl._(false, xUsed, xDigits);
}
int _reduce(Uint32List xDigits, int xUsed) {
diff --git a/sdk/lib/_internal/vm_shared/lib/collection_patch.dart b/sdk/lib/_internal/vm_shared/lib/collection_patch.dart
index d14297a..75385a6 100644
--- a/sdk/lib/_internal/vm_shared/lib/collection_patch.dart
+++ b/sdk/lib/_internal/vm_shared/lib/collection_patch.dart
@@ -18,13 +18,13 @@
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>();
}
equals ??= _defaultEquals;
}
@@ -32,11 +32,11 @@
hashCode ??= _defaultHashCode;
equals ??= _defaultEquals;
}
- return new _CustomHashMap<K, V>(equals, hashCode, isValidKey);
+ return _CustomHashMap<K, V>(equals, hashCode, isValidKey);
}
@patch
- factory HashMap.identity() => new _IdentityHashMap<K, V>();
+ factory HashMap.identity() => _IdentityHashMap<K, V>();
Set<K> _newKeySet();
}
@@ -54,8 +54,8 @@
bool get isEmpty => _elementCount == 0;
bool get isNotEmpty => _elementCount != 0;
- Iterable<K> get keys => new _HashMapKeyIterable<K, V>(this);
- Iterable<V> get values => new _HashMapValueIterable<K, V>(this);
+ Iterable<K> get keys => _HashMapKeyIterable<K, V>(this);
+ Iterable<V> get values => _HashMapValueIterable<K, V>(this);
bool containsKey(Object? key) {
final hashCode = key.hashCode;
@@ -149,7 +149,7 @@
while (entry != null) {
action(unsafeCast<K>(entry.key), unsafeCast<V>(entry.value));
if (stamp != _modificationCount) {
- throw new ConcurrentModificationError(this);
+ throw ConcurrentModificationError(this);
}
entry = entry.next;
}
@@ -178,7 +178,7 @@
}
void clear() {
- _buckets = new List.filled(_INITIAL_CAPACITY, null);
+ _buckets = List.filled(_INITIAL_CAPACITY, null);
if (_elementCount > 0) {
_elementCount = 0;
_modificationCount = (_modificationCount + 1) & _MODIFICATION_COUNT_MASK;
@@ -205,7 +205,7 @@
V value,
int hashCode,
) {
- final entry = new _HashMapEntry(key, value, hashCode, buckets[index]);
+ final entry = _HashMapEntry(key, value, hashCode, buckets[index]);
buckets[index] = entry;
final newElements = _elementCount + 1;
_elementCount = newElements;
@@ -219,7 +219,7 @@
final oldBuckets = _buckets;
final oldLength = oldBuckets.length;
final newLength = oldLength << 1;
- final newBuckets = new List<_HashMapEntry?>.filled(newLength, null);
+ final newBuckets = List<_HashMapEntry?>.filled(newLength, null);
for (int i = 0; i < oldLength; i++) {
var entry = oldBuckets[i];
while (entry != null) {
@@ -256,7 +256,7 @@
}
}
- Set<K> _newKeySet() => new _HashSet<K>();
+ Set<K> _newKeySet() => _HashSet<K>();
}
base class _CustomHashMap<K, V> extends _HashMap<K, V> {
@@ -364,7 +364,7 @@
return null;
}
- Set<K> _newKeySet() => new _CustomHashSet<K>(_equals, _hashCode, _validKey);
+ Set<K> _newKeySet() => _CustomHashSet<K>(_equals, _hashCode, _validKey);
}
base class _IdentityHashMap<K, V> extends _HashMap<K, V> {
@@ -475,7 +475,7 @@
}
}
- Set<K> _newKeySet() => new _IdentityHashSet<K>();
+ Set<K> _newKeySet() => _IdentityHashSet<K>();
}
class _HashMapEntry {
@@ -497,7 +497,7 @@
class _HashMapKeyIterable<K, V> extends _HashMapIterable<K, V, K> {
_HashMapKeyIterable(_HashMap<K, V> map) : super(map);
- Iterator<K> get iterator => new _HashMapKeyIterator<K, V>(_map);
+ Iterator<K> get iterator => _HashMapKeyIterator<K, V>(_map);
bool contains(Object? key) => _map.containsKey(key);
void forEach(void action(K key)) {
_map.forEach((K key, _) {
@@ -510,7 +510,7 @@
class _HashMapValueIterable<K, V> extends _HashMapIterable<K, V, V> {
_HashMapValueIterable(_HashMap<K, V> map) : super(map);
- Iterator<V> get iterator => new _HashMapValueIterator<K, V>(_map);
+ Iterator<V> get iterator => _HashMapValueIterator<K, V>(_map);
bool contains(Object? value) => _map.containsValue(value);
void forEach(void action(V value)) {
_map.forEach((_, V value) {
@@ -530,7 +530,7 @@
bool moveNext() {
if (_stamp != _map._modificationCount) {
- throw new ConcurrentModificationError(_map);
+ throw ConcurrentModificationError(_map);
}
var entry = _entry;
if (entry != null) {
@@ -577,13 +577,13 @@
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>();
}
equals ??= _defaultEquals;
}
@@ -591,11 +591,11 @@
hashCode ??= _defaultHashCode;
equals ??= _defaultEquals;
}
- return new _CustomHashSet<E>(equals, hashCode, isValidKey);
+ return _CustomHashSet<E>(equals, hashCode, isValidKey);
}
@patch
- factory HashSet.identity() => new _IdentityHashSet<E>();
+ factory HashSet.identity() => _IdentityHashSet<E>();
}
base class _HashSet<E> extends _SetBase<E> implements HashSet<E> {
@@ -608,11 +608,11 @@
bool _equals(Object? e1, Object? e2) => e1 == e2;
int _hashCode(Object? e) => e.hashCode;
- static Set<R> _newEmpty<R>() => new _HashSet<R>();
+ static Set<R> _newEmpty<R>() => _HashSet<R>();
// Iterable.
- Iterator<E> get iterator => new _HashSetIterator<E>(this);
+ Iterator<E> get iterator => _HashSetIterator<E>(this);
int get length => _elementCount;
@@ -726,7 +726,7 @@
int modificationCount = _modificationCount;
bool testResult = test(entry.key);
if (modificationCount != _modificationCount) {
- throw new ConcurrentModificationError(this);
+ throw ConcurrentModificationError(this);
}
if (testResult == removeMatching) {
final next = entry.remove();
@@ -764,7 +764,7 @@
}
void _addEntry(E key, int hashCode, int index) {
- _buckets[index] = new _HashSetEntry<E>(key, hashCode, _buckets[index]);
+ _buckets[index] = _HashSetEntry<E>(key, hashCode, _buckets[index]);
int newElements = _elementCount + 1;
_elementCount = newElements;
int length = _buckets.length;
@@ -792,16 +792,16 @@
_buckets = newBuckets;
}
- HashSet<E> _newSet() => new _HashSet<E>();
- HashSet<R> _newSimilarSet<R>() => new _HashSet<R>();
+ HashSet<E> _newSet() => _HashSet<E>();
+ HashSet<R> _newSimilarSet<R>() => _HashSet<R>();
}
base class _IdentityHashSet<E> extends _HashSet<E> {
int _hashCode(Object? e) => identityHashCode(e);
bool _equals(Object? e1, Object? e2) => identical(e1, e2);
- HashSet<E> _newSet() => new _IdentityHashSet<E>();
- HashSet<R> _newSimilarSet<R>() => new _IdentityHashSet<R>();
+ HashSet<E> _newSet() => _IdentityHashSet<E>();
+ HashSet<R> _newSimilarSet<R>() => _IdentityHashSet<R>();
}
base class _CustomHashSet<E> extends _HashSet<E> {
@@ -844,8 +844,8 @@
bool _equals(Object? e1, Object? e2) => _equality(e1 as E, e2 as E);
int _hashCode(Object? e) => _hasher(e as E);
- HashSet<E> _newSet() => new _CustomHashSet<E>(_equality, _hasher, _validKey);
- HashSet<R> _newSimilarSet<R>() => new _HashSet<R>();
+ HashSet<E> _newSet() => _CustomHashSet<E>(_equality, _hasher, _validKey);
+ HashSet<R> _newSimilarSet<R>() => _HashSet<R>();
}
class _HashSetEntry<E> {
@@ -872,7 +872,7 @@
bool moveNext() {
if (_modificationCount != _set._modificationCount) {
- throw new ConcurrentModificationError(_set);
+ throw ConcurrentModificationError(_set);
}
var localNext = _next;
if (localNext != null) {
diff --git a/sdk/lib/_internal/vm_shared/lib/compact_hash.dart b/sdk/lib/_internal/vm_shared/lib/compact_hash.dart
index 3a0e066..3c92598 100644
--- a/sdk/lib/_internal/vm_shared/lib/compact_hash.dart
+++ b/sdk/lib/_internal/vm_shared/lib/compact_hash.dart
@@ -417,7 +417,7 @@
_ImmutableLinkedHashMapMixin<K, V>
implements LinkedHashMap<K, V> {
factory _ConstMap._uninstantiable() {
- throw new UnsupportedError("_ConstMap can only be allocated by the VM");
+ throw UnsupportedError("_ConstMap can only be allocated by the VM");
}
}
@@ -441,7 +441,7 @@
final size = _roundUpToPowerOfTwo(
max(_data.length, _HashBase._INITIAL_INDEX_SIZE),
);
- final newIndex = new Uint32List(size);
+ final newIndex = Uint32List(size);
final hashMask = _HashBase._indexSizeToHashMask(size);
assert(_hashMask == hashMask);
@@ -525,9 +525,9 @@
}
assert(size & (size - 1) == 0);
assert(_HashBase._UNUSED_PAIR == 0);
- _index = new Uint32List(size);
+ _index = Uint32List(size);
_hashMask = hashMask;
- _data = new List.filled(size, null);
+ _data = List.filled(size, null);
_usedData = 0;
_deletedKeys = 0;
if (oldData != null) {
@@ -556,9 +556,9 @@
assert(size & (size - 1) == 0);
assert(_HashBase._UNUSED_PAIR == 0);
- _index = new Uint32List(size);
+ _index = Uint32List(size);
_hashMask = hashMask;
- _data = new List.filled(size, null);
+ _data = List.filled(size, null);
_usedData = 0;
_deletedKeys = 0;
for (int i = 0; i < keyValuePairs.length; i += 2) {
@@ -569,8 +569,7 @@
}
void _regenerateIndex() {
- _index =
- _data.length == 0 ? _uninitializedIndex : new Uint32List(_data.length);
+ _index = _data.length == 0 ? _uninitializedIndex : Uint32List(_data.length);
assert(_hashMask == _HashBase._UNINITIALIZED_HASH_MASK);
_hashMask = _HashBase._indexSizeToHashMask(_index.length);
final int tmpUsed = _usedData;
@@ -1038,9 +1037,9 @@
size = _HashBase._INITIAL_INDEX_SIZE;
hashMask = _HashBase._indexSizeToHashMask(size);
}
- _index = new Uint32List(size);
+ _index = Uint32List(size);
_hashMask = hashMask;
- _data = new List.filled(size >> 1, null);
+ _data = List.filled(size >> 1, null);
_usedData = 0;
_deletedKeys = 0;
if (oldData != null) {
@@ -1154,7 +1153,7 @@
final size = _roundUpToPowerOfTwo(
max(_data.length, _HashBase._INITIAL_INDEX_SIZE),
);
- _index = _data.length == 0 ? _uninitializedIndex : new Uint32List(size);
+ _index = _data.length == 0 ? _uninitializedIndex : Uint32List(size);
assert(_hashMask == _HashBase._UNINITIALIZED_HASH_MASK);
_hashMask = _HashBase._indexSizeToHashMask(_index.length);
_rehash();
@@ -1208,7 +1207,7 @@
_ImmutableLinkedHashSetMixin<E>
implements LinkedHashSet<E> {
factory _ConstSet._uninstantiable() {
- throw new UnsupportedError("_ConstSet can only be allocated by the VM");
+ throw UnsupportedError("_ConstSet can only be allocated by the VM");
}
Set<R> cast<R>() => Set.castFrom<E, R>(this, newSet: _newEmpty);
@@ -1239,7 +1238,7 @@
final size = _roundUpToPowerOfTwo(
max(_data.length * 2, _HashBase._INITIAL_INDEX_SIZE),
);
- final index = new Uint32List(size);
+ final index = Uint32List(size);
final hashMask = _HashBase._indexSizeToHashMask(size);
assert(_hashMask == hashMask);
diff --git a/sdk/lib/_internal/vm_shared/lib/integers_patch.dart b/sdk/lib/_internal/vm_shared/lib/integers_patch.dart
index d755338..630fe91f 100644
--- a/sdk/lib/_internal/vm_shared/lib/integers_patch.dart
+++ b/sdk/lib/_internal/vm_shared/lib/integers_patch.dart
@@ -48,7 +48,7 @@
@patch
static int parse(String source, {int? radix, int onError(String source)?}) {
- if (source == null) throw new ArgumentError("The source must not be null");
+ if (source == null) throw ArgumentError("The source must not be null");
if (source.isEmpty) {
return _handleFormatError(onError, source, 0, radix, null) as int;
}
@@ -57,7 +57,7 @@
int? result = _tryParseSmi(source, 0, source.length - 1);
if (result != null) return result;
} else if (radix < 2 || radix > 36) {
- throw new RangeError("Radix $radix not in range 2..36");
+ throw RangeError("Radix $radix not in range 2..36");
}
// Split here so improve odds of parse being inlined and the checks omitted.
return _parse(unsafeCast<_StringBase>(source), radix, onError) as int;
@@ -106,14 +106,14 @@
@patch
static int? tryParse(String source, {int? radix}) {
- if (source == null) throw new ArgumentError("The source must not be null");
+ if (source == null) throw ArgumentError("The source must not be null");
if (source.isEmpty) return null;
if (radix == null || radix == 10) {
// Try parsing immediately, without trimming whitespace.
int? result = _tryParseSmi(source, 0, source.length - 1);
if (result != null) return result;
} else if (radix < 2 || radix > 36) {
- throw new RangeError("Radix $radix not in range 2..36");
+ throw RangeError("Radix $radix not in range 2..36");
}
return _parse(unsafeCast<_StringBase>(source), radix, _kNull);
}
@@ -129,12 +129,12 @@
) {
if (onError != null) return onError(source);
if (message != null) {
- throw new FormatException(message, source, index);
+ throw FormatException(message, source, index);
}
if (radix == null) {
- throw new FormatException("Invalid number", source, index);
+ throw FormatException("Invalid number", source, index);
}
- throw new FormatException("Invalid radix-$radix number", source, index);
+ throw FormatException("Invalid radix-$radix number", source, index);
}
static int? _parseRadix(
@@ -254,7 +254,7 @@
// For each radix, 2-36, how many digits are guaranteed to fit in a smi,
// and magnitude of such a block (radix ** digit-count).
// 32-bit limit/multiplier at (radix - 2)*4, 64-bit limit at (radix-2)*4+2
- static const _PARSE_LIMITS = const [
+ static const _PARSE_LIMITS = [
30, 1073741824, 62, 4611686018427387904, // radix: 2
18, 387420489, 39, 4052555153018976267,
15, 1073741824, 30, 1152921504606846976,
@@ -295,11 +295,8 @@
static const _maxInt64 = 0x7fffffffffffffff;
static const _minInt64 = -0x8000000000000000;
- static const _int64UnsignedOverflowLimits = const [0xfffffffff, 0xf];
- static const _int64UnsignedSmiOverflowLimits = const [
- 0xfffffff,
- 0xfffffffffffffff,
- ];
+ static const _int64UnsignedOverflowLimits = [0xfffffffff, 0xf];
+ static const _int64UnsignedSmiOverflowLimits = [0xfffffff, 0xfffffffffffffff];
/// Calculation of the expression
///
@@ -316,7 +313,7 @@
/// * `[tableIndex*2 + 1]` = negative limit for result
/// * `[tableIndex*2 + 2]` = limit for smi if result is exactly at positive limit
/// * `[tableIndex*2 + 3]` = limit for smi if result is exactly at negative limit
- static final Int64List _int64OverflowLimits = new Int64List(
+ static final Int64List _int64OverflowLimits = Int64List(
_PARSE_LIMITS.length * 2,
);
diff --git a/sdk/lib/_internal/vm_shared/lib/map_patch.dart b/sdk/lib/_internal/vm_shared/lib/map_patch.dart
index 98ce4a5..e550bf4 100644
--- a/sdk/lib/_internal/vm_shared/lib/map_patch.dart
+++ b/sdk/lib/_internal/vm_shared/lib/map_patch.dart
@@ -15,7 +15,7 @@
// The values are at position 2*n+1 and are not yet type checked.
@pragma("vm:entry-point", "call")
factory Map._fromLiteral(List elements) {
- var map = new LinkedHashMap<K, V>();
+ var map = LinkedHashMap<K, V>();
var len = elements.length;
for (int i = 1; i < len; i += 2) {
map[elements[i - 1]] = elements[i];
@@ -25,11 +25,11 @@
@patch
factory Map.unmodifiable(Map other) {
- return new UnmodifiableMapView<K, V>(new Map<K, V>.from(other));
+ return UnmodifiableMapView<K, V>(Map<K, V>.from(other));
}
@patch
- factory Map() => new LinkedHashMap<K, V>();
+ factory Map() => LinkedHashMap<K, V>();
}
// Used by Dart_MapContainsKey.
diff --git a/sdk/lib/_internal/vm_shared/lib/string_buffer_patch.dart b/sdk/lib/_internal/vm_shared/lib/string_buffer_patch.dart
index d93e6e9..c4ec5a8 100644
--- a/sdk/lib/_internal/vm_shared/lib/string_buffer_patch.dart
+++ b/sdk/lib/_internal/vm_shared/lib/string_buffer_patch.dart
@@ -77,7 +77,7 @@
void writeCharCode(int charCode) {
if (charCode <= 0xFFFF) {
if (charCode < 0) {
- throw new RangeError.range(charCode, 0, 0x10FFFF);
+ throw RangeError.range(charCode, 0, 0x10FFFF);
}
_ensureCapacity(1);
final localBuffer = _buffer!;
@@ -85,7 +85,7 @@
_bufferCodeUnitMagnitude |= charCode;
} else {
if (charCode > 0x10FFFF) {
- throw new RangeError.range(charCode, 0, 0x10FFFF);
+ throw RangeError.range(charCode, 0, 0x10FFFF);
}
_ensureCapacity(2);
int bits = charCode - 0x10000;
@@ -140,7 +140,7 @@
void _ensureCapacity(int n) {
final localBuffer = _buffer;
if (localBuffer == null) {
- _buffer = new Uint16List(_BUFFER_SIZE);
+ _buffer = Uint16List(_BUFFER_SIZE);
} else if (_bufferPosition + n > localBuffer.length) {
_consumeBuffer();
}
@@ -171,7 +171,7 @@
if (localParts == null) {
// Empirically this is a good capacity to minimize total bytes allocated.
- _parts = new _GrowableList.withCapacity(10)..add(str);
+ _parts = _GrowableList.withCapacity(10)..add(str);
} else {
localParts.add(str);
int partsSinceCompaction = localParts.length - _partsCompactionIndex;
diff --git a/sdk/lib/_internal/wasm/lib/boxed_double.dart b/sdk/lib/_internal/wasm/lib/boxed_double.dart
index 45ca84a..a19bbcc 100644
--- a/sdk/lib/_internal/wasm/lib/boxed_double.dart
+++ b/sdk/lib/_internal/wasm/lib/boxed_double.dart
@@ -294,7 +294,7 @@
num clamp(num lowerLimit, num upperLimit) {
if (lowerLimit.compareTo(upperLimit) > 0) {
- throw new ArgumentError(lowerLimit);
+ throw ArgumentError(lowerLimit);
}
if (lowerLimit.isNaN) return lowerLimit;
if (this.compareTo(lowerLimit) < 0) return lowerLimit;
diff --git a/sdk/lib/_internal/wasm/lib/boxed_int.dart b/sdk/lib/_internal/wasm/lib/boxed_int.dart
index 4e149fa..446949b 100644
--- a/sdk/lib/_internal/wasm/lib/boxed_int.dart
+++ b/sdk/lib/_internal/wasm/lib/boxed_int.dart
@@ -274,7 +274,7 @@
}
// Generic case involving doubles, and invalid integer ranges.
if (lowerLimit.compareTo(upperLimit) > 0) {
- throw new ArgumentError(lowerLimit);
+ throw ArgumentError(lowerLimit);
}
if (lowerLimit.isNaN) return lowerLimit;
// Note that we don't need to care for -0.0 for the lower limit.
@@ -394,7 +394,7 @@
} while (u != 0);
if (!inv) return v << s;
if (v != 1) {
- throw new Exception("Not coprime");
+ throw Exception("Not coprime");
}
if (d < 0) {
d += x;
@@ -415,7 +415,7 @@
if (t.geU(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);
}
diff --git a/sdk/lib/_internal/wasm/lib/compact_hash.dart b/sdk/lib/_internal/wasm/lib/compact_hash.dart
index d4dbfd4..7cebb0a 100644
--- a/sdk/lib/_internal/wasm/lib/compact_hash.dart
+++ b/sdk/lib/_internal/wasm/lib/compact_hash.dart
@@ -103,7 +103,7 @@
/// field type nullable.
@pragma("wasm:entry-point")
final WasmArray<WasmI32> _uninitializedHashBaseIndex =
- const WasmArray<WasmI32>.literal([const WasmI32(0)]);
+ const WasmArray<WasmI32>.literal([WasmI32(0)]);
/// The object marking uninitialized [_HashFieldBase._data] fields.
///
@@ -312,9 +312,7 @@
_ImmutableLinkedHashMapMixin<K, V>
implements LinkedHashMap<K, V> {
factory _ConstMap._uninstantiable() {
- throw new UnsupportedError(
- "_ConstMap can only be allocated by the compiler",
- );
+ throw UnsupportedError("_ConstMap can only be allocated by the compiler");
}
}
@@ -1125,9 +1123,7 @@
_ImmutableLinkedHashSetMixin<E>
implements LinkedHashSet<E> {
factory _ConstSet._uninstantiable() {
- throw new UnsupportedError(
- "_ConstSet can only be allocated by the compiler",
- );
+ throw UnsupportedError("_ConstSet can only be allocated by the compiler");
}
Set<R> cast<R>() => Set.castFrom<E, R>(this, newSet: _newEmpty);
diff --git a/sdk/lib/_internal/wasm/lib/convert_patch.dart b/sdk/lib/_internal/wasm/lib/convert_patch.dart
index cfec2cf..42d3462 100644
--- a/sdk/lib/_internal/wasm/lib/convert_patch.dart
+++ b/sdk/lib/_internal/wasm/lib/convert_patch.dart
@@ -2607,7 +2607,7 @@
// This table is the Wasm array version of `_Utf8Decoder.transitionTable`,
// refer to the original type for documentation of the values.
- static const _transitionTable = const ImmutableWasmArray<WasmI8>.literal([
+ static const _transitionTable = ImmutableWasmArray<WasmI8>.literal([
32, 0, 48, 58, 88, 69, 67, 67, 67, 67, 67, 78, 58, 108, 68, 98, 32, 0, //
48, 58, 88, 69, 67, 67, 67, 67, 67, 78, 118, 108, 68, 98, 32, 0, 48, 58, //
88, 69, 67, 67, 67, 67, 67, 78, 58, 108, 68, 98, 32, 65, 65, 65, 65, 65, //
@@ -2620,7 +2620,7 @@
// This table is the Wasm array version of `_Utf8Decoder.typeTable`,
// refer to the original type for documentation of the values.
- static const _typeTable = const ImmutableWasmArray<WasmI8>.literal([
+ static const _typeTable = ImmutableWasmArray<WasmI8>.literal([
65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, //
65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, //
65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, //
diff --git a/sdk/lib/_internal/wasm/lib/errors_patch.dart b/sdk/lib/_internal/wasm/lib/errors_patch.dart
index d6a7128..9dc9d33 100644
--- a/sdk/lib/_internal/wasm/lib/errors_patch.dart
+++ b/sdk/lib/_internal/wasm/lib/errors_patch.dart
@@ -274,7 +274,7 @@
@patch
class StateError {
static _throwNew(String msg) {
- throw new StateError(msg);
+ throw StateError(msg);
}
}
diff --git a/sdk/lib/_internal/wasm/lib/int_patch.dart b/sdk/lib/_internal/wasm/lib/int_patch.dart
index 38252bd..8738c89 100644
--- a/sdk/lib/_internal/wasm/lib/int_patch.dart
+++ b/sdk/lib/_internal/wasm/lib/int_patch.dart
@@ -248,7 +248,7 @@
}
// For each radix, 2-36, how many digits are guaranteed to fit in an `int`.
- static const _PARSE_LIMITS = const ImmutableWasmArray<WasmI64>.literal([
+ static const _PARSE_LIMITS = ImmutableWasmArray<WasmI64>.literal([
0, // unused
0, // unused
63, // radix: 2
diff --git a/sdk/lib/_internal/wasm/lib/io_patch.dart b/sdk/lib/_internal/wasm/lib/io_patch.dart
index fd9fdf9..ca4b630 100644
--- a/sdk/lib/_internal/wasm/lib/io_patch.dart
+++ b/sdk/lib/_internal/wasm/lib/io_patch.dart
@@ -12,42 +12,42 @@
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
@@ -58,7 +58,7 @@
bool recursive,
bool followLinks,
) {
- throw new UnsupportedError("Directory._fillWithDirectoryListing");
+ throw UnsupportedError("Directory._fillWithDirectoryListing");
}
}
@@ -66,7 +66,7 @@
class _AsyncDirectoryListerOps {
@patch
factory _AsyncDirectoryListerOps(int pointer) {
- throw new UnsupportedError("Directory._list");
+ throw UnsupportedError("Directory._list");
}
}
@@ -74,7 +74,7 @@
class _EventHandler {
@patch
static void _sendData(Object? sender, SendPort sendPort, int data) {
- throw new UnsupportedError("EventHandler._sendData");
+ throw UnsupportedError("EventHandler._sendData");
}
}
@@ -82,7 +82,7 @@
class FileStat {
@patch
static _statSync(_Namespace namespace, String path) {
- throw new UnsupportedError("FileStat.stat");
+ throw UnsupportedError("FileStat.stat");
}
}
@@ -94,17 +94,17 @@
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");
}
}
@@ -112,17 +112,17 @@
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
@@ -132,67 +132,67 @@
@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");
}
}
@@ -200,17 +200,17 @@
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");
}
}
@@ -218,7 +218,7 @@
class _RandomAccessFileOps {
@patch
factory _RandomAccessFileOps(int pointer) {
- throw new UnsupportedError("RandomAccessFile");
+ throw UnsupportedError("RandomAccessFile");
}
}
@@ -226,7 +226,7 @@
class _IOCrypto {
@patch
static Uint8List getRandomBytes(int count) {
- throw new UnsupportedError("_IOCrypto.getRandomBytes");
+ throw UnsupportedError("_IOCrypto.getRandomBytes");
}
}
@@ -234,67 +234,67 @@
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");
}
}
@@ -302,32 +302,32 @@
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");
}
}
@@ -335,12 +335,12 @@
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");
}
}
@@ -356,7 +356,7 @@
bool runInShell = false,
ProcessStartMode mode = ProcessStartMode.normal,
}) {
- throw new UnsupportedError("Process.start");
+ throw UnsupportedError("Process.start");
}
@patch
@@ -370,7 +370,7 @@
Encoding? stdoutEncoding = systemEncoding,
Encoding? stderrEncoding = systemEncoding,
}) {
- throw new UnsupportedError("Process.run");
+ throw UnsupportedError("Process.run");
}
@patch
@@ -384,12 +384,12 @@
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");
}
}
@@ -397,27 +397,27 @@
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
@@ -425,7 +425,7 @@
Uint8List rawAddress, {
InternetAddressType? type,
}) {
- throw new UnsupportedError("InternetAddress.fromRawAddress");
+ throw UnsupportedError("InternetAddress.fromRawAddress");
}
@patch
@@ -433,7 +433,7 @@
String host, {
InternetAddressType type = InternetAddressType.any,
}) {
- throw new UnsupportedError("InternetAddress.lookup");
+ throw UnsupportedError("InternetAddress.lookup");
}
@patch
@@ -441,7 +441,7 @@
InternetAddress address,
String host,
) {
- throw new UnsupportedError("InternetAddress._cloneWithNewHost");
+ throw UnsupportedError("InternetAddress._cloneWithNewHost");
}
@patch
@@ -454,7 +454,7 @@
class NetworkInterface {
@patch
static bool get listSupported {
- throw new UnsupportedError("NetworkInterface.listSupported");
+ throw UnsupportedError("NetworkInterface.listSupported");
}
@patch
@@ -463,7 +463,7 @@
bool includeLinkLocal = false,
InternetAddressType type = InternetAddressType.any,
}) {
- throw new UnsupportedError("NetworkInterface.list");
+ throw UnsupportedError("NetworkInterface.list");
}
}
@@ -477,7 +477,7 @@
bool v6Only = false,
bool shared = false,
}) {
- throw new UnsupportedError("RawServerSocket.bind");
+ throw UnsupportedError("RawServerSocket.bind");
}
}
@@ -491,7 +491,7 @@
bool v6Only = false,
bool shared = false,
}) {
- throw new UnsupportedError("ServerSocket.bind");
+ throw UnsupportedError("ServerSocket.bind");
}
}
@@ -505,7 +505,7 @@
int sourcePort = 0,
Duration? timeout,
}) {
- throw new UnsupportedError("RawSocket constructor");
+ throw UnsupportedError("RawSocket constructor");
}
@patch
@@ -515,7 +515,7 @@
dynamic sourceAddress,
int sourcePort = 0,
}) {
- throw new UnsupportedError("RawSocket constructor");
+ throw UnsupportedError("RawSocket constructor");
}
}
@@ -529,7 +529,7 @@
int sourcePort = 0,
Duration? timeout,
}) {
- throw new UnsupportedError("Socket constructor");
+ throw UnsupportedError("Socket constructor");
}
@patch
@@ -539,7 +539,7 @@
dynamic sourceAddress,
int sourcePort = 0,
}) {
- throw new UnsupportedError("Socket constructor");
+ throw UnsupportedError("Socket constructor");
}
}
@@ -600,7 +600,7 @@
class SecureSocket {
@patch
factory SecureSocket._(RawSecureSocket rawSocket) {
- throw new UnsupportedError("SecureSocket constructor");
+ throw UnsupportedError("SecureSocket constructor");
}
}
@@ -608,7 +608,7 @@
class RawSynchronousSocket {
@patch
static RawSynchronousSocket connectSync(dynamic host, int port) {
- throw new UnsupportedError("RawSynchronousSocket.connectSync");
+ throw UnsupportedError("RawSynchronousSocket.connectSync");
}
}
@@ -624,17 +624,17 @@
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");
}
}
@@ -642,7 +642,7 @@
class X509Certificate {
@patch
factory X509Certificate._() {
- throw new UnsupportedError("X509Certificate constructor");
+ throw UnsupportedError("X509Certificate constructor");
}
}
@@ -656,7 +656,7 @@
bool reusePort = false,
int ttl = 1,
}) {
- throw new UnsupportedError("RawDatagramSocket.bind");
+ throw UnsupportedError("RawDatagramSocket.bind");
}
}
@@ -664,7 +664,7 @@
class _SecureFilter {
@patch
factory _SecureFilter._() {
- throw new UnsupportedError("_SecureFilter._SecureFilter");
+ throw UnsupportedError("_SecureFilter._SecureFilter");
}
}
@@ -672,22 +672,22 @@
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");
}
}
@@ -695,7 +695,7 @@
class _WindowsCodePageDecoder {
@patch
static String _decodeBytes(List<int> bytes) {
- throw new UnsupportedError("_WindowsCodePageDecoder._decodeBytes");
+ throw UnsupportedError("_WindowsCodePageDecoder._decodeBytes");
}
}
@@ -703,7 +703,7 @@
class _WindowsCodePageEncoder {
@patch
static List<int> _encodeString(String string) {
- throw new UnsupportedError("_WindowsCodePageEncoder._encodeString");
+ throw UnsupportedError("_WindowsCodePageEncoder._encodeString");
}
}
@@ -719,7 +719,7 @@
List<int>? dictionary,
bool raw,
) {
- throw new UnsupportedError("_newZLibDeflateFilter");
+ throw UnsupportedError("_newZLibDeflateFilter");
}
@patch
@@ -729,7 +729,7 @@
List<int>? dictionary,
bool raw,
) {
- throw new UnsupportedError("_newZLibInflateFilter");
+ throw UnsupportedError("_newZLibInflateFilter");
}
}
@@ -737,17 +737,17 @@
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
@@ -762,17 +762,17 @@
@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");
}
}
@@ -780,22 +780,22 @@
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");
}
}
@@ -807,12 +807,12 @@
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");
}
}
@@ -820,6 +820,6 @@
class _IOService {
@patch
static Future<Object?> _dispatch(int request, List data) {
- throw new UnsupportedError("_IOService._dispatch");
+ throw UnsupportedError("_IOService._dispatch");
}
}
diff --git a/sdk/lib/_internal/wasm/lib/math_patch.dart b/sdk/lib/_internal/wasm/lib/math_patch.dart
index e285e1a..a646ef6 100644
--- a/sdk/lib/_internal/wasm/lib/math_patch.dart
+++ b/sdk/lib/_internal/wasm/lib/math_patch.dart
@@ -149,7 +149,7 @@
factory Random([int? seed]) {
var state = _Random._setupSeed((seed == null) ? _Random._nextSeed() : seed);
// Crank a couple of times to distribute the seed bits a bit further.
- return new _Random._withState(state)
+ return _Random._withState(state)
.._nextState()
.._nextState()
.._nextState()
@@ -225,7 +225,7 @@
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 final _prng = new _Random._withState(_initialSeed());
+ static final _prng = _Random._withState(_initialSeed());
static int _setupSeed(int seed) => mix64(seed);
diff --git a/sdk/lib/_internal/wasm/lib/object_patch.dart b/sdk/lib/_internal/wasm/lib/object_patch.dart
index 3e91a9b..789a2cd 100644
--- a/sdk/lib/_internal/wasm/lib/object_patch.dart
+++ b/sdk/lib/_internal/wasm/lib/object_patch.dart
@@ -11,7 +11,7 @@
external bool operator ==(Object other);
// Random number generator used to generate identity hash codes.
- static final _hashCodeRnd = new Random();
+ static final _hashCodeRnd = Random();
static int _objectHashCode(Object obj) {
var result = getIdentityHashField(obj);
@@ -55,7 +55,7 @@
@patch
@pragma("wasm:entry-point")
dynamic noSuchMethod(Invocation invocation) {
- throw new NoSuchMethodError.withInvocation(this, invocation);
+ throw NoSuchMethodError.withInvocation(this, invocation);
}
// Used for `null.toString` tear-offs.
@@ -65,6 +65,6 @@
// Used for `null.noSuchMethod` tear-offs.
@pragma("wasm:entry-point")
static dynamic _nullNoSuchMethod(Invocation invocation) {
- throw new NoSuchMethodError.withInvocation(null, invocation);
+ throw NoSuchMethodError.withInvocation(null, invocation);
}
}
diff --git a/sdk/lib/_internal/wasm/lib/regexp_helper.dart b/sdk/lib/_internal/wasm/lib/regexp_helper.dart
index c712522..81c061c 100644
--- a/sdk/lib/_internal/wasm/lib/regexp_helper.dart
+++ b/sdk/lib/_internal/wasm/lib/regexp_helper.dart
@@ -138,7 +138,7 @@
RegExpMatch? firstMatch(String string) {
JSNativeMatch? m = _nativeRegExp.exec(string.toJS);
- return m == null ? null : new _MatchImplementation(this, m);
+ return m == null ? null : _MatchImplementation(this, m);
}
bool hasMatch(String string) {
@@ -161,7 +161,7 @@
JSNativeRegExp regexp = _nativeGlobalVersion;
regexp.lastIndex = start.toJS;
JSNativeMatch? match = regexp.exec(string);
- return match == null ? null : new _MatchImplementation(this, match);
+ return match == null ? null : _MatchImplementation(this, match);
}
RegExpMatch? _execAnchored(String string, int start) {
@@ -172,7 +172,7 @@
// If the last capture group participated, the original regexp did not
// match at the start position.
if (match.pop() != null) return null;
- return new _MatchImplementation(this, match);
+ return _MatchImplementation(this, match);
}
RegExpMatch? matchAsPrefix(String string, [int start = 0]) {
@@ -246,7 +246,7 @@
_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> {
diff --git a/sdk/lib/_internal/wasm/lib/simd.dart b/sdk/lib/_internal/wasm/lib/simd.dart
index b5debe1..fb361eb 100644
--- a/sdk/lib/_internal/wasm/lib/simd.dart
+++ b/sdk/lib/_internal/wasm/lib/simd.dart
@@ -110,7 +110,7 @@
@override
void operator []=(int index, Int32x4 value) {
- throw new UnsupportedError("Cannot modify an unmodifiable list");
+ throw UnsupportedError("Cannot modify an unmodifiable list");
}
@override
@@ -216,7 +216,7 @@
@override
void operator []=(int index, Float32x4 value) {
- throw new UnsupportedError("Cannot modify an unmodifiable list");
+ throw UnsupportedError("Cannot modify an unmodifiable list");
}
@override
@@ -316,7 +316,7 @@
@override
void operator []=(int index, Float64x2 value) {
- throw new UnsupportedError("Cannot modify an unmodifiable list");
+ throw UnsupportedError("Cannot modify an unmodifiable list");
}
@override
diff --git a/sdk/lib/_internal/wasm/lib/symbol_patch.dart b/sdk/lib/_internal/wasm/lib/symbol_patch.dart
index 15e4098..6cdd319 100644
--- a/sdk/lib/_internal/wasm/lib/symbol_patch.dart
+++ b/sdk/lib/_internal/wasm/lib/symbol_patch.dart
@@ -30,7 +30,7 @@
// Class._constructor@xxx -> Class._constructor
// _Class@xxx._constructor@xxx -> _Class._constructor
// lib._S@xxx with lib._M1@xxx, lib._M2@xxx -> lib._S with lib._M1, lib._M2
- StringBuffer result = new StringBuffer();
+ StringBuffer result = StringBuffer();
bool add_setter_suffix = false;
var pos = 0;
if (string.length >= 4 && string[3] == ':') {
diff --git a/sdk/lib/_internal/wasm/lib/weak_patch.dart b/sdk/lib/_internal/wasm/lib/weak_patch.dart
index 812a1c9..d151a4c 100644
--- a/sdk/lib/_internal/wasm/lib/weak_patch.dart
+++ b/sdk/lib/_internal/wasm/lib/weak_patch.dart
@@ -17,7 +17,7 @@
(object is Pointer) ||
(object is Struct) ||
(object is Union)) {
- throw new ArgumentError.value(
+ throw ArgumentError.value(
object,
"A string, number, boolean, record, Pointer, Struct or Union "
"can't be a weak target",
diff --git a/sdk/lib/_internal/wasm_js_compatibility/lib/convert_patch.dart b/sdk/lib/_internal/wasm_js_compatibility/lib/convert_patch.dart
index 3964952..72db016 100644
--- a/sdk/lib/_internal/wasm_js_compatibility/lib/convert_patch.dart
+++ b/sdk/lib/_internal/wasm_js_compatibility/lib/convert_patch.dart
@@ -16,8 +16,8 @@
String source,
Object? Function(Object? key, Object? value)? reviver,
) {
- _JsonListener listener = new _JsonListener(reviver);
- var parser = new _JsonStringParser(listener);
+ _JsonListener listener = _JsonListener(reviver);
+ var parser = _JsonStringParser(listener);
parser.chunk = source;
parser.chunkEnd = source.length;
parser.parse(0);
@@ -171,7 +171,7 @@
Uint8List list;
int length = 0;
_NumberBuffer(int initialCapacity)
- : list = new Uint8List(_initialCapacity(initialCapacity));
+ : list = Uint8List(_initialCapacity(initialCapacity));
int get capacity => list.length;
@@ -194,13 +194,13 @@
void ensureCapacity(int newCapacity) {
Uint8List list = this.list;
if (newCapacity <= list.length) return;
- Uint8List newList = new Uint8List(newCapacity);
+ Uint8List newList = Uint8List(newCapacity);
newList.setRange(0, list.length, list, 0);
this.list = newList;
}
String getString() {
- String result = new String.fromCharCodes(list, 0, length);
+ String result = String.fromCharCodes(list, 0, length);
return result;
}
@@ -1128,7 +1128,7 @@
int beginChunkNumber(int state, int start) {
int end = chunkEnd;
int length = end - start;
- var buffer = new _NumberBuffer(length);
+ var buffer = _NumberBuffer(length);
copyCharsToList(start, end, buffer.list, 0);
buffer.length = length;
this.buffer = buffer;
@@ -1337,7 +1337,7 @@
message = "Unexpected character";
if (position == chunkEnd) message = "Unexpected end of input";
}
- throw new FormatException(message, chunk, position);
+ throw FormatException(message, chunk, position);
}
}
@@ -1357,7 +1357,7 @@
}
void beginString() {
- this.buffer = new StringBuffer();
+ this.buffer = StringBuffer();
}
void addSliceToString(int start, int end) {
@@ -1441,7 +1441,7 @@
String getString(int start, int end, int bits) {
const int maxAsciiChar = 0x7f;
if (bits <= maxAsciiChar) {
- return new String.fromCharCodes(chunk, start, end);
+ return String.fromCharCodes(chunk, start, end);
}
beginString();
if (start < end) addSliceToString(start, end);
@@ -1450,7 +1450,7 @@
}
void beginString() {
- this.buffer = new StringBuffer();
+ this.buffer = StringBuffer();
}
void addSliceToString(int start, int end) {
diff --git a/sdk/lib/async/broadcast_stream_controller.dart b/sdk/lib/async/broadcast_stream_controller.dart
index 4d5cfab..76c0205 100644
--- a/sdk/lib/async/broadcast_stream_controller.dart
+++ b/sdk/lib/async/broadcast_stream_controller.dart
@@ -98,34 +98,34 @@
: _state = _STATE_INITIAL;
void Function() get onPause {
- throw new UnsupportedError(
+ throw UnsupportedError(
"Broadcast stream controllers do not support pause callbacks",
);
}
void set onPause(void onPauseHandler()?) {
- throw new UnsupportedError(
+ throw UnsupportedError(
"Broadcast stream controllers do not support pause callbacks",
);
}
void Function() get onResume {
- throw new UnsupportedError(
+ throw UnsupportedError(
"Broadcast stream controllers do not support pause callbacks",
);
}
void set onResume(void onResumeHandler()?) {
- throw new UnsupportedError(
+ throw UnsupportedError(
"Broadcast stream controllers do not support pause callbacks",
);
}
// StreamController interface.
- Stream<T> get stream => new _BroadcastStream<T>(this);
+ Stream<T> get stream => _BroadcastStream<T>(this);
- StreamSink<T> get sink => new _StreamSinkWrapper<T>(this);
+ StreamSink<T> get sink => _StreamSinkWrapper<T>(this);
bool get isClosed => (_state & _STATE_CLOSED) != 0;
@@ -205,9 +205,9 @@
bool cancelOnError,
) {
if (isClosed) {
- return new _DoneStreamSubscription<T>(onDone);
+ return _DoneStreamSubscription<T>(onDone);
}
- var subscription = new _BroadcastSubscription<T>(
+ var subscription = _BroadcastSubscription<T>(
this,
onData,
onError,
@@ -246,10 +246,10 @@
Error _addEventError() {
if (isClosed) {
- return new StateError("Cannot add new events after calling close");
+ return StateError("Cannot add new events after calling close");
}
assert(_isAddingStream);
- return new StateError("Cannot add new events while doing an addStream");
+ return StateError("Cannot add new events while doing an addStream");
}
void add(T data) {
@@ -280,11 +280,7 @@
Future addStream(Stream<T> stream, {bool? cancelOnError}) {
if (!_mayAddEvent) throw _addEventError();
_state |= _STATE_ADDSTREAM;
- var addStreamState = new _AddStreamState(
- this,
- stream,
- cancelOnError ?? false,
- );
+ var addStreamState = _AddStreamState(this, stream, cancelOnError ?? false);
_addStreamState = addStreamState;
return addStreamState.addStreamFuture;
}
@@ -311,7 +307,7 @@
void action(_BufferingStreamSubscription<T> subscription),
) {
if (_isFiring) {
- throw new StateError(
+ throw StateError(
"Cannot fire new event. Controller is already firing an event",
);
}
@@ -373,7 +369,7 @@
_addEventError() {
if (_isFiring) {
- return new StateError(
+ return StateError(
"Cannot fire new event. Controller is already firing an event",
);
}
@@ -429,7 +425,7 @@
subscription != null;
subscription = subscription._next
) {
- subscription._addPending(new _DelayedData<T>(data));
+ subscription._addPending(_DelayedData<T>(data));
}
}
@@ -439,7 +435,7 @@
subscription != null;
subscription = subscription._next
) {
- subscription._addPending(new _DelayedError(error, stackTrace));
+ subscription._addPending(_DelayedError(error, stackTrace));
}
}
@@ -481,12 +477,12 @@
}
void _addPendingEvent(_DelayedEvent event) {
- (_pending ??= new _PendingEvents<T>()).add(event);
+ (_pending ??= _PendingEvents<T>()).add(event);
}
void add(T data) {
if (!isClosed && _isFiring) {
- _addPendingEvent(new _DelayedData<T>(data));
+ _addPendingEvent(_DelayedData<T>(data));
return;
}
super.add(data);
@@ -497,7 +493,7 @@
if (!_mayAddEvent) throw _addEventError();
AsyncError(:error, :stackTrace) = _interceptUserError(error, stackTrace);
if (!isClosed && _isFiring) {
- _addPendingEvent(new _DelayedError(error, stackTrace));
+ _addPendingEvent(_DelayedError(error, stackTrace));
return;
}
_addError(error, stackTrace);
diff --git a/sdk/lib/async/future.dart b/sdk/lib/async/future.dart
index 7de71a0..4d69a8d 100644
--- a/sdk/lib/async/future.dart
+++ b/sdk/lib/async/future.dart
@@ -41,7 +41,7 @@
// Private generative constructor, so that it is not subclassable, mixable,
// or instantiable.
FutureOr._() {
- throw new UnsupportedError("FutureOr cannot be instantiated");
+ throw UnsupportedError("FutureOr cannot be instantiated");
}
}
@@ -235,7 +235,7 @@
static final _Future<void> _nullFuture = nullFuture as _Future<void>;
/// A `Future<bool>` completed with `false`.
- static final _Future<bool> _falseFuture = new _Future<bool>.zoneValue(
+ static final _Future<bool> _falseFuture = _Future<bool>.zoneValue(
false,
_rootZone,
);
@@ -253,7 +253,7 @@
/// If a non-future value is returned, the returned future is completed
/// with that value.
factory Future(FutureOr<T> computation()) {
- _Future<T> result = new _Future<T>();
+ _Future<T> result = _Future<T>();
Timer.run(() {
FutureOr<T> computationResult;
try {
@@ -280,7 +280,7 @@
/// If calling [computation] returns a non-future value,
/// the returned future is completed with that value.
factory Future.microtask(FutureOr<T> computation()) {
- _Future<T> result = new _Future<T>();
+ _Future<T> result = _Future<T>();
scheduleMicrotask(() {
FutureOr<T> computationResult;
try {
@@ -348,7 +348,7 @@
@pragma("vm:entry-point")
@pragma("vm:prefer-inline")
factory Future.value([FutureOr<T>? value]) {
- return new _Future<T>.immediate(value == null ? value as T : value);
+ return _Future<T>.immediate(value == null ? value as T : value);
}
/// Creates a future that completes with an error.
@@ -410,7 +410,7 @@
);
}
_Future<T> result = _Future<T>();
- new Timer(duration, () {
+ Timer(duration, () {
if (computation == null) {
result._complete(null as T);
} else {
@@ -612,7 +612,7 @@
/// }
/// ```
static Future<T> any<T>(Iterable<Future<T>> futures) {
- var completer = new Completer<T>.sync();
+ var completer = Completer<T>.sync();
void onValue(T value) {
if (!completer.isCompleted) completer.complete(value);
}
@@ -697,7 +697,7 @@
/// // Outputs: 'Finished with 3'
/// ```
static Future<void> doWhile(FutureOr<bool> action()) {
- _Future<void> doneSignal = new _Future<void>();
+ _Future<void> doneSignal = _Future<void>();
late void Function(bool) nextIteration;
// Bind this callback explicitly so that each iteration isn't bound in the
// context of all the previous iterations' callbacks.
@@ -1192,7 +1192,7 @@
/// completer.complete('completion value');
/// }
/// ```
- factory Completer() => new _AsyncCompleter<T>();
+ factory Completer() => _AsyncCompleter<T>();
/// Completes the future synchronously.
///
@@ -1243,7 +1243,7 @@
/// foo(); // In this case, foo() runs after bar().
/// });
/// ```
- factory Completer.sync() => new _SyncCompleter<T>();
+ factory Completer.sync() => _SyncCompleter<T>();
/// The future that is completed by this completer.
///
diff --git a/sdk/lib/async/future_impl.dart b/sdk/lib/async/future_impl.dart
index 5e4797c..5c9cf61 100644
--- a/sdk/lib/async/future_impl.dart
+++ b/sdk/lib/async/future_impl.dart
@@ -73,14 +73,14 @@
abstract class _Completer<T> implements Completer<T> {
@pragma("wasm:entry-point")
@pragma("vm:entry-point")
- final _Future<T> future = new _Future<T>();
+ final _Future<T> future = _Future<T>();
// Overridden by either a synchronous or asynchronous implementation.
void complete([FutureOr<T>? value]);
@pragma("wasm:entry-point")
void completeError(Object error, [StackTrace? stackTrace]) {
- if (!future._mayComplete) throw new StateError("Future already completed");
+ if (!future._mayComplete) throw StateError("Future already completed");
_completeErrorObject(_interceptUserError(error, stackTrace));
}
@@ -97,7 +97,7 @@
class _AsyncCompleter<T> extends _Completer<T> {
@pragma("wasm:entry-point")
void complete([FutureOr<T>? value]) {
- if (!future._mayComplete) throw new StateError("Future already completed");
+ if (!future._mayComplete) throw StateError("Future already completed");
future._asyncComplete(value == null ? value as dynamic : value);
}
@@ -112,7 +112,7 @@
@pragma("vm:entry-point")
class _SyncCompleter<T> extends _Completer<T> {
void complete([FutureOr<T>? value]) {
- if (!future._mayComplete) throw new StateError("Future already completed");
+ if (!future._mayComplete) throw StateError("Future already completed");
future._complete(value == null ? value as dynamic : value);
}
@@ -411,8 +411,8 @@
onError = _registerErrorHandler(onError, currentZone);
}
}
- _Future<R> result = new _Future<R>();
- _addListener(new _FutureListener<T, R>.then(result, f, onError));
+ _Future<R> result = _Future<R>();
+ _addListener(_FutureListener<T, R>.then(result, f, onError));
return result;
}
@@ -421,8 +421,8 @@
/// Used by the implementation of `await` to listen to a future.
/// The system created listeners are not registered in the zone.
Future<E> _thenAwait<E>(FutureOr<E> f(T value), Function onError) {
- _Future<E> result = new _Future<E>();
- _addListener(new _FutureListener<T, E>.thenAwait(result, f, onError));
+ _Future<E> result = _Future<E>();
+ _addListener(_FutureListener<T, E>.thenAwait(result, f, onError));
return result;
}
@@ -442,12 +442,12 @@
}
Future<T> catchError(Function onError, {bool test(Object error)?}) {
- _Future<T> result = new _Future<T>();
+ _Future<T> result = _Future<T>();
if (!identical(result._zone, _rootZone)) {
onError = _registerErrorHandler(onError, result._zone);
if (test != null) test = result._zone.registerUnaryCallback(test);
}
- _addListener(new _FutureListener<T, T>.catchError(result, onError, test));
+ _addListener(_FutureListener<T, T>.catchError(result, onError, test));
return result;
}
@@ -469,15 +469,15 @@
}
Future<T> whenComplete(dynamic action()) {
- _Future<T> result = new _Future<T>();
+ _Future<T> result = _Future<T>();
if (!identical(result._zone, _rootZone)) {
action = result._zone.registerCallback<dynamic>(action);
}
- _addListener(new _FutureListener<T, T>.whenComplete(result, action));
+ _addListener(_FutureListener<T, T>.whenComplete(result, action));
return result;
}
- Stream<T> asStream() => new Stream<T>.fromFuture(this);
+ Stream<T> asStream() => Stream<T>.fromFuture(this);
void _setPendingComplete() {
assert(_mayComplete); // Aka. _stateIncomplete
@@ -914,7 +914,7 @@
if (hasError && identical(source._error.error, e)) {
listenerValueOrError = source._error;
} else {
- listenerValueOrError = new AsyncError(e, s);
+ listenerValueOrError = AsyncError(e, s);
}
listenerHasError = true;
return;
@@ -950,7 +950,7 @@
try {
listenerValueOrError = listener.handleValue(sourceResult);
} catch (e, s) {
- listenerValueOrError = new AsyncError(e, s);
+ listenerValueOrError = AsyncError(e, s);
listenerHasError = true;
}
}
@@ -967,7 +967,7 @@
if (identical(source._error.error, e)) {
listenerValueOrError = source._error;
} else {
- listenerValueOrError = new AsyncError(e, s);
+ listenerValueOrError = AsyncError(e, s);
}
listenerHasError = true;
}
@@ -1033,15 +1033,15 @@
@pragma("vm:entry-point")
Future<T> timeout(Duration timeLimit, {FutureOr<T> onTimeout()?}) {
- if (_isComplete) return new _Future.immediate(this);
+ if (_isComplete) return _Future.immediate(this);
@pragma('vm:awaiter-link')
- _Future<T> _future = new _Future<T>();
+ _Future<T> _future = _Future<T>();
Timer timer;
if (onTimeout == null) {
- timer = new Timer(timeLimit, () {
+ timer = Timer(timeLimit, () {
_future._completeErrorObject(
AsyncError(
- new TimeoutException("Future not completed", timeLimit),
+ TimeoutException("Future not completed", timeLimit),
StackTrace.current,
),
);
@@ -1052,7 +1052,7 @@
onTimeout,
);
- timer = new Timer(timeLimit, () {
+ timer = Timer(timeLimit, () {
try {
_future._complete(zone.run(onTimeoutHandler));
} catch (e, s) {
diff --git a/sdk/lib/async/schedule_microtask.dart b/sdk/lib/async/schedule_microtask.dart
index 4245d6c..25e7c03 100644
--- a/sdk/lib/async/schedule_microtask.dart
+++ b/sdk/lib/async/schedule_microtask.dart
@@ -61,7 +61,7 @@
/// The microtask is called after all other currently scheduled
/// microtasks, but as part of the current system event.
void _scheduleAsyncCallback(_AsyncCallback callback) {
- _AsyncCallbackEntry newEntry = new _AsyncCallbackEntry(callback);
+ _AsyncCallbackEntry newEntry = _AsyncCallbackEntry(callback);
_AsyncCallbackEntry? lastCallback = _lastCallback;
if (lastCallback == null) {
_nextCallback = _lastCallback = newEntry;
@@ -86,7 +86,7 @@
_lastPriorityCallback = _lastCallback;
return;
}
- _AsyncCallbackEntry entry = new _AsyncCallbackEntry(callback);
+ _AsyncCallbackEntry entry = _AsyncCallbackEntry(callback);
_AsyncCallbackEntry? lastPriorityCallback = _lastPriorityCallback;
if (lastPriorityCallback == null) {
entry.next = _nextCallback;
diff --git a/sdk/lib/async/stream.dart b/sdk/lib/async/stream.dart
index 265d71f..4c5f5ee 100644
--- a/sdk/lib/async/stream.dart
+++ b/sdk/lib/async/stream.dart
@@ -241,7 +241,7 @@
// Use the controller's buffering to fill in the value even before
// the stream has a listener. For a single value, it's not worth it
// to wait for a listener before doing the `then` on the future.
- _StreamController<T> controller = new _SyncStreamController<T>(
+ _StreamController<T> controller = _SyncStreamController<T>(
null,
null,
null,
@@ -295,7 +295,7 @@
/// // "Done" when stream completed.
/// ```
factory Stream.fromFutures(Iterable<Future<T>> futures) {
- _StreamController<T> controller = new _SyncStreamController<T>(
+ _StreamController<T> controller = _SyncStreamController<T>(
null,
null,
null,
@@ -511,7 +511,7 @@
}
var controller = _SyncStreamController<T>(null, null, null, null);
// Counts the time that the Stream was running (and not paused).
- Stopwatch watch = new Stopwatch();
+ Stopwatch watch = Stopwatch();
controller.onListen = () {
int computationCount = 0;
void sendEvent(_) {
@@ -544,7 +544,7 @@
..onResume = () {
Duration elapsed = watch.elapsed;
watch.start();
- timer = new Timer(period - elapsed, () {
+ timer = Timer(period - elapsed, () {
timer = Timer.periodic(period, sendEvent);
sendEvent(null);
});
@@ -595,7 +595,7 @@
Stream<dynamic> source,
EventSink<dynamic> mapSink(EventSink<T> sink),
) {
- return new _BoundSinkStream(source, mapSink);
+ return _BoundSinkStream(source, mapSink);
}
/// Adapts [source] to be a `Stream<T>`.
@@ -604,8 +604,7 @@
/// must satisfy the requirements of both the new type and its original type.
///
/// Data events created by the source stream must also be instances of [T].
- static Stream<T> castFrom<S, T>(Stream<S> source) =>
- new CastStream<S, T>(source);
+ static Stream<T> castFrom<S, T>(Stream<S> source) => CastStream<S, T>(source);
/// Whether this stream is a broadcast stream.
bool get isBroadcast => false;
@@ -683,7 +682,7 @@
void onListen(StreamSubscription<T> subscription)?,
void onCancel(StreamSubscription<T> subscription)?,
}) {
- return new _AsBroadcastStream<T>(this, onListen, onCancel);
+ return _AsBroadcastStream<T>(this, onListen, onCancel);
}
/// Adds a subscription to this stream.
@@ -750,7 +749,7 @@
/// customStream.listen(print); // Outputs event values: 4,5,6.
/// ```
Stream<T> where(bool test(T event)) {
- return new _WhereStream<T>(this, test);
+ return _WhereStream<T>(this, test);
}
/// Transforms each element of this stream into a new stream event.
@@ -794,7 +793,7 @@
/// // Square: 16
/// ```
Stream<S> map<S>(S convert(T event)) {
- return new _MapStream<T, S>(this, convert);
+ return _MapStream<T, S>(this, convert);
}
/// Creates a new stream with each data event of this stream asynchronously
@@ -969,7 +968,7 @@
" as arguments.",
);
}
- return new _HandleErrorStream<T>(this, callback, test);
+ return _HandleErrorStream<T>(this, callback, test);
}
/// Transforms each element of this stream into a sequence of elements.
@@ -990,7 +989,7 @@
/// If a broadcast stream is listened to more than once, each subscription
/// will individually call `convert` and expand the events.
Stream<S> expand<S>(Iterable<S> convert(T element)) {
- return new _ExpandStream<T, S>(this, convert);
+ return _ExpandStream<T, S>(this, convert);
}
/// Pipes the events of this stream into [streamConsumer].
@@ -1065,7 +1064,7 @@
/// print(result); // 28
/// ```
Future<T> reduce(T combine(T previous, T element)) {
- _Future<T> result = new _Future<T>();
+ _Future<T> result = _Future<T>();
bool seenFirst = false;
late T value;
StreamSubscription<T> subscription = this.listen(
@@ -1119,7 +1118,7 @@
/// print(result); // 38
/// ```
Future<S> fold<S>(S initialValue, S combine(S previous, T element)) {
- _Future<S> result = new _Future<S>();
+ _Future<S> result = _Future<S>();
S value = initialValue;
StreamSubscription<T> subscription = this.listen(
null,
@@ -1157,8 +1156,8 @@
/// print(result); // 'Mars--Venus--Earth'
/// ```
Future<String> join([String separator = ""]) {
- _Future<String> result = new _Future<String>();
- StringBuffer buffer = new StringBuffer();
+ _Future<String> result = _Future<String>();
+ StringBuffer buffer = StringBuffer();
bool first = true;
StreamSubscription<T> subscription = this.listen(
null,
@@ -1210,7 +1209,7 @@
/// print(result); // true
/// ```
Future<bool> contains(Object? needle) {
- _Future<bool> future = new _Future<bool>();
+ _Future<bool> future = _Future<bool>();
StreamSubscription<T> subscription = this.listen(
null,
onError: future._completeError,
@@ -1238,7 +1237,7 @@
/// the returned future completes with that error,
/// and processing stops.
Future<void> forEach(void action(T element)) {
- _Future future = new _Future();
+ _Future future = _Future();
StreamSubscription<T> subscription = this.listen(
null,
onError: future._completeError,
@@ -1279,7 +1278,7 @@
/// print(result); // false
/// ```
Future<bool> every(bool test(T element)) {
- _Future<bool> future = new _Future<bool>();
+ _Future<bool> future = _Future<bool>();
StreamSubscription<T> subscription = this.listen(
null,
onError: future._completeError,
@@ -1321,7 +1320,7 @@
/// print(result); // true
/// ```
Future<bool> any(bool test(T element)) {
- _Future<bool> future = new _Future<bool>();
+ _Future<bool> future = _Future<bool>();
StreamSubscription<T> subscription = this.listen(
null,
onError: future._completeError,
@@ -1352,7 +1351,7 @@
/// This operation listens to this stream, and a non-broadcast stream cannot
/// be reused after finding its length.
Future<int> get length {
- _Future<int> future = new _Future<int>();
+ _Future<int> future = _Future<int>();
int count = 0;
this.listen(
(_) {
@@ -1380,7 +1379,7 @@
/// This operation listens to this stream, and a non-broadcast stream cannot
/// be reused after checking whether it is empty.
Future<bool> get isEmpty {
- _Future<bool> future = new _Future<bool>();
+ _Future<bool> future = _Future<bool>();
StreamSubscription<T> subscription = this.listen(
null,
onError: future._completeError,
@@ -1412,7 +1411,7 @@
/// and processing stops.
Future<List<T>> toList() {
List<T> result = <T>[];
- _Future<List<T>> future = new _Future<List<T>>();
+ _Future<List<T>> future = _Future<List<T>>();
this.listen(
(T data) {
result.add(data);
@@ -1442,8 +1441,8 @@
/// the returned future is completed with that error,
/// and processing stops.
Future<Set<T>> toSet() {
- Set<T> result = new Set<T>();
- _Future<Set<T>> future = new _Future<Set<T>>();
+ Set<T> result = Set<T>();
+ _Future<Set<T>> future = _Future<Set<T>>();
this.listen(
(T data) {
result.add(data);
@@ -1512,7 +1511,7 @@
/// stream.forEach(print); // Outputs events: 0, ... 59.
/// ```
Stream<T> take(int count) {
- return new _TakeStream<T>(this, count);
+ return _TakeStream<T>(this, count);
}
/// Forwards data events while [test] is successful.
@@ -1543,7 +1542,7 @@
/// stream.forEach(print); // Outputs events: 0, ..., 5.
/// ```
Stream<T> takeWhile(bool test(T element)) {
- return new _TakeWhileStream<T>(this, test);
+ return _TakeWhileStream<T>(this, test);
}
/// Skips the first [count] data events from this stream.
@@ -1567,7 +1566,7 @@
/// stream.forEach(print); // Skips events 0, ..., 6. Outputs events: 7, ...
/// ```
Stream<T> skip(int count) {
- return new _SkipStream<T>(this, count);
+ return _SkipStream<T>(this, count);
}
/// Skip data events from this stream while they are matched by [test].
@@ -1595,7 +1594,7 @@
/// stream.forEach(print); // Outputs events: 5, ..., 9.
/// ```
Stream<T> skipWhile(bool test(T element)) {
- return new _SkipWhileStream<T>(this, test);
+ return _SkipWhileStream<T>(this, test);
}
/// Skips data events if they are equal to the previous data event.
@@ -1624,7 +1623,7 @@
/// stream.forEach(print); // Outputs events: 2,6,8,12,8,2.
/// ```
Stream<T> distinct([bool equals(T previous, T next)?]) {
- return new _DistinctStream<T>(this, equals);
+ return _DistinctStream<T>(this, equals);
}
/// The first element of this stream.
@@ -1644,7 +1643,7 @@
/// Except for the type of the error, this method is equivalent to
/// `this.elementAt(0)`.
Future<T> get first {
- _Future<T> future = new _Future<T>();
+ _Future<T> future = _Future<T>();
StreamSubscription<T> subscription = this.listen(
null,
onError: future._completeError,
@@ -1671,7 +1670,7 @@
/// If this stream is empty (the done event is the first event),
/// the returned future completes with an error.
Future<T> get last {
- _Future<T> future = new _Future<T>();
+ _Future<T> future = _Future<T>();
late T result;
bool foundResult = false;
listen(
@@ -1704,7 +1703,7 @@
/// If this [Stream] is empty or has more than one element,
/// the returned future completes with an error.
Future<T> get single {
- _Future<T> future = new _Future<T>();
+ _Future<T> future = _Future<T>();
late T result;
bool foundResult = false;
StreamSubscription<T> subscription = this.listen(
@@ -1774,7 +1773,7 @@
/// print(result); // -1
/// ```
Future<T> firstWhere(bool test(T element), {T orElse()?}) {
- _Future<T> future = new _Future();
+ _Future<T> future = _Future();
StreamSubscription<T> subscription = this.listen(
null,
onError: future._completeError,
@@ -1827,7 +1826,7 @@
/// print(result); // -1
/// ```
Future<T> lastWhere(bool test(T element), {T orElse()?}) {
- _Future<T> future = new _Future();
+ _Future<T> future = _Future();
late T result;
bool foundResult = false;
StreamSubscription<T> subscription = this.listen(
@@ -1894,7 +1893,7 @@
/// // Throws.
/// ```
Future<T> singleWhere(bool test(T element), {T orElse()?}) {
- _Future<T> future = new _Future<T>();
+ _Future<T> future = _Future<T>();
late T result;
bool foundResult = false;
StreamSubscription<T> subscription = this.listen(
@@ -1951,7 +1950,7 @@
/// with a [RangeError].
Future<T> elementAt(int index) {
RangeError.checkNotNegative(index, "index");
- _Future<T> result = new _Future<T>();
+ _Future<T> result = _Future<T>();
int elementIndex = 0;
StreamSubscription<T> subscription;
subscription = this.listen(
@@ -1959,7 +1958,7 @@
onError: result._completeError,
onDone: () {
result._completeError(
- new IndexError.withLength(
+ IndexError.withLength(
index,
elementIndex,
indexable: this,
@@ -2035,9 +2034,9 @@
Stream<T> timeout(Duration timeLimit, {void onTimeout(EventSink<T> sink)?}) {
_StreamControllerBase<T> controller;
if (isBroadcast) {
- controller = new _SyncBroadcastStreamController<T>(null, null);
+ controller = _SyncBroadcastStreamController<T>(null, null);
} else {
- controller = new _SyncStreamController<T>(null, null, null, null);
+ controller = _SyncStreamController<T>(null, null, null, null);
}
Zone zone = Zone.current;
@@ -2046,7 +2045,7 @@
if (onTimeout == null) {
timeoutCallback = () {
controller.addError(
- new TimeoutException("No stream event", timeLimit),
+ TimeoutException("No stream event", timeLimit),
null,
);
};
@@ -2054,7 +2053,7 @@
var registeredOnTimeout = zone.registerUnaryCallback<void, EventSink<T>>(
onTimeout,
);
- var wrapper = new _ControllerEventSinkWrapper<T>(null);
+ var wrapper = _ControllerEventSinkWrapper<T>(null);
timeoutCallback = () {
wrapper._sink = controller; // Only valid during call.
zone.runUnaryGuarded(registeredOnTimeout, wrapper);
@@ -2626,7 +2625,7 @@
static StreamTransformer<TS, TT> castFrom<SS, ST, TS, TT>(
StreamTransformer<SS, ST> source,
) {
- return new CastStreamTransformer<SS, ST, TS, TT>(source);
+ return CastStreamTransformer<SS, ST, TS, TT>(source);
}
/// Transforms the provided [stream].
@@ -2692,7 +2691,7 @@
factory StreamIterator(Stream<T> stream) =>
// TODO(lrn): use redirecting factory constructor when type
// arguments are supported.
- new _StreamIterator<T>(stream);
+ _StreamIterator<T>(stream);
/// Wait for the next stream value to be available.
///
diff --git a/sdk/lib/async/stream_transformers.dart b/sdk/lib/async/stream_transformers.dart
index 407f50b..491ddc0 100644
--- a/sdk/lib/async/stream_transformers.dart
+++ b/sdk/lib/async/stream_transformers.dart
@@ -74,7 +74,7 @@
/// error.
void _addError(Object error, StackTrace stackTrace) {
if (_isClosed) {
- throw new StateError("Stream is already closed");
+ throw StateError("Stream is already closed");
}
super._addError(error, stackTrace);
}
@@ -86,7 +86,7 @@
/// error.
void _close() {
if (_isClosed) {
- throw new StateError("Stream is already closed");
+ throw StateError("Stream is already closed");
}
super._close();
}
@@ -153,7 +153,7 @@
const _StreamSinkTransformer(this._sinkMapper);
Stream<T> bind(Stream<S> stream) =>
- new _BoundSinkStream<S, T>(stream, _sinkMapper);
+ _BoundSinkStream<S, T>(stream, _sinkMapper);
}
/// The result of binding a [StreamTransformer] for [Sink]-mappers.
@@ -269,7 +269,7 @@
void handleError(Object error, StackTrace stackTrace, EventSink<T> sink)?,
void handleDone(EventSink<T> sink)?,
}) : super((EventSink<T> outputSink) {
- return new _HandlerEventSink<S, T>(
+ return _HandlerEventSink<S, T>(
handleData,
handleError,
handleDone,
@@ -312,7 +312,7 @@
const _StreamSubscriptionTransformer(this._onListen);
Stream<T> bind(Stream<S> stream) =>
- new _BoundSubscriptionStream<S, T>(stream, _onListen);
+ _BoundSubscriptionStream<S, T>(stream, _onListen);
}
/// A stream transformed by a [_StreamSubscriptionTransformer].
diff --git a/sdk/lib/async/timer.dart b/sdk/lib/async/timer.dart
index 5ff3711..242182a 100644
--- a/sdk/lib/async/timer.dart
+++ b/sdk/lib/async/timer.dart
@@ -104,7 +104,7 @@
/// Timer.run(() => print('timer run'));
/// ```
static void run(void Function() callback) {
- new Timer(Duration.zero, callback);
+ Timer(Duration.zero, callback);
}
/// Cancels the timer.
diff --git a/sdk/lib/core/stacktrace.dart b/sdk/lib/core/stacktrace.dart
index a4cd037..b2f8688 100644
--- a/sdk/lib/core/stacktrace.dart
+++ b/sdk/lib/core/stacktrace.dart
@@ -16,7 +16,7 @@
///
/// This stack trace is used as the default in situations where
/// a stack trace is required, but the user has not supplied one.
- static const empty = const _StringStackTrace("");
+ static const empty = _StringStackTrace("");
StackTrace(); // In case existing classes extend StackTrace.
diff --git a/sdk/lib/internal/async_cast.dart b/sdk/lib/internal/async_cast.dart
index bd5ccd5..3ecabaa 100644
--- a/sdk/lib/internal/async_cast.dart
+++ b/sdk/lib/internal/async_cast.dart
@@ -17,14 +17,14 @@
void Function()? onDone,
bool? cancelOnError,
}) {
- return new CastStreamSubscription<S, T>(
+ return CastStreamSubscription<S, T>(
_source.listen(null, onDone: onDone, cancelOnError: cancelOnError),
)
..onData(onData)
..onError(onError);
}
- Stream<R> cast<R>() => new CastStream<S, R>(_source);
+ Stream<R> cast<R>() => CastStream<S, R>(_source);
}
class CastStreamSubscription<S, T> implements StreamSubscription<T> {
@@ -115,7 +115,7 @@
CastStreamTransformer(this._source);
StreamTransformer<RS, RT> cast<RS, RT>() =>
- new CastStreamTransformer<SS, ST, RS, RT>(_source);
+ CastStreamTransformer<SS, ST, RS, RT>(_source);
Stream<TT> bind(Stream<TS> stream) =>
_source.bind(stream.cast<SS>()).cast<TT>();
}
@@ -131,6 +131,5 @@
Stream<TT> bind(Stream<TS> stream) =>
_source.bind(stream.cast<SS>()).cast<TT>();
- Converter<RS, RT> cast<RS, RT>() =>
- new CastConverter<SS, ST, RS, RT>(_source);
+ Converter<RS, RT> cast<RS, RT>() => CastConverter<SS, ST, RS, RT>(_source);
}
diff --git a/sdk/lib/internal/cast.dart b/sdk/lib/internal/cast.dart
index 61436cc..8de023f 100644
--- a/sdk/lib/internal/cast.dart
+++ b/sdk/lib/internal/cast.dart
@@ -9,7 +9,7 @@
abstract class _CastIterableBase<S, T> extends Iterable<T> {
Iterable<S> get _source;
- Iterator<T> get iterator => new CastIterator<S, T>(_source.iterator);
+ Iterator<T> get iterator => CastIterator<S, T>(_source.iterator);
// The following members use the default implementation on the
// throwing iterator. These are all operations that have no more efficient
@@ -36,8 +36,8 @@
bool get isEmpty => _source.isEmpty;
bool get isNotEmpty => _source.isNotEmpty;
- Iterable<T> skip(int count) => new CastIterable<S, T>(_source.skip(count));
- Iterable<T> take(int count) => new CastIterable<S, T>(_source.take(count));
+ Iterable<T> skip(int count) => CastIterable<S, T>(_source.skip(count));
+ Iterable<T> take(int count) => CastIterable<S, T>(_source.take(count));
T elementAt(int index) => _source.elementAt(index) as T;
T get first => _source.first as T;
@@ -72,12 +72,12 @@
factory CastIterable(Iterable<S> source) {
if (source is EfficientLengthIterable<S>) {
- return new _EfficientLengthCastIterable<S, T>(source);
+ return _EfficientLengthCastIterable<S, T>(source);
}
- return new CastIterable<S, T>._(source);
+ return CastIterable<S, T>._(source);
}
- Iterable<R> cast<R>() => new CastIterable<S, R>(_source);
+ Iterable<R> cast<R>() => CastIterable<S, R>(_source);
}
class _EfficientLengthCastIterable<S, T> extends CastIterable<S, T>
@@ -114,7 +114,7 @@
}
void addAll(Iterable<T> values) {
- _source.addAll(new CastIterable<T, S>(values));
+ _source.addAll(CastIterable<T, S>(values));
}
void sort([int Function(T v1, T v2)? compare]) {
@@ -132,11 +132,11 @@
}
void insertAll(int index, Iterable<T> elements) {
- _source.insertAll(index, new CastIterable<T, S>(elements));
+ _source.insertAll(index, CastIterable<T, S>(elements));
}
void setAll(int index, Iterable<T> elements) {
- _source.setAll(index, new CastIterable<T, S>(elements));
+ _source.setAll(index, CastIterable<T, S>(elements));
}
bool remove(Object? value) => _source.remove(value);
@@ -154,10 +154,10 @@
}
Iterable<T> getRange(int start, int end) =>
- new CastIterable<S, T>(_source.getRange(start, end));
+ CastIterable<S, T>(_source.getRange(start, end));
void setRange(int start, int end, Iterable<T> iterable, [int skipCount = 0]) {
- _source.setRange(start, end, new CastIterable<T, S>(iterable), skipCount);
+ _source.setRange(start, end, CastIterable<T, S>(iterable), skipCount);
}
void removeRange(int start, int end) {
@@ -169,7 +169,7 @@
}
void replaceRange(int start, int end, Iterable<T> replacement) {
- _source.replaceRange(start, end, new CastIterable<T, S>(replacement));
+ _source.replaceRange(start, end, CastIterable<T, S>(replacement));
}
}
@@ -177,7 +177,7 @@
final List<S> _source;
CastList(this._source);
- List<R> cast<R>() => new CastList<S, R>(_source);
+ List<R> cast<R>() => CastList<S, R>(_source);
}
class CastSet<S, T> extends _CastIterableBase<S, T> implements Set<T> {
@@ -190,11 +190,11 @@
CastSet(this._source, this._emptySet);
- Set<R> cast<R>() => new CastSet<S, R>(_source, _emptySet);
+ Set<R> cast<R>() => CastSet<S, R>(_source, _emptySet);
bool add(T value) => _source.add(value as S);
void addAll(Iterable<T> elements) {
- _source.addAll(new CastIterable<T, S>(elements));
+ _source.addAll(CastIterable<T, S>(elements));
}
bool remove(Object? object) => _source.remove(object);
@@ -219,17 +219,17 @@
Set<T> intersection(Set<Object?> other) {
if (_emptySet != null) return _conditionalAdd(other, true);
- return new CastSet<S, T>(_source.intersection(other), null);
+ return CastSet<S, T>(_source.intersection(other), null);
}
Set<T> difference(Set<Object?> other) {
if (_emptySet != null) return _conditionalAdd(other, false);
- return new CastSet<S, T>(_source.difference(other), null);
+ return CastSet<S, T>(_source.difference(other), null);
}
Set<T> _conditionalAdd(Set<Object?> other, bool otherContains) {
var emptySet = _emptySet;
- Set<T> result = (emptySet == null) ? new Set<T>() : emptySet<T>();
+ Set<T> result = (emptySet == null) ? Set<T>() : emptySet<T>();
for (var element in _source) {
T castElement = element as T;
if (otherContains == other.contains(castElement)) result.add(castElement);
@@ -245,7 +245,7 @@
Set<T> _clone() {
var emptySet = _emptySet;
- Set<T> result = (emptySet == null) ? new Set<T>() : emptySet<T>();
+ Set<T> result = (emptySet == null) ? Set<T>() : emptySet<T>();
result.addAll(this);
return result;
}
@@ -260,7 +260,7 @@
CastMap(this._source);
- Map<RK, RV> cast<RK, RV>() => new CastMap<SK, SV, RK, RV>(_source);
+ Map<RK, RV> cast<RK, RV>() => CastMap<SK, SV, RK, RV>(_source);
bool containsValue(Object? value) => _source.containsValue(value);
@@ -276,7 +276,7 @@
_source.putIfAbsent(key as SK, () => ifAbsent() as SV) as V;
void addAll(Map<K, V> other) {
- _source.addAll(new CastMap<K, V, SK, SV>(other));
+ _source.addAll(CastMap<K, V, SK, SV>(other));
}
V? remove(Object? key) => _source.remove(key) as V?;
@@ -291,9 +291,9 @@
});
}
- Iterable<K> get keys => new CastIterable<SK, K>(_source.keys);
+ Iterable<K> get keys => CastIterable<SK, K>(_source.keys);
- Iterable<V> get values => new CastIterable<SV, V>(_source.values);
+ Iterable<V> get values => CastIterable<SV, V>(_source.values);
int get length => _source.length;
@@ -316,7 +316,7 @@
Iterable<MapEntry<K, V>> get entries {
return _source.entries.map<MapEntry<K, V>>(
- (MapEntry<SK, SV> e) => new MapEntry<K, V>(e.key as K, e.value as V),
+ (MapEntry<SK, SV> e) => MapEntry<K, V>(e.key as K, e.value as V),
);
}
@@ -334,7 +334,7 @@
class CastQueue<S, T> extends _CastIterableBase<S, T> implements Queue<T> {
final Queue<S> _source;
CastQueue(this._source);
- Queue<R> cast<R>() => new CastQueue<S, R>(_source);
+ Queue<R> cast<R>() => CastQueue<S, R>(_source);
T removeFirst() => _source.removeFirst() as T;
T removeLast() => _source.removeLast() as T;
@@ -353,7 +353,7 @@
bool remove(Object? other) => _source.remove(other);
void addAll(Iterable<T> elements) {
- _source.addAll(new CastIterable<T, S>(elements));
+ _source.addAll(CastIterable<T, S>(elements));
}
void removeWhere(bool test(T element)) {
diff --git a/sdk/lib/internal/internal.dart b/sdk/lib/internal/internal.dart
index 6ba8eb9..231592e 100644
--- a/sdk/lib/internal/internal.dart
+++ b/sdk/lib/internal/internal.dart
@@ -57,7 +57,7 @@
// Powers of 10 up to 10^22 are representable as doubles.
// Powers of 10 above that are only approximate due to lack of precision.
// Used by double-parsing.
-const POWERS_OF_TEN = const [
+const POWERS_OF_TEN = [
1.0, // 0
10.0,
100.0,
@@ -742,7 +742,7 @@
}
/// A default value to use when only one sentinel is needed.
-const Object sentinelValue = const SentinelValue(0);
+const Object sentinelValue = SentinelValue(0);
/// Given an [instance] of some generic type [T], and [extract], a first-class
/// generic function that takes the same number of type parameters as [T],
diff --git a/sdk/lib/internal/linked_list.dart b/sdk/lib/internal/linked_list.dart
index 598f583..bd2ea92 100644
--- a/sdk/lib/internal/linked_list.dart
+++ b/sdk/lib/internal/linked_list.dart
@@ -75,7 +75,7 @@
node._list = null;
}
- Iterator<T> get iterator => new _LinkedListIterator<T>(this);
+ Iterator<T> get iterator => _LinkedListIterator<T>(this);
}
class LinkedListEntry<T extends LinkedListEntry<T>> {
diff --git a/sdk/lib/internal/list.dart b/sdk/lib/internal/list.dart
index 3f0e3b5..42d35ac 100644
--- a/sdk/lib/internal/list.dart
+++ b/sdk/lib/internal/list.dart
@@ -12,69 +12,67 @@
mixin FixedLengthListMixin<E> {
/** This operation is not supported by a fixed length list. */
set length(int newLength) {
- throw new UnsupportedError(
- "Cannot change the length of a fixed-length list",
- );
+ throw UnsupportedError("Cannot change the length of a fixed-length list");
}
/** This operation is not supported by a fixed length list. */
void add(E value) {
- throw new UnsupportedError("Cannot add to a fixed-length list");
+ throw UnsupportedError("Cannot add to a fixed-length list");
}
/** This operation is not supported by a fixed length list. */
void insert(int index, E value) {
- throw new UnsupportedError("Cannot add to a fixed-length list");
+ throw UnsupportedError("Cannot add to a fixed-length list");
}
/** This operation is not supported by a fixed length list. */
void insertAll(int at, Iterable<E> iterable) {
- throw new UnsupportedError("Cannot add to a fixed-length list");
+ throw UnsupportedError("Cannot add to a fixed-length list");
}
/** This operation is not supported by a fixed length list. */
void addAll(Iterable<E> iterable) {
- throw new UnsupportedError("Cannot add to a fixed-length list");
+ throw UnsupportedError("Cannot add to a fixed-length list");
}
/** This operation is not supported by a fixed length list. */
bool remove(Object? element) {
- throw new UnsupportedError("Cannot remove from a fixed-length list");
+ throw UnsupportedError("Cannot remove from a fixed-length list");
}
/** This operation is not supported by a fixed length list. */
void removeWhere(bool test(E element)) {
- throw new UnsupportedError("Cannot remove from a fixed-length list");
+ throw UnsupportedError("Cannot remove from a fixed-length list");
}
/** This operation is not supported by a fixed length list. */
void retainWhere(bool test(E element)) {
- throw new UnsupportedError("Cannot remove from a fixed-length list");
+ throw UnsupportedError("Cannot remove from a fixed-length list");
}
/** This operation is not supported by a fixed length list. */
void clear() {
- throw new UnsupportedError("Cannot clear a fixed-length list");
+ throw UnsupportedError("Cannot clear a fixed-length list");
}
/** This operation is not supported by a fixed length list. */
E removeAt(int index) {
- throw new UnsupportedError("Cannot remove from a fixed-length list");
+ throw UnsupportedError("Cannot remove from a fixed-length list");
}
/** This operation is not supported by a fixed length list. */
E removeLast() {
- throw new UnsupportedError("Cannot remove from a fixed-length list");
+ throw UnsupportedError("Cannot remove from a fixed-length list");
}
/** This operation is not supported by a fixed length list. */
void removeRange(int start, int end) {
- throw new UnsupportedError("Cannot remove from a fixed-length list");
+ throw UnsupportedError("Cannot remove from a fixed-length list");
}
/** This operation is not supported by a fixed length list. */
void replaceRange(int start, int end, Iterable<E> iterable) {
- throw new UnsupportedError("Cannot remove from a fixed-length list");
+ throw UnsupportedError("Cannot remove from a fixed-length list");
}
}
@@ -88,107 +86,105 @@
mixin UnmodifiableListMixin<E> implements List<E> {
/** This operation is not supported by an unmodifiable list. */
void operator []=(int index, E value) {
- throw new UnsupportedError("Cannot modify an unmodifiable list");
+ throw UnsupportedError("Cannot modify an unmodifiable list");
}
/** This operation is not supported by an unmodifiable list. */
set length(int newLength) {
- throw new UnsupportedError(
- "Cannot change the length of an unmodifiable list",
- );
+ throw UnsupportedError("Cannot change the length of an unmodifiable list");
}
set first(E element) {
- throw new UnsupportedError("Cannot modify an unmodifiable list");
+ throw UnsupportedError("Cannot modify an unmodifiable list");
}
set last(E element) {
- throw new UnsupportedError("Cannot modify an unmodifiable list");
+ throw UnsupportedError("Cannot modify an unmodifiable list");
}
/** This operation is not supported by an unmodifiable list. */
void setAll(int at, Iterable<E> iterable) {
- throw new UnsupportedError("Cannot modify an unmodifiable list");
+ throw UnsupportedError("Cannot modify an unmodifiable list");
}
/** This operation is not supported by an unmodifiable list. */
void add(E value) {
- throw new UnsupportedError("Cannot add to an unmodifiable list");
+ throw UnsupportedError("Cannot add to an unmodifiable list");
}
/** This operation is not supported by an unmodifiable list. */
void insert(int index, E element) {
- throw new UnsupportedError("Cannot add to an unmodifiable list");
+ throw UnsupportedError("Cannot add to an unmodifiable list");
}
/** This operation is not supported by an unmodifiable list. */
void insertAll(int at, Iterable<E> iterable) {
- throw new UnsupportedError("Cannot add to an unmodifiable list");
+ throw UnsupportedError("Cannot add to an unmodifiable list");
}
/** This operation is not supported by an unmodifiable list. */
void addAll(Iterable<E> iterable) {
- throw new UnsupportedError("Cannot add to an unmodifiable list");
+ throw UnsupportedError("Cannot add to an unmodifiable list");
}
/** This operation is not supported by an unmodifiable list. */
bool remove(Object? element) {
- throw new UnsupportedError("Cannot remove from an unmodifiable list");
+ throw UnsupportedError("Cannot remove from an unmodifiable list");
}
/** This operation is not supported by an unmodifiable list. */
void removeWhere(bool test(E element)) {
- throw new UnsupportedError("Cannot remove from an unmodifiable list");
+ throw UnsupportedError("Cannot remove from an unmodifiable list");
}
/** This operation is not supported by an unmodifiable list. */
void retainWhere(bool test(E element)) {
- throw new UnsupportedError("Cannot remove from an unmodifiable list");
+ throw UnsupportedError("Cannot remove from an unmodifiable list");
}
/** This operation is not supported by an unmodifiable list. */
void sort([Comparator<E>? compare]) {
- throw new UnsupportedError("Cannot modify an unmodifiable list");
+ throw UnsupportedError("Cannot modify an unmodifiable list");
}
/** This operation is not supported by an unmodifiable list. */
void shuffle([Random? random]) {
- throw new UnsupportedError("Cannot modify an unmodifiable list");
+ throw UnsupportedError("Cannot modify an unmodifiable list");
}
/** This operation is not supported by an unmodifiable list. */
void clear() {
- throw new UnsupportedError("Cannot clear an unmodifiable list");
+ throw UnsupportedError("Cannot clear an unmodifiable list");
}
/** This operation is not supported by an unmodifiable list. */
E removeAt(int index) {
- throw new UnsupportedError("Cannot remove from an unmodifiable list");
+ throw UnsupportedError("Cannot remove from an unmodifiable list");
}
/** This operation is not supported by an unmodifiable list. */
E removeLast() {
- throw new UnsupportedError("Cannot remove from an unmodifiable list");
+ throw UnsupportedError("Cannot remove from an unmodifiable list");
}
/** This operation is not supported by an unmodifiable list. */
void setRange(int start, int end, Iterable<E> iterable, [int skipCount = 0]) {
- throw new UnsupportedError("Cannot modify an unmodifiable list");
+ throw UnsupportedError("Cannot modify an unmodifiable list");
}
/** This operation is not supported by an unmodifiable list. */
void removeRange(int start, int end) {
- throw new UnsupportedError("Cannot remove from an unmodifiable list");
+ throw UnsupportedError("Cannot remove from an unmodifiable list");
}
/** This operation is not supported by an unmodifiable list. */
void replaceRange(int start, int end, Iterable<E> iterable) {
- throw new UnsupportedError("Cannot remove from an unmodifiable list");
+ throw UnsupportedError("Cannot remove from an unmodifiable list");
}
/** This operation is not supported by an unmodifiable list. */
void fillRange(int start, int end, [E? fillValue]) {
- throw new UnsupportedError("Cannot modify an unmodifiable list");
+ throw UnsupportedError("Cannot modify an unmodifiable list");
}
}
@@ -230,8 +226,8 @@
E? operator [](Object? key) => containsKey(key) ? _values[key as int] : null;
int get length => _values.length;
- Iterable<E> get values => new SubListIterable<E>(_values, 0, null);
- Iterable<int> get keys => new _ListIndicesIterable(_values);
+ Iterable<E> get values => SubListIterable<E>(_values, 0, null);
+ Iterable<int> get keys => _ListIndicesIterable(_values);
bool get isEmpty => _values.isEmpty;
bool get isNotEmpty => _values.isNotEmpty;
@@ -243,7 +239,7 @@
for (int i = 0; i < length; i++) {
f(i, _values[i]);
if (length != _values.length) {
- throw new ConcurrentModificationError(_values);
+ throw ConcurrentModificationError(_values);
}
}
}
@@ -266,19 +262,19 @@
abstract class UnmodifiableListError {
/** Error thrown when trying to add elements to an unmodifiable list. */
static UnsupportedError add() =>
- new UnsupportedError("Cannot add to unmodifiable List");
+ UnsupportedError("Cannot add to unmodifiable List");
/** Error thrown when trying to add elements to an unmodifiable list. */
static UnsupportedError change() =>
- new UnsupportedError("Cannot change the content of an unmodifiable List");
+ UnsupportedError("Cannot change the content of an unmodifiable List");
/** Error thrown when trying to change the length of an unmodifiable list. */
static UnsupportedError length() =>
- new UnsupportedError("Cannot change length of unmodifiable List");
+ UnsupportedError("Cannot change length of unmodifiable List");
/** Error thrown when trying to remove elements from an unmodifiable list. */
static UnsupportedError remove() =>
- new UnsupportedError("Cannot remove from unmodifiable List");
+ UnsupportedError("Cannot remove from unmodifiable List");
}
/**
@@ -289,15 +285,15 @@
abstract class NonGrowableListError {
/** Error thrown when trying to add elements to an non-growable list. */
static UnsupportedError add() =>
- new UnsupportedError("Cannot add to non-growable List");
+ UnsupportedError("Cannot add to non-growable List");
/** Error thrown when trying to change the length of an non-growable list. */
static UnsupportedError length() =>
- new UnsupportedError("Cannot change length of non-growable List");
+ UnsupportedError("Cannot change length of non-growable List");
/** Error thrown when trying to remove elements from an non-growable list. */
static UnsupportedError remove() =>
- new UnsupportedError("Cannot remove from non-growable List");
+ UnsupportedError("Cannot remove from non-growable List");
}
/**
diff --git a/sdk/lib/io/common.dart b/sdk/lib/io/common.dart
index 42442cf..85d67cb 100644
--- a/sdk/lib/io/common.dart
+++ b/sdk/lib/io/common.dart
@@ -92,7 +92,7 @@
/// Converts an OSError object to a string representation.
String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuffer sb = StringBuffer();
sb.write("OS Error");
if (message.isNotEmpty) {
sb
@@ -129,12 +129,12 @@
// Send typed data directly, unless it is a partial view, in which case we
// would rather copy than drag in the potentially much large backing store.
// See issue 50206.
- return new _BufferAndStart(buffer, start);
+ return _BufferAndStart(buffer, start);
}
int length = end - start;
- var newBuffer = new Uint8List(length);
+ var newBuffer = Uint8List(length);
newBuffer.setRange(0, length, buffer, start);
- return new _BufferAndStart(newBuffer, 0);
+ return _BufferAndStart(newBuffer, 0);
}
class _IOCrypto {
diff --git a/sdk/lib/io/data_transformer.dart b/sdk/lib/io/data_transformer.dart
index 7eb237f..0981cc6 100644
--- a/sdk/lib/io/data_transformer.dart
+++ b/sdk/lib/io/data_transformer.dart
@@ -56,7 +56,7 @@
}
/// An instance of the default implementation of the [ZLibCodec].
-const ZLibCodec zlib = const ZLibCodec._default();
+const ZLibCodec zlib = ZLibCodec._default();
/// The [ZLibCodec] encodes raw bytes to ZLib compressed bytes and decodes ZLib
/// compressed bytes to raw bytes.
@@ -131,7 +131,7 @@
dictionary = null;
/// Get a [ZLibEncoder] for encoding to `ZLib` compressed data.
- ZLibEncoder get encoder => new ZLibEncoder(
+ ZLibEncoder get encoder => ZLibEncoder(
gzip: false,
level: level,
windowBits: windowBits,
@@ -143,11 +143,11 @@
/// Get a [ZLibDecoder] for decoding `ZLib` compressed data.
ZLibDecoder get decoder =>
- new ZLibDecoder(windowBits: windowBits, dictionary: dictionary, raw: raw);
+ ZLibDecoder(windowBits: windowBits, dictionary: dictionary, raw: raw);
}
/// An instance of the default implementation of the [GZipCodec].
-const GZipCodec gzip = const GZipCodec._default();
+const GZipCodec gzip = GZipCodec._default();
/// The [GZipCodec] encodes raw bytes to GZip compressed bytes and decodes GZip
/// compressed bytes to raw bytes.
@@ -224,7 +224,7 @@
dictionary = null;
/// Get a [ZLibEncoder] for encoding to `GZip` compressed data.
- ZLibEncoder get encoder => new ZLibEncoder(
+ ZLibEncoder get encoder => ZLibEncoder(
gzip: true,
level: level,
windowBits: windowBits,
@@ -235,7 +235,7 @@
);
/// Get a [ZLibDecoder] for decoding `GZip` compressed data.
- ZLibDecoder get decoder => new ZLibDecoder(
+ ZLibDecoder get decoder => ZLibDecoder(
gzip: true,
windowBits: windowBits,
dictionary: dictionary,
@@ -311,7 +311,7 @@
/// Convert a list of bytes using the options given to the ZLibEncoder
/// constructor.
List<int> convert(List<int> bytes) {
- _BufferSink sink = new _BufferSink();
+ _BufferSink sink = _BufferSink();
startChunkedConversion(sink)
..add(bytes)
..close();
@@ -326,9 +326,9 @@
/// using it.
ByteConversionSink startChunkedConversion(Sink<List<int>> sink) {
if (sink is! ByteConversionSink) {
- sink = new ByteConversionSink.from(sink);
+ sink = ByteConversionSink.from(sink);
}
- return new _ZLibEncoderSink._(
+ return _ZLibEncoderSink._(
sink,
gzip,
level,
@@ -378,7 +378,7 @@
/// Convert a list of bytes using the options given to the [ZLibDecoder]
/// constructor.
List<int> convert(List<int> bytes) {
- _BufferSink sink = new _BufferSink();
+ _BufferSink sink = _BufferSink();
startChunkedConversion(sink)
..add(bytes)
..close();
@@ -392,9 +392,9 @@
/// using it.
ByteConversionSink startChunkedConversion(Sink<List<int>> sink) {
if (sink is! ByteConversionSink) {
- sink = new ByteConversionSink.from(sink);
+ sink = ByteConversionSink.from(sink);
}
- return new _ZLibDecoderSink._(sink, gzip, windowBits, dictionary, raw);
+ return _ZLibDecoderSink._(sink, gzip, windowBits, dictionary, raw);
}
}
@@ -468,7 +468,7 @@
}
class _BufferSink extends ByteConversionSink {
- final BytesBuilder builder = new BytesBuilder(copy: false);
+ final BytesBuilder builder = BytesBuilder(copy: false);
void add(List<int> chunk) {
builder.add(chunk);
@@ -478,11 +478,7 @@
if (chunk is Uint8List) {
Uint8List list = chunk;
builder.add(
- new Uint8List.view(
- list.buffer,
- list.offsetInBytes + start,
- end - start,
- ),
+ Uint8List.view(list.buffer, list.offsetInBytes + start, end - start),
);
} else {
builder.add(chunk.sublist(start, end));
@@ -594,7 +590,7 @@
void _validateZLibWindowBits(int windowBits) {
if (ZLibOption.minWindowBits > windowBits ||
ZLibOption.maxWindowBits < windowBits) {
- throw new RangeError.range(
+ throw RangeError.range(
windowBits,
ZLibOption.minWindowBits,
ZLibOption.maxWindowBits,
@@ -604,13 +600,13 @@
void _validateZLibeLevel(int level) {
if (ZLibOption.minLevel > level || ZLibOption.maxLevel < level) {
- throw new RangeError.range(level, ZLibOption.minLevel, ZLibOption.maxLevel);
+ throw RangeError.range(level, ZLibOption.minLevel, ZLibOption.maxLevel);
}
}
void _validateZLibMemLevel(int memLevel) {
if (ZLibOption.minMemLevel > memLevel || ZLibOption.maxMemLevel < memLevel) {
- throw new RangeError.range(
+ throw RangeError.range(
memLevel,
ZLibOption.minMemLevel,
ZLibOption.maxMemLevel,
@@ -619,7 +615,7 @@
}
void _validateZLibStrategy(int strategy) {
- const strategies = const <int>[
+ const strategies = <int>[
ZLibOption.strategyFiltered,
ZLibOption.strategyHuffmanOnly,
ZLibOption.strategyRle,
@@ -627,6 +623,6 @@
ZLibOption.strategyDefault,
];
if (strategies.indexOf(strategy) == -1) {
- throw new ArgumentError("Unsupported 'strategy'");
+ throw ArgumentError("Unsupported 'strategy'");
}
}
diff --git a/sdk/lib/io/directory.dart b/sdk/lib/io/directory.dart
index 74c51f4..88d34a2 100644
--- a/sdk/lib/io/directory.dart
+++ b/sdk/lib/io/directory.dart
@@ -112,7 +112,7 @@
factory Directory(String path) {
final IOOverrides? overrides = IOOverrides.current;
if (overrides == null) {
- return new _Directory(path);
+ return _Directory(path);
}
return overrides.createDirectory(path);
}
@@ -120,13 +120,13 @@
@pragma("vm:entry-point")
factory Directory.fromRawPath(Uint8List path) {
// TODO(bkonyi): Handle overrides.
- return new _Directory.fromRawPath(path);
+ return _Directory.fromRawPath(path);
}
/// Create a [Directory] from a URI.
///
/// If [uri] cannot reference a directory this throws [UnsupportedError].
- factory Directory.fromUri(Uri uri) => new Directory(uri.toFilePath());
+ factory Directory.fromUri(Uri uri) => Directory(uri.toFilePath());
/// Creates a directory object pointing to the current working
/// directory.
diff --git a/sdk/lib/io/directory_impl.dart b/sdk/lib/io/directory_impl.dart
index fa57c47..86f42e7 100644
--- a/sdk/lib/io/directory_impl.dart
+++ b/sdk/lib/io/directory_impl.dart
@@ -53,7 +53,7 @@
"",
);
}
- return new _Directory(result);
+ return _Directory(result);
}
static void set current(Object? path) {
@@ -72,7 +72,7 @@
};
if (!_EmbedderConfig._mayChdir) {
- throw new UnsupportedError(
+ throw UnsupportedError(
"This embedder disallows setting Directory.current",
);
}
@@ -88,7 +88,7 @@
}
Uri get uri {
- return new Uri.directory(path);
+ return Uri.directory(path);
}
Future<bool> exists() {
@@ -104,12 +104,12 @@
bool existsSync() {
var result = _exists(_Namespace._namespace, _rawPath);
if (result is OSError) {
- throw new FileSystemException("Exists failed", path, result);
+ throw FileSystemException("Exists failed", path, result);
}
return (result == 1);
}
- Directory get absolute => new Directory(_absolutePath);
+ Directory get absolute => Directory(_absolutePath);
Future<Directory> create({bool recursive = false}) {
if (recursive) {
@@ -148,12 +148,12 @@
}
static Directory get systemTemp =>
- new Directory(_systemTemp(_Namespace._namespace));
+ Directory(_systemTemp(_Namespace._namespace));
Future<Directory> createTemp([String? prefix]) {
prefix ??= '';
if (path == '') {
- throw new ArgumentError(
+ throw ArgumentError(
"Directory.createTemp called with an empty path. "
"To use the system temp directory, use Directory.systemTemp",
);
@@ -182,7 +182,7 @@
Directory createTempSync([String? prefix]) {
prefix ??= '';
if (path == '') {
- throw new ArgumentError(
+ throw ArgumentError(
"Directory.createTemp called with an empty path. "
"To use the system temp directory, use Directory.systemTemp",
);
@@ -200,13 +200,13 @@
FileSystemEntity._toUtf8Array(fullPrefix),
);
if (result is OSError) {
- throw new FileSystemException._fromOSError(
+ throw FileSystemException._fromOSError(
result,
"Creation of temporary directory failed",
fullPrefix,
);
}
- return new Directory(result);
+ return Directory(result);
}
Future<Directory> _delete({bool recursive = false}) {
@@ -234,7 +234,7 @@
newPath,
]).then((response) {
_checkForErrorResponse(response, "Rename failed", path);
- return new Directory(newPath);
+ return Directory(newPath);
});
}
@@ -245,14 +245,14 @@
if (result is OSError) {
throw FileSystemException._fromOSError(result, "Rename failed", path);
}
- return new Directory(newPath);
+ return Directory(newPath);
}
Stream<FileSystemEntity> list({
bool recursive = false,
bool followLinks = true,
}) {
- return new _AsyncDirectoryLister(
+ return _AsyncDirectoryLister(
// FIXME(bkonyi): here we're using `path` directly, which might cause issues
// if it is not UTF-8 encoded.
FileSystemEntity._toUtf8Array(
@@ -316,12 +316,12 @@
final bool recursive;
final bool followLinks;
- final controller = new StreamController<FileSystemEntity>(sync: true);
+ final controller = StreamController<FileSystemEntity>(sync: true);
bool canceled = false;
bool nextRunning = false;
bool closed = false;
_AsyncDirectoryListerOps? _ops;
- Completer closeCompleter = new Completer();
+ Completer closeCompleter = Completer();
_AsyncDirectoryLister(this.rawPath, this.recursive, this.followLinks) {
controller
@@ -349,7 +349,7 @@
followLinks,
]).then((response) {
if (response is int) {
- _ops = new _AsyncDirectoryListerOps(response);
+ _ops = _AsyncDirectoryListerOps(response);
next();
} else if (response is Error) {
controller.addError(response, response.stackTrace);
@@ -401,13 +401,13 @@
assert(i % 2 == 0);
switch (result[i++]) {
case listFile:
- controller.add(new File.fromRawPath(result[i]));
+ controller.add(File.fromRawPath(result[i]));
break;
case listDirectory:
- controller.add(new Directory.fromRawPath(result[i]));
+ controller.add(Directory.fromRawPath(result[i]));
break;
case listLink:
- controller.add(new Link.fromRawPath(result[i]));
+ controller.add(Link.fromRawPath(result[i]));
break;
case listError:
error(result[i]);
@@ -418,7 +418,7 @@
}
}
} else {
- controller.addError(new FileSystemException("Internal error"));
+ controller.addError(FileSystemException("Internal error"));
}
});
}
@@ -452,9 +452,9 @@
var errorResponseInfo = message[responseError]! as List<Object?>;
var errorType = errorResponseInfo[_errorResponseErrorType];
if (errorType == _illegalArgumentResponse) {
- controller.addError(new ArgumentError());
+ controller.addError(ArgumentError());
} else if (errorType == _osErrorResponse) {
- var err = new OSError(
+ var err = OSError(
errorResponseInfo[_osErrorResponseMessage] as String,
errorResponseInfo[_osErrorResponseErrorCode] as int,
);
@@ -472,7 +472,7 @@
),
);
} else {
- controller.addError(new FileSystemException("Internal error"));
+ controller.addError(FileSystemException("Internal error"));
}
}
}
diff --git a/sdk/lib/io/file.dart b/sdk/lib/io/file.dart
index 5846054..d1fe18e 100644
--- a/sdk/lib/io/file.dart
+++ b/sdk/lib/io/file.dart
@@ -7,25 +7,25 @@
/// The modes in which a [File] can be opened.
class FileMode {
/// The mode for opening a file only for reading.
- static const read = const FileMode._internal(0);
+ static const read = FileMode._internal(0);
/// Mode for opening a file for reading and writing. The file is
/// overwritten if it already exists. The file is created if it does not
/// already exist.
- static const write = const FileMode._internal(1);
+ static const write = FileMode._internal(1);
/// Mode for opening a file for reading and writing to the
/// end of it. The file is created if it does not already exist.
- static const append = const FileMode._internal(2);
+ static const append = FileMode._internal(2);
/// Mode for opening a file for writing *only*. The file is
/// overwritten if it already exists. The file is created if it does not
/// already exist.
- static const writeOnly = const FileMode._internal(3);
+ static const writeOnly = FileMode._internal(3);
/// Mode for opening a file for writing *only* to the
/// end of it. The file is created if it does not already exist.
- static const writeOnlyAppend = const FileMode._internal(4);
+ static const writeOnlyAppend = FileMode._internal(4);
final int _mode;
@@ -35,16 +35,16 @@
/// Type of lock when requesting a lock on a file.
class FileLock {
/// Shared file lock.
- static const shared = const FileLock._internal(1);
+ static const shared = FileLock._internal(1);
/// Exclusive file lock.
- static const exclusive = const FileLock._internal(2);
+ static const exclusive = FileLock._internal(2);
/// Blocking shared file lock.
- static const blockingShared = const FileLock._internal(3);
+ static const blockingShared = FileLock._internal(3);
/// Blocking exclusive file lock.
- static const blockingExclusive = const FileLock._internal(4);
+ static const blockingExclusive = FileLock._internal(4);
final int _type;
@@ -201,7 +201,7 @@
factory File(String path) {
final IOOverrides? overrides = IOOverrides.current;
if (overrides == null) {
- return new _File(path);
+ return _File(path);
}
return overrides.createFile(path);
}
@@ -209,7 +209,7 @@
/// Create a [File] object from a URI.
///
/// If [uri] cannot reference a file this throws [UnsupportedError].
- factory File.fromUri(Uri uri) => new File(uri.toFilePath());
+ factory File.fromUri(Uri uri) => File(uri.toFilePath());
/// Creates a [File] object from a raw path.
///
@@ -217,7 +217,7 @@
@pragma("vm:entry-point")
factory File.fromRawPath(Uint8List rawPath) {
// TODO(bkonyi): Handle overrides.
- return new _File.fromRawPath(rawPath);
+ return _File.fromRawPath(rawPath);
}
/// Creates the file.
@@ -1120,7 +1120,7 @@
}
String _toStringHelper(String className) {
- StringBuffer sb = new StringBuffer();
+ StringBuffer sb = StringBuffer();
sb.write(className);
if (message.isNotEmpty) {
sb.write(": $message");
diff --git a/sdk/lib/io/io_sink.dart b/sdk/lib/io/io_sink.dart
index 57e59bb..9ecf540 100644
--- a/sdk/lib/io/io_sink.dart
+++ b/sdk/lib/io/io_sink.dart
@@ -31,7 +31,7 @@
factory IOSink(
StreamConsumer<List<int>> target, {
Encoding encoding = utf8,
- }) => new _IOSinkImpl(target, encoding);
+ }) => _IOSinkImpl(target, encoding);
/// The [Encoding] used when writing strings.
///
@@ -139,7 +139,7 @@
class _StreamSinkImpl<T> implements StreamSink<T> {
final StreamConsumer<T> _target;
- final Completer _doneCompleter = new Completer();
+ final Completer _doneCompleter = Completer();
StreamController<T>? _controllerInstance;
Completer? _controllerCompleter;
bool _isClosed = false;
@@ -164,7 +164,7 @@
Future addStream(Stream<T> stream) {
if (_isBound) {
- throw new StateError("StreamSink is already bound to a stream");
+ throw StateError("StreamSink is already bound to a stream");
}
if (_hasError) return done;
@@ -186,9 +186,9 @@
Future flush() {
if (_isBound) {
- throw new StateError("StreamSink is bound to a stream");
+ throw StateError("StreamSink is bound to a stream");
}
- if (_controllerInstance == null) return new Future.value(this);
+ if (_controllerInstance == null) return Future.value(this);
// Adding an empty stream-controller will return a future that will complete
// when all data is done.
_isBound = true;
@@ -201,7 +201,7 @@
Future close() {
if (_isBound) {
- throw new StateError("StreamSink is bound to a stream");
+ throw StateError("StreamSink is bound to a stream");
}
if (!_isClosed) {
_isClosed = true;
@@ -235,14 +235,14 @@
StreamController<T> get _controller {
if (_isBound) {
- throw new StateError("StreamSink is bound to a stream");
+ throw StateError("StreamSink is bound to a stream");
}
if (_isClosed) {
- throw new StateError("StreamSink is closed");
+ throw StateError("StreamSink is closed");
}
if (_controllerInstance == null) {
- _controllerInstance = new StreamController<T>(sync: true);
- _controllerCompleter = new Completer();
+ _controllerInstance = StreamController<T>(sync: true);
+ _controllerCompleter = Completer();
_target
.addStream(_controller.stream)
.then(
@@ -285,7 +285,7 @@
void set encoding(Encoding value) {
if (!_encodingMutable) {
- throw new StateError("IOSink encoding is not mutable");
+ throw StateError("IOSink encoding is not mutable");
}
_encoding = value;
}
@@ -317,6 +317,6 @@
}
void writeCharCode(int charCode) {
- write(new String.fromCharCode(charCode));
+ write(String.fromCharCode(charCode));
}
}
diff --git a/sdk/lib/io/network_profiling.dart b/sdk/lib/io/network_profiling.dart
index b61eeab..6f057ff 100644
--- a/sdk/lib/io/network_profiling.dart
+++ b/sdk/lib/io/network_profiling.dart
@@ -39,7 +39,7 @@
};
}
-@pragma('vm:entry-point', !const bool.fromEnvironment("dart.vm.product"))
+@pragma('vm:entry-point', !bool.fromEnvironment("dart.vm.product"))
abstract class _NetworkProfiling {
// Http relative RPCs
static const _kHttpEnableTimelineLogging =
@@ -58,7 +58,7 @@
// if more methods added to dart:io,
static const _kGetVersionRPC = 'ext.dart.io.getVersion';
- @pragma('vm:entry-point', !const bool.fromEnvironment("dart.vm.product"))
+ @pragma('vm:entry-point', !bool.fromEnvironment("dart.vm.product"))
static void _registerServiceExtension() {
registerExtension(_kHttpEnableTimelineLogging, _serviceExtensionHandler);
registerExtension(_kGetSocketProfileRPC, _serviceExtensionHandler);
diff --git a/sdk/lib/io/overrides.dart b/sdk/lib/io/overrides.dart
index adaf613..31df3f4 100644
--- a/sdk/lib/io/overrides.dart
+++ b/sdk/lib/io/overrides.dart
@@ -4,7 +4,7 @@
part of dart.io;
-final _ioOverridesToken = new Object();
+final _ioOverridesToken = Object();
/// Facilities for overriding various APIs of `dart:io` with mock
/// implementations.
@@ -117,7 +117,7 @@
currentScope = current;
current = currentScope._previous;
}
- IOOverrides overrides = new _IOOverridesScope(
+ IOOverrides overrides = _IOOverridesScope(
current,
// Directory
createDirectory ?? currentScope?._createDirectory,
@@ -180,7 +180,7 @@
///
/// When this override is installed, this function overrides the behavior of
/// `new Directory()` and `new Directory.fromUri()`.
- Directory createDirectory(String path) => new _Directory(path);
+ Directory createDirectory(String path) => _Directory(path);
/// Returns the current working directory.
///
@@ -208,7 +208,7 @@
///
/// When this override is installed, this function overrides the behavior of
/// `new File()` and `new File.fromUri()`.
- File createFile(String path) => new _File(path);
+ File createFile(String path) => _File(path);
// FileStat
@@ -286,7 +286,7 @@
///
/// When this override is installed, this function overrides the behavior of
/// `new Link()` and `new Link.fromUri()`.
- Link createLink(String path) => new _Link(path);
+ Link createLink(String path) => _Link(path);
// Socket
diff --git a/sdk/lib/io/platform_impl.dart b/sdk/lib/io/platform_impl.dart
index 526c44b..130cf6b 100644
--- a/sdk/lib/io/platform_impl.dart
+++ b/sdk/lib/io/platform_impl.dart
@@ -84,8 +84,8 @@
if (env is Iterable<Object?>) {
var result =
Platform.isWindows
- ? new _CaseInsensitiveStringMap<String>()
- : new Map<String, String>();
+ ? _CaseInsensitiveStringMap<String>()
+ : Map<String, String>();
for (var environmentEntry in env) {
if (environmentEntry == null) {
continue;
@@ -107,7 +107,7 @@
);
}
}
- _environmentCache = new UnmodifiableMapView<String, String>(result);
+ _environmentCache = UnmodifiableMapView<String, String>(result);
} else {
_environmentCache = env;
}
@@ -126,7 +126,7 @@
// Environment variables are case-insensitive on Windows. In order
// to reflect that we use a case-insensitive string map on Windows.
class _CaseInsensitiveStringMap<V> extends MapBase<String, V> {
- final Map<String, V> _map = new Map<String, V>();
+ final Map<String, V> _map = Map<String, V>();
bool containsKey(Object? key) =>
key is String && _map.containsKey(key.toUpperCase());
diff --git a/sdk/lib/io/secure_socket.dart b/sdk/lib/io/secure_socket.dart
index d4f2100..ebd4e6c 100644
--- a/sdk/lib/io/secure_socket.dart
+++ b/sdk/lib/io/secure_socket.dart
@@ -68,7 +68,7 @@
keyLog: keyLog,
supportedProtocols: supportedProtocols,
timeout: timeout,
- ).then((rawSocket) => new SecureSocket._(rawSocket));
+ ).then((rawSocket) => SecureSocket._(rawSocket));
}
/// Like [connect], but returns a [Future] that completes with a
@@ -91,9 +91,9 @@
supportedProtocols: supportedProtocols,
).then((rawState) {
Future<SecureSocket> socket = rawState.socket.then(
- (rawSocket) => new SecureSocket._(rawSocket),
+ (rawSocket) => SecureSocket._(rawSocket),
);
- return new ConnectionTask<SecureSocket>._(socket, rawState._onCancel);
+ return ConnectionTask<SecureSocket>._(socket, rawState._onCancel);
});
}
@@ -170,7 +170,7 @@
supportedProtocols: supportedProtocols,
);
})
- .then<SecureSocket>((raw) => new SecureSocket._(raw));
+ .then<SecureSocket>((raw) => SecureSocket._(raw));
}
/// Initiates TLS on an existing server connection.
@@ -214,7 +214,7 @@
supportedProtocols: supportedProtocols,
);
})
- .then<SecureSocket>((raw) => new SecureSocket._(raw));
+ .then<SecureSocket>((raw) => SecureSocket._(raw));
}
/// The peer certificate for a connected SecureSocket.
@@ -343,7 +343,7 @@
supportedProtocols: supportedProtocols,
);
});
- return new ConnectionTask<RawSecureSocket>._(socket, rawState._onCancel);
+ return ConnectionTask<RawSecureSocket>._(socket, rawState._onCancel);
});
}
@@ -559,8 +559,8 @@
final RawSocket _socket;
final Completer<_RawSecureSocket> _handshakeComplete =
- new Completer<_RawSecureSocket>();
- final _controller = new StreamController<RawSocketEvent>(sync: true);
+ Completer<_RawSecureSocket>();
+ final _controller = StreamController<RawSocketEvent>(sync: true);
late final StreamSubscription<RawSocketEvent> _socketSubscription;
List<int>? _bufferedData;
int _bufferedDataIndex = 0;
@@ -583,13 +583,13 @@
bool _closedRead = false; // The secure socket has fired an onClosed event.
bool _closedWrite = false; // The secure socket has been closed for writing.
// The network socket is gone.
- Completer<RawSecureSocket> _closeCompleter = new Completer<RawSecureSocket>();
- _FilterStatus _filterStatus = new _FilterStatus();
+ Completer<RawSecureSocket> _closeCompleter = Completer<RawSecureSocket>();
+ _FilterStatus _filterStatus = _FilterStatus();
bool _connectPending = true;
bool _filterPending = false;
bool _filterActive = false;
- _SecureFilter? _secureFilter = new _SecureFilter._();
+ _SecureFilter? _secureFilter = _SecureFilter._();
String? _selectedProtocol;
static Future<_RawSecureSocket> connect(
@@ -617,7 +617,7 @@
if (host != null) {
address = InternetAddress._cloneWithNewHost(address, host);
}
- return new _RawSecureSocket(
+ return _RawSecureSocket(
address,
requestedPort,
isServer,
@@ -693,7 +693,7 @@
_socketSubscription = subscription;
if (_socketSubscription.isPaused) {
_socket.close();
- throw new ArgumentError("Subscription passed to TLS upgrade is paused");
+ throw ArgumentError("Subscription passed to TLS upgrade is paused");
}
// If we are upgrading a socket that is already closed for read,
// report an error as if we received readClosed during the handshake.
@@ -745,7 +745,7 @@
bool requireClientCertificate,
) {
if (host is! String && host is! InternetAddress) {
- throw new ArgumentError("host is not a String or an InternetAddress");
+ throw ArgumentError("host is not a String or an InternetAddress");
}
// TODO(40614): Remove once non-nullability is sound.
ArgumentError.checkNotNull(requestedPort, "requestedPort");
@@ -850,12 +850,12 @@
Uint8List? read([int? length]) {
if (length != null && length < 0) {
- throw new ArgumentError(
+ throw ArgumentError(
"Invalid length parameter in SecureSocket.read (length: $length)",
);
}
if (_closedRead) {
- throw new SocketException("Reading from a closed socket");
+ throw SocketException("Reading from a closed socket");
}
if (_status != connectedStatus) {
return null;
@@ -874,19 +874,19 @@
// Write the data to the socket, and schedule the filter to encrypt it.
int write(List<int> data, [int offset = 0, int? bytes]) {
if (bytes != null && bytes < 0) {
- throw new ArgumentError(
+ throw ArgumentError(
"Invalid bytes parameter in SecureSocket.read (bytes: $bytes)",
);
}
// TODO(40614): Remove once non-nullability is sound.
offset = _fixOffset(offset);
if (offset < 0) {
- throw new ArgumentError(
+ throw ArgumentError(
"Invalid offset parameter in SecureSocket.read (offset: $offset)",
);
}
if (_closedWrite) {
- _controller.addError(new SocketException("Writing to a closed socket"));
+ _controller.addError(SocketException("Writing to a closed socket"));
return 0;
}
if (_status != connectedStatus) return 0;
@@ -997,7 +997,7 @@
// bytes available we can continue handshake.
if (_filterStatus.readEmpty) {
_reportError(
- new HandshakeException('Connection terminated during handshake'),
+ HandshakeException('Connection terminated during handshake'),
null,
);
}
@@ -1028,9 +1028,7 @@
bool requireClientCertificate = false,
}) {
if (_status != connectedStatus) {
- throw new HandshakeException(
- "Called renegotiate on a non-connected socket",
- );
+ throw HandshakeException("Called renegotiate on a non-connected socket");
}
_status = handshakeStatus;
_filterStatus.writeEmpty = false;
@@ -1113,7 +1111,7 @@
if (_status == handshakeStatus) {
_secureFilter!.handshake();
if (_status == handshakeStatus) {
- throw new HandshakeException(
+ throw HandshakeException(
'Connection terminated during handshake',
);
}
@@ -1226,7 +1224,7 @@
Future<_FilterStatus> _pushAllFilterStages() async {
bool wasInHandshake = _status != connectedStatus;
- List args = new List<dynamic>.filled(2 + bufferCount * 2, null);
+ List args = List<dynamic>.filled(2 + bufferCount * 2, null);
args[0] = _secureFilter!._pointer();
args[1] = wasInHandshake;
var bufs = _secureFilter!.buffers!;
@@ -1242,21 +1240,18 @@
if (wasInHandshake) {
// If we're in handshake, throw a handshake error.
_reportError(
- new HandshakeException('${response[1]} error ${response[0]}'),
+ HandshakeException('${response[1]} error ${response[0]}'),
null,
);
} else {
// If we're connected, throw a TLS error.
- _reportError(
- new TlsException('${response[1]} error ${response[0]}'),
- null,
- );
+ _reportError(TlsException('${response[1]} error ${response[0]}'), null);
}
}
int start(int index) => response[2 * index] as int;
int end(int index) => response[2 * index + 1] as int;
- _FilterStatus status = new _FilterStatus();
+ _FilterStatus status = _FilterStatus();
// Compute writeEmpty as "write plaintext buffer and write encrypted
// buffer were empty when we started and are empty now".
status.writeEmpty =
@@ -1371,7 +1366,7 @@
bytes = min(bytes, length);
}
if (bytes == 0) return null;
- Uint8List result = new Uint8List(bytes);
+ Uint8List result = Uint8List(bytes);
int bytesRead = 0;
// Loop over zero, one, or two linear data ranges.
while (bytesRead < bytes) {
@@ -1477,7 +1472,7 @@
const TlsException._(this.type, this.message, this.osError);
String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuffer sb = StringBuffer();
sb.write(type);
if (message.isNotEmpty) {
sb.write(": $message");
diff --git a/sdk/lib/io/security_context.dart b/sdk/lib/io/security_context.dart
index 2b306b1..2e6ddb0 100644
--- a/sdk/lib/io/security_context.dart
+++ b/sdk/lib/io/security_context.dart
@@ -231,7 +231,7 @@
/// We will be conservative and support only messages up to (1<<13)-1 bytes.
static Uint8List _protocolsToLengthEncoding(List<String>? protocols) {
if (protocols == null || protocols.length == 0) {
- return new Uint8List(0);
+ return Uint8List(0);
}
int protocolsLength = protocols.length;
@@ -242,20 +242,18 @@
if (length > 0 && length <= 255) {
expectedLength += length;
} else {
- throw new ArgumentError(
+ throw ArgumentError(
'Length of protocol must be between 1 and 255 (was: $length).',
);
}
}
if (expectedLength >= (1 << 13)) {
- throw new ArgumentError(
- 'The maximum message length supported is 2^13-1.',
- );
+ throw ArgumentError('The maximum message length supported is 2^13-1.');
}
// Try encoding the `List<String> protocols` array using fast ASCII path.
- var bytes = new Uint8List(expectedLength);
+ var bytes = Uint8List(expectedLength);
int bytesOffset = 0;
for (int i = 0; i < protocolsLength; i++) {
String proto = protocols[i];
@@ -287,7 +285,7 @@
var len = protocolBytes.length;
if (len > 255) {
- throw new ArgumentError(
+ throw ArgumentError(
'Length of protocol must be between 1 and 255 (was: $len)',
);
}
@@ -304,11 +302,9 @@
}
if (bytes.length >= (1 << 13)) {
- throw new ArgumentError(
- 'The maximum message length supported is 2^13-1.',
- );
+ throw ArgumentError('The maximum message length supported is 2^13-1.');
}
- return new Uint8List.fromList(bytes);
+ return Uint8List.fromList(bytes);
}
}
diff --git a/sdk/lib/io/socket.dart b/sdk/lib/io/socket.dart
index f758bbf..5907fed 100644
--- a/sdk/lib/io/socket.dart
+++ b/sdk/lib/io/socket.dart
@@ -10,10 +10,10 @@
/// and Unix domain address are supported.
/// Unix domain sockets are available only on Linux, MacOS and Android.
final class InternetAddressType {
- static const InternetAddressType IPv4 = const InternetAddressType._(0);
- static const InternetAddressType IPv6 = const InternetAddressType._(1);
- static const InternetAddressType unix = const InternetAddressType._(2);
- static const InternetAddressType any = const InternetAddressType._(-1);
+ static const InternetAddressType IPv4 = InternetAddressType._(0);
+ static const InternetAddressType IPv6 = InternetAddressType._(1);
+ static const InternetAddressType unix = InternetAddressType._(2);
+ static const InternetAddressType any = InternetAddressType._(-1);
final int _value;
@@ -23,7 +23,7 @@
if (value == IPv4._value) return IPv4;
if (value == IPv6._value) return IPv6;
if (value == unix._value) return unix;
- throw new ArgumentError("Invalid type: $value");
+ throw ArgumentError("Invalid type: $value");
}
/// Get the name of the type, e.g. "IPv4" or "IPv6".
@@ -362,9 +362,9 @@
/// The [SocketDirection] is used as a parameter to [Socket.close] and
/// [RawSocket.close] to close a socket in the specified direction(s).
final class SocketDirection {
- static const SocketDirection receive = const SocketDirection._(0);
- static const SocketDirection send = const SocketDirection._(1);
- static const SocketDirection both = const SocketDirection._(2);
+ static const SocketDirection receive = SocketDirection._(0);
+ static const SocketDirection send = SocketDirection._(1);
+ static const SocketDirection both = SocketDirection._(2);
final _value;
@@ -382,12 +382,12 @@
/// as an individual TCP packet.
///
/// tcpNoDelay is disabled by default.
- static const SocketOption tcpNoDelay = const SocketOption._(0);
+ static const SocketOption tcpNoDelay = SocketOption._(0);
- static const SocketOption _ipMulticastLoop = const SocketOption._(1);
- static const SocketOption _ipMulticastHops = const SocketOption._(2);
- static const SocketOption _ipMulticastIf = const SocketOption._(3);
- static const SocketOption _ipBroadcast = const SocketOption._(4);
+ static const SocketOption _ipMulticastLoop = SocketOption._(1);
+ static const SocketOption _ipMulticastHops = SocketOption._(2);
+ static const SocketOption _ipMulticastIf = SocketOption._(3);
+ static const SocketOption _ipBroadcast = SocketOption._(4);
final _value;
@@ -531,16 +531,16 @@
/// ```
class RawSocketEvent {
/// An event indicates the socket is ready to be read.
- static const RawSocketEvent read = const RawSocketEvent._(0);
+ static const RawSocketEvent read = RawSocketEvent._(0);
/// An event indicates the socket is ready to write.
- static const RawSocketEvent write = const RawSocketEvent._(1);
+ static const RawSocketEvent write = RawSocketEvent._(1);
/// An event indicates the reading from the socket is closed
- static const RawSocketEvent readClosed = const RawSocketEvent._(2);
+ static const RawSocketEvent readClosed = RawSocketEvent._(2);
/// An event indicates the socket is closed.
- static const RawSocketEvent closed = const RawSocketEvent._(3);
+ static const RawSocketEvent closed = RawSocketEvent._(3);
final int _value;
@@ -1408,7 +1408,7 @@
port = null;
String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuffer sb = StringBuffer();
sb.write("SocketException");
if (message.isNotEmpty) {
sb.write(": $message");
diff --git a/sdk/lib/typed_data/typed_data.dart b/sdk/lib/typed_data/typed_data.dart
index 219fe3d..f951199 100644
--- a/sdk/lib/typed_data/typed_data.dart
+++ b/sdk/lib/typed_data/typed_data.dart
@@ -402,10 +402,10 @@
final bool _littleEndian;
const Endian._(this._littleEndian);
- static const Endian big = const Endian._(false);
- static const Endian little = const Endian._(true);
+ static const Endian big = Endian._(false);
+ static const Endian little = Endian._(true);
static final Endian host =
- (new ByteData.view(new Uint16List.fromList([1]).buffer)).getInt8(0) == 1
+ (ByteData.view(Uint16List.fromList([1]).buffer)).getInt8(0) == 1
? little
: big;
}
diff --git a/sdk/lib/vmservice/vmservice.dart b/sdk/lib/vmservice/vmservice.dart
index 934f06c..1d195e3 100644
--- a/sdk/lib/vmservice/vmservice.dart
+++ b/sdk/lib/vmservice/vmservice.dart
@@ -876,14 +876,14 @@
@pragma(
'vm:entry-point',
- const bool.fromEnvironment('dart.vm.product') ? false : 'call',
+ bool.fromEnvironment('dart.vm.product') ? false : 'call',
)
RawReceivePort boot() {
// Return the port we expect isolate control messages on.
return isolateControlPort;
}
-@pragma('vm:entry-point', !const bool.fromEnvironment('dart.vm.product'))
+@pragma('vm:entry-point', !bool.fromEnvironment('dart.vm.product'))
// ignore: unused_element
void _registerIsolate(int port_id, SendPort sp, String name) =>
VMService().runningIsolates.isolateStartup(port_id, sp, name);