From 5cd284f5c326490e874aae7f7e2cf473a15be457 Mon Sep 17 00:00:00 2001 From: Anna Gringauze Date: Tue, 31 May 2022 13:50:00 -0700 Subject: [PATCH 01/10] Remove dead code --- frontend_server_common/CHANGELOG.md | 3 + frontend_server_common/lib/src/asset.dart | 64 ----- frontend_server_common/lib/src/devfs.dart | 62 ++--- .../lib/src/devfs_content.dart | 230 ------------------ .../lib/src/frontend_server_client.dart | 10 - .../lib/src/resident_runner.dart | 11 - frontend_server_common/lib/src/utilities.dart | 1 - 7 files changed, 27 insertions(+), 354 deletions(-) delete mode 100644 frontend_server_common/lib/src/asset.dart delete mode 100644 frontend_server_common/lib/src/devfs_content.dart diff --git a/frontend_server_common/CHANGELOG.md b/frontend_server_common/CHANGELOG.md index 51d1510cd..a2a8ac29e 100644 --- a/frontend_server_common/CHANGELOG.md +++ b/frontend_server_common/CHANGELOG.md @@ -1,3 +1,6 @@ +## 0.1.1 +- Remove dead code + ## 0.1.0 - Initial version diff --git a/frontend_server_common/lib/src/asset.dart b/frontend_server_common/lib/src/asset.dart deleted file mode 100644 index e08128db0..000000000 --- a/frontend_server_common/lib/src/asset.dart +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2020 The Dart Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// @dart = 2.9 - -// Note: this is a copy from flutter tools, updated to work with dwds tests, -// most functionality removed - -import 'dart:async'; - -import 'devfs_content.dart'; - -const AssetBundleFactory _manifestFactory = _MockManifestAssetBundleFactory(); - -const String defaultManifestPath = 'pubspec.yaml'; - -/// Injected factory class for spawning [AssetBundle] instances. -abstract class AssetBundleFactory { - static AssetBundleFactory get defaultInstance => _manifestFactory; - - /// Creates a new [AssetBundle]. - AssetBundle createBundle(); -} - -abstract class AssetBundle { - Map get entries; - - /// Returns 0 for success; non-zero for failure. - Future build({ - String manifestPath = defaultManifestPath, - String assetDirPath, - String packagesPath, - bool includeDefaultFonts = true, - bool reportLicensedPackages = false, - }); -} - -class _MockManifestAssetBundleFactory implements AssetBundleFactory { - const _MockManifestAssetBundleFactory(); - - @override - AssetBundle createBundle() => _MockManifestAssetBundle(); -} - -class _MockManifestAssetBundle implements AssetBundle { - /// Constructs an [_MockManifestAssetBundle] that gathers the set of assets from the - /// pubspec.yaml manifest. - _MockManifestAssetBundle(); - - @override - final Map entries = {}; - - @override - Future build({ - String manifestPath = defaultManifestPath, - String assetDirPath, - String packagesPath, - bool includeDefaultFonts = true, - bool reportLicensedPackages = false, - }) async { - return 0; - } -} diff --git a/frontend_server_common/lib/src/devfs.dart b/frontend_server_common/lib/src/devfs.dart index 2fa2027a8..323c92fc1 100644 --- a/frontend_server_common/lib/src/devfs.dart +++ b/frontend_server_common/lib/src/devfs.dart @@ -10,22 +10,17 @@ import 'dart:io'; import 'package:dwds/dwds.dart'; import 'package:file/file.dart'; -import 'package:logging/logging.dart'; import 'package:meta/meta.dart'; import 'package:package_config/package_config.dart'; import 'package:path/path.dart' as p; -import 'asset.dart'; import 'asset_server.dart'; import 'bootstrap.dart'; -import 'devfs_content.dart'; import 'frontend_server_client.dart'; import 'utilities.dart'; final String dartWebSdkPath = p.join(dartSdkPath, 'lib', 'dev_compiler'); -Logger _logger = Logger('WebDevFs'); - class WebDevFS { WebDevFS({ this.fileSystem, @@ -71,7 +66,6 @@ class WebDevFS { Future update({ String mainPath, - AssetBundle bundle, String dillOutputPath, @required ResidentCompiler generator, List invalidatedFiles, @@ -101,17 +95,8 @@ class WebDevFS { soundNullSafety ? dartSdkSourcemapSound : dartSdkSourcemap; assetServer.writeFile('/dart_sdk.js', sdk.readAsStringSync()); assetServer.writeFile('/dart_sdk.js.map', sdkSourceMap.readAsStringSync()); - // TODO(jonahwilliams): refactor the asset code in this and the regular devfs to - // be shared. - if (bundle != null) { - await writeBundle( - fileSystem.directory(p.joinAll(['build', 'assets'])), - bundle.entries, - ); - } generator.reset(); - var compilerOutput = await generator.recompile( Uri.parse('org-dartlang-app:///$mainPath'), invalidatedFiles, outputPath: p.join(dillOutputPath, 'app.dill'), @@ -191,6 +176,30 @@ class WebDevFS { )); } +class UpdateFSReport { + final bool _success; + final int _invalidatedSourcesCount; + final int _syncedBytes; + + UpdateFSReport({ + bool success = false, + int invalidatedSourcesCount = 0, + int syncedBytes = 0, + }) : _success = success, + _invalidatedSourcesCount = invalidatedSourcesCount, + _syncedBytes = syncedBytes; + + bool get success => _success; + int get invalidatedSourcesCount => _invalidatedSourcesCount; + int get syncedBytes => _syncedBytes; + + /// JavaScript modules produced by the incremental compiler in `dartdevc` + /// mode. + /// + /// Only used for JavaScript compilation. + List invalidatedModules; +} + String _filePathToUriFragment(String path) { if (Platform.isWindows) { var startWithSlash = path.startsWith('/'); @@ -203,26 +212,3 @@ String _filePathToUriFragment(String path) { } return path; } - -Future writeBundle( - Directory bundleDir, Map assetEntries) async { - if (bundleDir.existsSync()) { - try { - bundleDir.deleteSync(recursive: true); - } on FileSystemException catch (e, s) { - _logger.warning( - 'Failed to clean up asset directory ${bundleDir.path}.\n' - 'To clean build artifacts, use the command "flutter clean".', - e, - s); - } - } - bundleDir.createSync(recursive: true); - - await Future.wait(assetEntries.entries - .map>((MapEntry entry) async { - var file = fileSystem.file(fileSystem.path.join(bundleDir.path, entry.key)); - file.parent.createSync(recursive: true); - await file.writeAsBytes(await entry.value.contentsAsBytes()); - })); -} diff --git a/frontend_server_common/lib/src/devfs_content.dart b/frontend_server_common/lib/src/devfs_content.dart deleted file mode 100644 index 3b09c15c7..000000000 --- a/frontend_server_common/lib/src/devfs_content.dart +++ /dev/null @@ -1,230 +0,0 @@ -// Copyright 2020 The Dart Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// @dart = 2.9 - -// Note: this is a copy from flutter tools, updated to work with dwds tests - -import 'dart:async'; -import 'dart:convert'; - -import 'package:file/file.dart'; -import 'package:logging/logging.dart'; - -import 'utilities.dart'; - -Logger _logger = Logger('DevFsContent'); - -/// Common superclass for content copied to the device. -abstract class DevFSContent { - /// Return true if this is the first time this method is called - /// or if the entry has been modified since this method was last called. - bool get isModified; - - /// Return true if this is the first time this method is called - /// or if the entry has been modified after the given time - /// or if the given time is null. - bool isModifiedAfter(DateTime time); - - int get size; - - Future> contentsAsBytes(); - - Stream> contentsAsStream(); - - /// Return the list of files this content depends on. - List get fileDependencies => []; -} - -// File content to be copied to the device. -class DevFSFileContent extends DevFSContent { - DevFSFileContent(this.file); - - final FileSystemEntity file; - File _linkTarget; - FileStat _fileStat; - - File _getFile() { - if (_linkTarget != null) { - return _linkTarget; - } - if (file is Link) { - // The link target. - return fileSystem.file(file.resolveSymbolicLinksSync()); - } - return file as File; - } - - void _stat() { - if (_linkTarget != null) { - // Stat the cached symlink target. - var fileStat = _linkTarget.statSync(); - if (fileStat.type == FileSystemEntityType.notFound) { - _linkTarget = null; - } else { - _fileStat = fileStat; - return; - } - } - var fileStat = file.statSync(); - _fileStat = - fileStat.type == FileSystemEntityType.notFound ? null : fileStat; - if (_fileStat != null && _fileStat.type == FileSystemEntityType.link) { - // Resolve, stat the symlink target. - var resolved = file.resolveSymbolicLinksSync(); - var linkTarget = fileSystem.file(resolved); - // Stat the link target. - var fileStat = linkTarget.statSync(); - if (fileStat.type == FileSystemEntityType.notFound) { - _fileStat = null; - _linkTarget = null; - } - } - if (_fileStat == null) { - _logger.severe( - 'Unable to get status of file "${file.path}": file not found.'); - } - } - - @override - List get fileDependencies => [_getFile().path]; - - @override - bool get isModified { - var _oldFileStat = _fileStat; - _stat(); - if (_oldFileStat == null && _fileStat == null) { - return false; - } - return _oldFileStat == null || - _fileStat == null || - _fileStat.modified.isAfter(_oldFileStat.modified); - } - - @override - bool isModifiedAfter(DateTime time) { - var _oldFileStat = _fileStat; - _stat(); - if (_oldFileStat == null && _fileStat == null) { - return false; - } - return time == null || - _oldFileStat == null || - _fileStat == null || - _fileStat.modified.isAfter(time); - } - - @override - int get size { - if (_fileStat == null) { - _stat(); - } - // Can still be null if the file wasn't found. - return _fileStat?.size ?? 0; - } - - @override - Future> contentsAsBytes() => _getFile().readAsBytes(); - - @override - Stream> contentsAsStream() => _getFile().openRead(); -} - -/// Byte content to be copied to the device. -class DevFSByteContent extends DevFSContent { - DevFSByteContent(this._bytes); - - List _bytes; - - bool _isModified = true; - DateTime _modificationTime = DateTime.now(); - - List get bytes => _bytes; - - set bytes(List value) { - _bytes = value; - _isModified = true; - _modificationTime = DateTime.now(); - } - - /// Return true only once so that the content is written to the device only once. - @override - bool get isModified { - var modified = _isModified; - _isModified = false; - return modified; - } - - @override - bool isModifiedAfter(DateTime time) { - return time == null || _modificationTime.isAfter(time); - } - - @override - int get size => _bytes.length; - - @override - Future> contentsAsBytes() async => _bytes; - - @override - Stream> contentsAsStream() => - Stream>.fromIterable(>[_bytes]); -} - -/// String content to be copied to the device. -class DevFSStringContent extends DevFSByteContent { - DevFSStringContent(String string) - : _string = string, - super(utf8.encode(string)); - - String _string; - - String get string => _string; - - set string(String value) { - _string = value; - super.bytes = utf8.encode(_string); - } - - @override - set bytes(List value) { - string = utf8.decode(value); - } -} - -// Basic statistics for DevFS update operation. -class UpdateFSReport { - UpdateFSReport({ - bool success = false, - int invalidatedSourcesCount = 0, - int syncedBytes = 0, - }) { - _success = success; - _invalidatedSourcesCount = invalidatedSourcesCount; - _syncedBytes = syncedBytes; - } - - bool get success => _success; - int get invalidatedSourcesCount => _invalidatedSourcesCount; - int get syncedBytes => _syncedBytes; - - /// JavaScript modules produced by the incremental compiler in `dartdevc` - /// mode. - /// - /// Only used for JavaScript compilation. - List invalidatedModules; - - void incorporateResults(UpdateFSReport report) { - if (!report._success) { - _success = false; - } - _invalidatedSourcesCount += report._invalidatedSourcesCount; - _syncedBytes += report._syncedBytes; - invalidatedModules ??= report.invalidatedModules; - } - - bool _success; - int _invalidatedSourcesCount; - int _syncedBytes; -} diff --git a/frontend_server_common/lib/src/frontend_server_client.dart b/frontend_server_common/lib/src/frontend_server_client.dart index 68f9a236b..57daa5da3 100644 --- a/frontend_server_common/lib/src/frontend_server_client.dart +++ b/frontend_server_common/lib/src/frontend_server_client.dart @@ -262,11 +262,6 @@ abstract class ResidentCompiler { CompilerMessageConsumer compilerMessageConsumer, }) = DefaultResidentCompiler; - // TODO(jonahwilliams): find a better way to configure additional file system - // roots from the runner. - // See: https://github.com/flutter/flutter/issues/50494 - void addFileSystemRoot(String root); - /// If invoked for the first time, it compiles Dart script identified by /// [mainUri], [invalidatedFiles] list is ignored. /// On successive runs [invalidatedFiles] indicates which files need to be @@ -338,11 +333,6 @@ class DefaultResidentCompiler implements ResidentCompiler { final String platformDill; final bool verbose; - @override - void addFileSystemRoot(String root) { - fileSystemRoots.add(root); - } - /// The path to the root of the Dart SDK used to compile. final String sdkRoot; diff --git a/frontend_server_common/lib/src/resident_runner.dart b/frontend_server_common/lib/src/resident_runner.dart index f5329ebe9..81c90c3cf 100644 --- a/frontend_server_common/lib/src/resident_runner.dart +++ b/frontend_server_common/lib/src/resident_runner.dart @@ -13,9 +13,7 @@ import 'package:dwds/dwds.dart'; import 'package:logging/logging.dart'; import 'package:path/path.dart' as p; -import 'asset.dart'; import 'devfs.dart'; -import 'devfs_content.dart'; import 'frontend_server_client.dart'; import 'utilities.dart'; @@ -56,7 +54,6 @@ class ResidentWebRunner { ResidentCompiler generator; ExpressionCompiler expressionCompiler; - AssetBundle assetBundle; WebDevFS devFS; Uri uri; Iterable modules; @@ -64,8 +61,6 @@ class ResidentWebRunner { Future run(String hostname, int port, String root) async { hostname ??= 'localhost'; - assetBundle = AssetBundleFactory.defaultInstance.createBundle(); - devFS = WebDevFS( fileSystem: fileSystem, hostname: hostname, @@ -90,14 +85,8 @@ class ResidentWebRunner { } Future _updateDevFS() async { - var result = await assetBundle.build(); - if (result != 0) { - return UpdateFSReport(success: false); - } - var report = await devFS.update( mainPath: mainPath, - bundle: assetBundle, dillOutputPath: outputPath, generator: generator, invalidatedFiles: []); diff --git a/frontend_server_common/lib/src/utilities.dart b/frontend_server_common/lib/src/utilities.dart index 9ca429eff..801cc600b 100644 --- a/frontend_server_common/lib/src/utilities.dart +++ b/frontend_server_common/lib/src/utilities.dart @@ -20,6 +20,5 @@ final String _sdkDir = (() { })(); final String dartSdkPath = _sdkDir; -final String dartPath = p.join(_sdkDir, 'bin', 'dart'); const fs.FileSystem fileSystem = LocalFileSystem(); From ede7871599b286950c5abfdae00ff040dd178f99 Mon Sep 17 00:00:00 2001 From: Anna Gringauze Date: Tue, 31 May 2022 14:11:52 -0700 Subject: [PATCH 02/10] Remove abstract ResidentCompiler class --- .../lib/src/frontend_server_client.dart | 106 +++++------------- 1 file changed, 28 insertions(+), 78 deletions(-) diff --git a/frontend_server_common/lib/src/frontend_server_client.dart b/frontend_server_common/lib/src/frontend_server_client.dart index 57daa5da3..9d3f92050 100644 --- a/frontend_server_common/lib/src/frontend_server_client.dart +++ b/frontend_server_common/lib/src/frontend_server_client.dart @@ -164,9 +164,9 @@ abstract class _CompilationRequest { Completer completer; - Future _run(DefaultResidentCompiler compiler); + Future _run(ResidentCompiler compiler); - Future run(DefaultResidentCompiler compiler) async { + Future run(ResidentCompiler compiler) async { completer.complete(await _run(compiler)); } } @@ -186,7 +186,7 @@ class _RecompileRequest extends _CompilationRequest { PackageConfig packageConfig; @override - Future _run(DefaultResidentCompiler compiler) async => + Future _run(ResidentCompiler compiler) async => compiler._recompile(this); } @@ -209,7 +209,7 @@ class _CompileExpressionRequest extends _CompilationRequest { bool isStatic; @override - Future _run(DefaultResidentCompiler compiler) async => + Future _run(ResidentCompiler compiler) async => compiler._compileExpression(this); } @@ -234,7 +234,7 @@ class _CompileExpressionToJsRequest extends _CompilationRequest { String expression; @override - Future _run(DefaultResidentCompiler compiler) async => + Future _run(ResidentCompiler compiler) async => compiler._compileExpressionToJs(this); } @@ -242,7 +242,7 @@ class _RejectRequest extends _CompilationRequest { _RejectRequest(Completer completer) : super(completer); @override - Future _run(DefaultResidentCompiler compiler) async => + Future _run(ResidentCompiler compiler) async => compiler._reject(); } @@ -251,70 +251,8 @@ class _RejectRequest extends _CompilationRequest { /// /// The wrapper is intended to stay resident in memory as user changes, reloads, /// restarts the Flutter app. -abstract class ResidentCompiler { - factory ResidentCompiler( - String sdkRoot, { - String packageConfigPath, - List fileSystemRoots, - String fileSystemScheme, - String platformDill, - bool verbose, - CompilerMessageConsumer compilerMessageConsumer, - }) = DefaultResidentCompiler; - - /// If invoked for the first time, it compiles Dart script identified by - /// [mainUri], [invalidatedFiles] list is ignored. - /// On successive runs [invalidatedFiles] indicates which files need to be - /// recompiled. If [mainUri] is null, previously used [mainUri] entry - /// point that is used for recompilation. - /// Binary file name is returned if compilation was successful, otherwise - /// null is returned. - Future recompile(Uri mainUri, List invalidatedFiles, - {@required String outputPath, @required PackageConfig packageConfig}); - - Future compileExpression( - String expression, - List definitions, - List typeDefinitions, - String libraryUri, - String klass, - bool isStatic, - ); - - Future compileExpressionToJs( - String libraryUri, - int line, - int column, - Map jsModules, - Map jsFrameValues, - String moduleName, - String expression); - - /// Should be invoked when results of compilation are accepted by the client. - /// - /// Either [accept] or [reject] should be called after every [recompile] call. - void accept(); - - /// Should be invoked when results of compilation are rejected by the client. - /// - /// Either [accept] or [reject] should be called after every [recompile] call. - Future reject(); - - /// Should be invoked when frontend server compiler should forget what was - /// accepted previously so that next call to [recompile] produces complete - /// kernel file. - void reset(); - - /// stop the service normally - Future shutdown(); - - /// kill the service - Future kill(); -} - -@visibleForTesting -class DefaultResidentCompiler implements ResidentCompiler { - DefaultResidentCompiler( +class ResidentCompiler { + ResidentCompiler( String sdkRoot, { this.packageConfigPath, this.fileSystemRoots, @@ -343,7 +281,13 @@ class DefaultResidentCompiler implements ResidentCompiler { final StreamController<_CompilationRequest> _controller = StreamController<_CompilationRequest>(); - @override + /// If invoked for the first time, it compiles Dart script identified by + /// [mainUri], [invalidatedFiles] list is ignored. + /// On successive runs [invalidatedFiles] indicates which files need to be + /// recompiled. If [mainUri] is null, previously used [mainUri] entry + /// point that is used for recompilation. + /// Binary file name is returned if compilation was successful, otherwise + /// null is returned. Future recompile(Uri mainUri, List invalidatedFiles, {@required String outputPath, @required PackageConfig packageConfig}) async { @@ -475,7 +419,7 @@ class DefaultResidentCompiler implements ResidentCompiler { return _stdoutHandler.compilerOutput.future; } - @override + /// Compile dart expression to kernel. Future compileExpression( String expression, List definitions, @@ -518,7 +462,7 @@ class DefaultResidentCompiler implements ResidentCompiler { return _stdoutHandler.compilerOutput.future; } - @override + /// Compiles dart expression to JavaScript. Future compileExpressionToJs( String libraryUri, int line, @@ -567,7 +511,9 @@ class DefaultResidentCompiler implements ResidentCompiler { return _stdoutHandler.compilerOutput.future; } - @override + /// Should be invoked when results of compilation are accepted by the client. + /// + /// Either [accept] or [reject] should be called after every [recompile] call. void accept() { if (_compileRequestNeedsConfirmation) { _server.stdin.writeln('accept'); @@ -576,7 +522,9 @@ class DefaultResidentCompiler implements ResidentCompiler { _compileRequestNeedsConfirmation = false; } - @override + /// Should be invoked when results of compilation are rejected by the client. + /// + /// Either [accept] or [reject] should be called after every [recompile] call. Future reject() { if (!_controller.hasListener) { _controller.stream.listen(_handleCompilationRequest); @@ -598,7 +546,9 @@ class DefaultResidentCompiler implements ResidentCompiler { return _stdoutHandler.compilerOutput.future; } - @override + /// Should be invoked when frontend server compiler should forget what was + /// accepted previously so that next call to [recompile] produces complete + /// kernel file. void reset() { _server?.stdin?.writeln('reset'); _logger.info('<- reset'); @@ -610,7 +560,7 @@ class DefaultResidentCompiler implements ResidentCompiler { return _server.exitCode; } - @override + /// stop the service normally Future shutdown() async { // Server was never successfully created. if (_server == null) { @@ -619,7 +569,7 @@ class DefaultResidentCompiler implements ResidentCompiler { return quit(); } - @override + /// kill the service Future kill() async { if (_server == null) { return 0; From e5faeec894b8e4c56bfbcb71241d419c55a4c879 Mon Sep 17 00:00:00 2001 From: Anna Gringauze Date: Tue, 31 May 2022 16:22:05 -0700 Subject: [PATCH 03/10] Migrate events and utilities to null safety --- dwds/lib/src/events.dart | 19 +++++++-------- dwds/lib/src/utilities/conversions.dart | 31 ++++++++++++++----------- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/dwds/lib/src/events.dart b/dwds/lib/src/events.dart index c1178cbed..886f00d38 100644 --- a/dwds/lib/src/events.dart +++ b/dwds/lib/src/events.dart @@ -2,19 +2,17 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -// @dart = 2.9 - import 'dart:async'; import 'package:vm_service/vm_service.dart'; class DwdsStats { /// The time when the user starts the debugger. - DateTime _debuggerStart; + late DateTime _debuggerStart; DateTime get debuggerStart => _debuggerStart; /// The time when dwds launches DevTools. - DateTime _devToolsStart; + late DateTime _devToolsStart; DateTime get devToolsStart => _devToolsStart; /// Records and returns weither the debugger is ready. @@ -25,7 +23,8 @@ class DwdsStats { return wasReady; } - void updateLoadTime({DateTime debuggerStart, DateTime devToolsStart}) { + void updateLoadTime( + {required DateTime debuggerStart, required DateTime devToolsStart}) { _debuggerStart = debuggerStart; _devToolsStart = devToolsStart; } @@ -66,14 +65,14 @@ class DwdsEvent { DwdsEvent.devtoolsLaunch() : this(DwdsEventKind.devtoolsLaunch, {}); - DwdsEvent.evaluate(String expression, Response result) + DwdsEvent.evaluate(String expression, Response? result) : this(DwdsEventKind.evaluate, { 'expression': expression, 'success': result != null && result is InstanceRef, if (result != null && result is ErrorRef) 'error': result, }); - DwdsEvent.evaluateInFrame(String expression, Response result) + DwdsEvent.evaluateInFrame(String expression, Response? result) : this(DwdsEventKind.evaluateInFrame, { 'expression': expression, 'success': result != null && result is InstanceRef, @@ -140,13 +139,13 @@ Stream get eventStream => _eventController.stream; /// and appends time and exception details to it if /// available. Future captureElapsedTime( - Future Function() function, DwdsEvent Function(T result) event) async { + Future Function() function, DwdsEvent Function(T? result) event) async { var stopwatch = Stopwatch()..start(); - T result; + T? result; try { return result = await function(); } catch (e) { - emitEvent(event(result) + emitEvent(event(null) ..addException(e) ..addElapsedTime(stopwatch.elapsedMilliseconds)); rethrow; diff --git a/dwds/lib/src/utilities/conversions.dart b/dwds/lib/src/utilities/conversions.dart index 05465fc0f..be5a22d88 100644 --- a/dwds/lib/src/utilities/conversions.dart +++ b/dwds/lib/src/utilities/conversions.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -// @dart = 2.9 - /// Functions for converting between the different object references we use. import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart'; @@ -58,16 +56,15 @@ RemoteObject remoteObjectFor(String dartId) { data['value'] = _stringFromDartId(dartId); } else if (isDoubleId(dartId)) { data['type'] = 'number'; - data['value'] = _doubleFromDartId(dartId); + data['value'] = _doubleFromDartId(dartId)!; } else if (isIntId(dartId)) { data['type'] = 'number'; - data['value'] = _intFromDartId(dartId); + data['value'] = _intFromDartId(dartId)!; } else if (isBoolId(dartId)) { data['type'] = 'boolean'; data['value'] = _boolFromDartId(dartId); } else if (dartId == _nullId) { data['type'] = 'undefined'; - data['value'] = null; } else { data['type'] = 'object'; } @@ -78,7 +75,7 @@ RemoteObject remoteObjectFor(String dartId) { /// /// This will work for simple values, RemoteObject, and Maps representations of /// RemoteObjects. -String dartIdFor(Object argument) { +String dartIdFor(Object? argument) { if (argument == null) { return _nullId; } @@ -95,10 +92,10 @@ String dartIdFor(Object argument) { return '$_prefixForStringIds$argument'; } if (argument is RemoteObject) { - return argument.objectId; + return argument.objectId ?? null.toString(); } if (argument is Map) { - var id = argument['objectId'] as String; + var id = argument['objectId'] as String?; if (id == null) { throw ArgumentError.value(argument, 'objectId', 'No objectId found'); } @@ -136,17 +133,23 @@ bool isDoubleId(String dartId) => dartId.startsWith(_prefixForDoubleIds); bool isLibraryId(String dartId) => _uriPrefixes.any(dartId.startsWith); /// A Map representing a RemoteObject for a primitive object. -Map _callArgumentForPrimitive(Object primitive) { - return {'type': _jsTypeOf(primitive), 'value': primitive}; +Map _callArgumentForPrimitive(Object? primitive) { + return { + 'type': _jsTypeOf(primitive), + if (primitive != null) 'value': primitive, + }; } /// A Map representing a RemoteObject from an actual RemoteObject. Map _callArgumentForRemote(RemoteObject remote) { - return {'type': 'object', 'objectId': remote.objectId}; + return { + 'type': 'object', + if (remote.objectId != null) 'objectId': remote.objectId!, + }; } /// The JS type name to use in a RemoteObject reference to [object]. -String _jsTypeOf(Object object) { +String _jsTypeOf(Object? object) { if (object == null) return 'undefined'; if (object is String) return 'string'; if (object is num) return 'num'; @@ -162,11 +165,11 @@ String _stringFromDartId(String dartIdForString) => dartIdForString.substring(_prefixForStringIds.length); /// Convert [dartIdForInt] to its corresponding int. -int _intFromDartId(String dartIdForInt) => +int? _intFromDartId(String dartIdForInt) => int.tryParse(dartIdForInt.substring(_prefixForIntIds.length)); /// Convert [dartIdForDouble] to its corresponding double. -double _doubleFromDartId(String dartIdForDouble) => +double? _doubleFromDartId(String dartIdForDouble) => double.tryParse(dartIdForDouble.substring(_prefixForDoubleIds.length)); /// Convert [dartIdForBool] to its corresponding boolean. From ea9360c8e872d01474f1228d63611419553443ad Mon Sep 17 00:00:00 2001 From: Anna Gringauze Date: Thu, 2 Jun 2022 17:23:45 -0700 Subject: [PATCH 04/10] Migrate some of dwds files to null safety --- dwds/CHANGELOG.md | 3 ++ dwds/lib/asset_reader.dart | 5 +++ dwds/lib/dwds.dart | 5 +-- dwds/lib/expression_compiler.dart | 6 +++ dwds/lib/src/debugging/debugger.dart | 1 + dwds/lib/src/debugging/execution_context.dart | 22 +++++----- dwds/lib/src/debugging/metadata/class.dart | 2 +- dwds/lib/src/debugging/remote_debugger.dart | 10 ++--- dwds/lib/src/debugging/webkit_debugger.dart | 12 +++-- dwds/lib/src/handlers/socket_connections.dart | 11 ++--- dwds/lib/src/readers/asset_reader.dart | 8 ++-- dwds/lib/src/servers/extension_debugger.dart | 2 +- .../src/services/chrome_debug_exception.dart | 37 ++++++++++++++++ .../src/services/chrome_proxy_service.dart | 34 -------------- .../lib/src/services/expression_compiler.dart | 7 +-- .../services/expression_compiler_service.dart | 3 +- dwds/lib/src/sockets.dart | 5 +-- dwds/lib/src/utilities/batched_stream.dart | 9 ++-- dwds/lib/src/utilities/ddc_names.dart | 4 +- dwds/lib/src/utilities/objects.dart | 18 ++++---- dwds/lib/src/utilities/sdk_configuration.dart | 44 +++++++++---------- dwds/lib/src/utilities/shared.dart | 29 ++++++------ dwds/pubspec.yaml | 2 +- 23 files changed, 138 insertions(+), 141 deletions(-) create mode 100644 dwds/lib/asset_reader.dart create mode 100644 dwds/lib/expression_compiler.dart create mode 100644 dwds/lib/src/services/chrome_debug_exception.dart diff --git a/dwds/CHANGELOG.md b/dwds/CHANGELOG.md index 7b78c142e..20ac79153 100644 --- a/dwds/CHANGELOG.md +++ b/dwds/CHANGELOG.md @@ -1,3 +1,6 @@ +## 14.0.4-dev +- Port some `dwds` files to null safety. + ## 14.0.3 - Make data types null safe. - Update `package:vm_service` to 8.3.0. diff --git a/dwds/lib/asset_reader.dart b/dwds/lib/asset_reader.dart new file mode 100644 index 000000000..e542e64ae --- /dev/null +++ b/dwds/lib/asset_reader.dart @@ -0,0 +1,5 @@ +// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +export 'src/readers/asset_reader.dart' show AssetReader, UrlEncoder; diff --git a/dwds/lib/dwds.dart b/dwds/lib/dwds.dart index 5c17a527d..88a925b23 100644 --- a/dwds/lib/dwds.dart +++ b/dwds/lib/dwds.dart @@ -40,12 +40,12 @@ export 'src/loaders/frontend_server_require.dart' export 'src/loaders/legacy.dart' show LegacyStrategy; export 'src/loaders/require.dart' show RequireStrategy; export 'src/loaders/strategy.dart' show LoadStrategy, ReloadConfiguration; -export 'src/readers/asset_reader.dart' show AssetReader; +export 'src/readers/asset_reader.dart' show AssetReader, UrlEncoder; export 'src/readers/frontend_server_asset_reader.dart' show FrontendServerAssetReader; export 'src/readers/proxy_server_asset_reader.dart' show ProxyServerAssetReader; export 'src/servers/devtools.dart'; -export 'src/services/chrome_proxy_service.dart' show ChromeDebugException; +export 'src/services/chrome_debug_exception.dart' show ChromeDebugException; export 'src/services/expression_compiler.dart' show ExpressionCompilationResult, ExpressionCompiler, ModuleInfo; export 'src/services/expression_compiler_service.dart' @@ -54,7 +54,6 @@ export 'src/utilities/sdk_configuration.dart' show SdkConfiguration, SdkConfigurationProvider; typedef ConnectionProvider = Future Function(); -typedef UrlEncoder = Future Function(String url); /// The Dart Web Debug Service. class Dwds { diff --git a/dwds/lib/expression_compiler.dart b/dwds/lib/expression_compiler.dart new file mode 100644 index 000000000..1bce79920 --- /dev/null +++ b/dwds/lib/expression_compiler.dart @@ -0,0 +1,6 @@ +// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +export 'src/services/expression_compiler.dart' + show ExpressionCompilationResult, ExpressionCompiler, ModuleInfo; diff --git a/dwds/lib/src/debugging/debugger.dart b/dwds/lib/src/debugging/debugger.dart index dd9e02426..b44e6f3b1 100644 --- a/dwds/lib/src/debugging/debugger.dart +++ b/dwds/lib/src/debugging/debugger.dart @@ -16,6 +16,7 @@ import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart' import '../loaders/strategy.dart'; import '../services/chrome_proxy_service.dart'; +import '../services/chrome_debug_exception.dart'; import '../utilities/conversions.dart'; import '../utilities/dart_uri.dart'; import '../utilities/domain.dart'; diff --git a/dwds/lib/src/debugging/execution_context.dart b/dwds/lib/src/debugging/execution_context.dart index e04bb58d2..64b9a3af2 100644 --- a/dwds/lib/src/debugging/execution_context.dart +++ b/dwds/lib/src/debugging/execution_context.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -// @dart = 2.9 - import 'dart:async'; import 'package:async/async.dart'; @@ -22,13 +20,13 @@ class RemoteDebuggerExecutionContext extends ExecutionContext { final _logger = Logger('RemoteDebuggerExecutionContext'); // Contexts that may contain a Dart application. - StreamQueue _contexts; + late StreamQueue _contexts; - int _id; + int? _id; @override Future get id async { - if (_id != null) return _id; + if (_id != null) return _id!; _logger.fine('Looking for Dart execution context...'); while (await _contexts.hasNext .timeout(const Duration(milliseconds: 50), onTimeout: () => false)) { @@ -40,7 +38,7 @@ class RemoteDebuggerExecutionContext extends ExecutionContext { 'expression': r'window["$dartAppInstanceId"];', 'contextId': context, }); - if (result.result['result']['value'] != null) { + if (result.result?['result']?['value'] != null) { _logger.fine('Found valid execution context: $context'); _id = context; break; @@ -54,18 +52,18 @@ class RemoteDebuggerExecutionContext extends ExecutionContext { if (_id == null) { throw StateError('No context with the running Dart application.'); } - return _id; + return _id!; } RemoteDebuggerExecutionContext(this._id, this._remoteDebugger) { - var contextController = StreamController(); + var contextController = StreamController(); _remoteDebugger .eventStream('Runtime.executionContextsCleared', (e) => e) .listen((_) => _id = null); - _remoteDebugger - .eventStream('Runtime.executionContextCreated', - (e) => int.parse(e.params['context']['id'].toString())) - .listen(contextController.add); + _remoteDebugger.eventStream('Runtime.executionContextCreated', (e) { + var id = e.params?['context']?['id']?.toString(); + return id == null ? null : int.parse(id); + }).listen(contextController.add); _contexts = StreamQueue(contextController.stream); } } diff --git a/dwds/lib/src/debugging/metadata/class.dart b/dwds/lib/src/debugging/metadata/class.dart index 5c2a0de35..85245b665 100644 --- a/dwds/lib/src/debugging/metadata/class.dart +++ b/dwds/lib/src/debugging/metadata/class.dart @@ -11,7 +11,7 @@ import '../../debugging/classes.dart'; import '../../debugging/inspector.dart'; import '../../debugging/remote_debugger.dart'; import '../../loaders/strategy.dart'; -import '../../services/chrome_proxy_service.dart'; +import '../../services/chrome_debug_exception.dart'; /// Meta data for a remote Dart class in Chrome. class ClassMetaData { diff --git a/dwds/lib/src/debugging/remote_debugger.dart b/dwds/lib/src/debugging/remote_debugger.dart index 6520c8e27..8a2da79d4 100644 --- a/dwds/lib/src/debugging/remote_debugger.dart +++ b/dwds/lib/src/debugging/remote_debugger.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -// @dart = 2.9 - import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart'; class TargetCrashedEvent extends WipEvent { @@ -31,7 +29,7 @@ abstract class RemoteDebugger { Stream get onClose; Future sendCommand(String command, - {Map params}); + {Map? params}); Future disable(); @@ -47,18 +45,18 @@ abstract class RemoteDebugger { Future removeBreakpoint(String breakpointId); - Future stepInto({Map params}); + Future stepInto({Map? params}); Future stepOut(); - Future stepOver({Map params}); + Future stepOver({Map? params}); Future enablePage(); Future pageReload(); Future evaluate(String expression, - {bool returnByValue, int contextId}); + {bool? returnByValue, int? contextId}); Future evaluateOnCallFrame( String callFrameId, String expression); diff --git a/dwds/lib/src/debugging/webkit_debugger.dart b/dwds/lib/src/debugging/webkit_debugger.dart index e9b474b04..98b2dc546 100644 --- a/dwds/lib/src/debugging/webkit_debugger.dart +++ b/dwds/lib/src/debugging/webkit_debugger.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -// @dart = 2.9 - import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart'; import 'remote_debugger.dart'; @@ -15,7 +13,7 @@ class WebkitDebugger implements RemoteDebugger { /// Null until [close] is called. /// /// All subsequent calls to [close] will return this future. - Future _closed; + Future? _closed; WebkitDebugger(this._wipDebugger); @@ -29,7 +27,7 @@ class WebkitDebugger implements RemoteDebugger { @override Future sendCommand(String command, - {Map params}) => + {Map? params}) => _wipDebugger.sendCommand(command, params: params); @override @@ -60,14 +58,14 @@ class WebkitDebugger implements RemoteDebugger { _wipDebugger.removeBreakpoint(breakpointId); @override - Future stepInto({Map params}) => + Future stepInto({Map? params}) => _wipDebugger.stepInto(params: params); @override Future stepOut() => _wipDebugger.stepOut(); @override - Future stepOver({Map params}) => + Future stepOver({Map? params}) => _wipDebugger.stepOver(params: params); @override @@ -78,7 +76,7 @@ class WebkitDebugger implements RemoteDebugger { @override Future evaluate(String expression, - {bool returnByValue, int contextId}) { + {bool? returnByValue, int? contextId}) { return _wipDebugger.connection.runtime .evaluate(expression, returnByValue: returnByValue); } diff --git a/dwds/lib/src/handlers/socket_connections.dart b/dwds/lib/src/handlers/socket_connections.dart index 330a4e4ba..752fe385c 100644 --- a/dwds/lib/src/handlers/socket_connections.dart +++ b/dwds/lib/src/handlers/socket_connections.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -// @dart = 2.9 - import 'dart:async'; import 'package:async/async.dart'; @@ -56,7 +54,7 @@ class SseSocketHandler extends SocketHandler { final SseHandler _sseHandler; final StreamController _connectionsStream = StreamController(); - StreamQueue _connectionsStreamQueue; + StreamQueue? _connectionsStreamQueue; SseSocketHandler(this._sseHandler) { unawaited(() async { @@ -90,8 +88,7 @@ class WebSocketConnection extends SocketConnection { StreamSink get sink => _channel.sink; @override - Stream get stream => - _channel.stream.map((dynamic o) => o?.toString()); + Stream get stream => _channel.stream.map((dynamic o) => o.toString()); @override void shutdown() => _channel.sink.close(); @@ -100,10 +97,10 @@ class WebSocketConnection extends SocketConnection { /// An implemenation of [SocketHandler] that accepts WebSocket connections and /// wraps them in a [WebSocketConnection]. class WebSocketSocketHandler extends SocketHandler { - Handler _handler; + late Handler _handler; final StreamController _connectionsStream = StreamController(); - StreamQueue _connectionsStreamQueue; + StreamQueue? _connectionsStreamQueue; WebSocketSocketHandler() { _handler = webSocketHandler((WebSocketChannel channel) => diff --git a/dwds/lib/src/readers/asset_reader.dart b/dwds/lib/src/readers/asset_reader.dart index 5d8764185..55824fc99 100644 --- a/dwds/lib/src/readers/asset_reader.dart +++ b/dwds/lib/src/readers/asset_reader.dart @@ -2,20 +2,20 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -// @dart = 2.9 +typedef UrlEncoder = Future Function(String url); /// A reader for Dart sources and related source maps. abstract class AssetReader { /// Returns the contents for a source map at the provided server path, or /// null if the resource does not exist. - Future sourceMapContents(String serverPath); + Future sourceMapContents(String serverPath); /// Returns the contents for a dart source at the provided server path, or /// null if the resource does not exist. - Future dartSourceContents(String serverPath); + Future dartSourceContents(String serverPath); /// Returns the contents for the merged metadata output at the provided path. - Future metadataContents(String serverPath); + Future metadataContents(String serverPath); /// Closes connections Future close(); diff --git a/dwds/lib/src/servers/extension_debugger.dart b/dwds/lib/src/servers/extension_debugger.dart index 854b2c704..830775655 100644 --- a/dwds/lib/src/servers/extension_debugger.dart +++ b/dwds/lib/src/servers/extension_debugger.dart @@ -16,7 +16,7 @@ import '../../data/serializers.dart'; import '../debugging/execution_context.dart'; import '../debugging/remote_debugger.dart'; import '../handlers/socket_connections.dart'; -import '../services/chrome_proxy_service.dart'; +import '../services/chrome_debug_exception.dart'; /// A remote debugger backed by the Dart Debug Extension with an SSE connection. class ExtensionDebugger implements RemoteDebugger { diff --git a/dwds/lib/src/services/chrome_debug_exception.dart b/dwds/lib/src/services/chrome_debug_exception.dart new file mode 100644 index 000000000..5fc41f92e --- /dev/null +++ b/dwds/lib/src/services/chrome_debug_exception.dart @@ -0,0 +1,37 @@ +// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart'; + +class ChromeDebugException extends ExceptionDetails implements Exception { + /// Optional, additional information about the exception. + final Object? additionalDetails; + + /// Optional, the exact contents of the eval that was attempted. + final String? evalContents; + + ChromeDebugException(Map exceptionDetails, + {this.additionalDetails, this.evalContents}) + : super(exceptionDetails); + + @override + String toString() { + var description = StringBuffer() + ..writeln('Unexpected error from chrome devtools:'); + description.writeln('text: $text'); + if (exception != null) { + description.writeln('exception:'); + description.writeln(' description: ${exception?.description}'); + description.writeln(' type: ${exception?.type}'); + description.writeln(' value: ${exception?.value}'); + } + if (evalContents != null) { + description.writeln('attempted JS eval: `$evalContents`'); + } + if (additionalDetails != null) { + description.writeln('additional details:\n $additionalDetails'); + } + return description.toString(); + } +} diff --git a/dwds/lib/src/services/chrome_proxy_service.dart b/dwds/lib/src/services/chrome_proxy_service.dart index c8bc51ade..141c2e97b 100644 --- a/dwds/lib/src/services/chrome_proxy_service.dart +++ b/dwds/lib/src/services/chrome_proxy_service.dart @@ -1097,37 +1097,3 @@ const _stderrTypes = ['error']; /// The `type`s of [ConsoleAPIEvent]s that are treated as `stdout` logs. const _stdoutTypes = ['log', 'info', 'warning']; - -class ChromeDebugException extends ExceptionDetails implements Exception { - /// Optional, additional information about the exception. - final Object additionalDetails; - - /// Optional, the exact contents of the eval that was attempted. - final String evalContents; - - ChromeDebugException(Map exceptionDetails, - {this.additionalDetails, this.evalContents}) - : super(exceptionDetails); - - @override - String toString() { - var description = StringBuffer() - ..writeln('Unexpected error from chrome devtools:'); - if (text != null) { - description.writeln('text: $text'); - } - if (exception != null) { - description.writeln('exception:'); - description.writeln(' description: ${exception.description}'); - description.writeln(' type: ${exception.type}'); - description.writeln(' value: ${exception.value}'); - } - if (evalContents != null) { - description.writeln('attempted JS eval: `$evalContents`'); - } - if (additionalDetails != null) { - description.writeln('additional details:\n $additionalDetails'); - } - return description.toString(); - } -} diff --git a/dwds/lib/src/services/expression_compiler.dart b/dwds/lib/src/services/expression_compiler.dart index db3b55f18..4af38c114 100644 --- a/dwds/lib/src/services/expression_compiler.dart +++ b/dwds/lib/src/services/expression_compiler.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -// @dart = 2.9 - /// Result of compilation of dart expression to JavaScript class ExpressionCompilationResult { final bool isError; @@ -69,7 +67,10 @@ abstract class ExpressionCompiler { /// Initializes the compiler with null safety mode and module format. /// /// May be called multiple times and always before [updateDependencies]. - Future initialize({String moduleFormat, bool soundNullSafety}); + Future initialize({ + required String moduleFormat, + bool soundNullSafety = false, + }); } class ModuleInfo { diff --git a/dwds/lib/src/services/expression_compiler_service.dart b/dwds/lib/src/services/expression_compiler_service.dart index eb82bcc37..aac744211 100644 --- a/dwds/lib/src/services/expression_compiler_service.dart +++ b/dwds/lib/src/services/expression_compiler_service.dart @@ -261,7 +261,8 @@ class ExpressionCompilerService implements ExpressionCompiler { line, column, jsModules, jsFrameValues, moduleName, expression); @override - Future initialize({String moduleFormat, bool soundNullSafety}) async { + Future initialize( + {String moduleFormat, bool soundNullSafety = false}) async { if (_compiler.isCompleted) return; soundNullSafety ??= false; diff --git a/dwds/lib/src/sockets.dart b/dwds/lib/src/sockets.dart index c802c1584..016448f9f 100644 --- a/dwds/lib/src/sockets.dart +++ b/dwds/lib/src/sockets.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// @dart = 2.9 - import 'dart:async'; import 'package:sse/client/sse_client.dart'; @@ -37,8 +35,7 @@ class WebSocketClient extends SocketClient { @override StreamSink get sink => _channel.sink; @override - Stream get stream => - _channel.stream.map((dynamic o) => o?.toString()); + Stream get stream => _channel.stream.map((dynamic o) => o.toString()); @override void close() => _channel.sink.close(); diff --git a/dwds/lib/src/utilities/batched_stream.dart b/dwds/lib/src/utilities/batched_stream.dart index cfe837a92..eb5bdbf8f 100644 --- a/dwds/lib/src/utilities/batched_stream.dart +++ b/dwds/lib/src/utilities/batched_stream.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -// @dart = 2.9 - import 'dart:async'; import 'package:async/async.dart'; @@ -14,10 +12,10 @@ class BatchedStreamController { final int _batchDelayMilliseconds; - StreamController _inputController; - StreamQueue _inputQueue; + late StreamController _inputController; + late StreamQueue _inputQueue; - StreamController> _outputController; + late StreamController> _outputController; final Completer _completer = Completer(); /// Create batched stream controller. @@ -30,7 +28,6 @@ class BatchedStreamController { _inputController = StreamController(); _inputQueue = StreamQueue(_inputController.stream); _outputController = StreamController>(); - unawaited(_batchAndSendEvents()); } diff --git a/dwds/lib/src/utilities/ddc_names.dart b/dwds/lib/src/utilities/ddc_names.dart index b5b5436bd..e55823be5 100644 --- a/dwds/lib/src/utilities/ddc_names.dart +++ b/dwds/lib/src/utilities/ddc_names.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -// @dart = 2.9 - import 'package:path/path.dart' as p; /// Transforms a path to a valid JS identifier. @@ -31,7 +29,7 @@ String toJSIdentifier(String name) { if (name.isEmpty) return r'$'; // Escape any invalid characters - StringBuffer buffer; + StringBuffer? buffer; for (var i = 0; i < name.length; i++) { var ch = name[i]; var needsEscape = ch == r'$' || _invalidCharInIdentifier.hasMatch(ch); diff --git a/dwds/lib/src/utilities/objects.dart b/dwds/lib/src/utilities/objects.dart index fbfd48c89..5d67a85c8 100644 --- a/dwds/lib/src/utilities/objects.dart +++ b/dwds/lib/src/utilities/objects.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file.import 'dart:async'; -// @dart = 2.9 - /// A library for WebKit mirror objects and support code. These probably should /// get migrated into webkit_inspection_protocol over time. @@ -11,26 +9,26 @@ import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart'; /// Represents a property of an object. class Property { - final Map _map; + final Map? _map; - RemoteObject _remoteObjectValue; + RemoteObject? _remoteObjectValue; Property(this._map); - Map get map => _map; + Map? get map => _map; /// The remote object value in unwrapped form. /// /// Useful for getting access to properties of particular types of /// RemoteObject. - Object get rawValue => _map == null ? null : _map['value']; + Object? get rawValue => _map == null ? null : _map!['value']; /// Remote object value in case of primitive values or JSON values (if it was /// requested). (optional) - RemoteObject get value { - if (_remoteObjectValue != null) return _remoteObjectValue; + RemoteObject? get value { + if (_remoteObjectValue != null) return _remoteObjectValue!; if (rawValue == null) return null; - var val = _map['value']; + var val = _map!['value']; if (val is RemoteObject) { _remoteObjectValue = val; } else { @@ -56,7 +54,7 @@ class Property { /// The raw name of the property in JS. /// /// Will be of the form 'Symbol(_actualName)' for private fields. - String get rawName => _map['name'] as String; + String get rawName => _map!['name'] as String; @override String toString() => '$name $value'; diff --git a/dwds/lib/src/utilities/sdk_configuration.dart b/dwds/lib/src/utilities/sdk_configuration.dart index 114e18f66..4a83e37f7 100644 --- a/dwds/lib/src/utilities/sdk_configuration.dart +++ b/dwds/lib/src/utilities/sdk_configuration.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -// @dart=2.9 - import 'dart:io'; import 'package:file/file.dart'; @@ -11,7 +9,7 @@ import 'package:file/local.dart'; import 'package:path/path.dart' as p; class InvalidSdkConfigurationException implements Exception { - final String message; + final String? message; InvalidSdkConfigurationException([this.message]); @@ -38,11 +36,11 @@ abstract class SdkConfigurationProvider { /// Call [validate] method to make sure the files in the configuration /// layout exist before reading the files. class SdkConfiguration { - String sdkDirectory; - String unsoundSdkSummaryPath; - String soundSdkSummaryPath; - String librariesPath; - String compilerWorkerPath; + String? sdkDirectory; + String? unsoundSdkSummaryPath; + String? soundSdkSummaryPath; + String? librariesPath; + String? compilerWorkerPath; SdkConfiguration({ this.sdkDirectory, @@ -52,21 +50,21 @@ class SdkConfiguration { this.compilerWorkerPath, }); - static Uri _toUri(String path) => path == null ? null : p.toUri(path); - static Uri _toAbsoluteUri(String path) => + static Uri? _toUri(String? path) => path == null ? null : p.toUri(path); + static Uri? _toAbsoluteUri(String? path) => path == null ? null : p.toUri(p.absolute(path)); - Uri get sdkDirectoryUri => _toUri(sdkDirectory); - Uri get soundSdkSummaryUri => _toUri(soundSdkSummaryPath); - Uri get unsoundSdkSummaryUri => _toUri(unsoundSdkSummaryPath); - Uri get librariesUri => _toUri(librariesPath); + Uri? get sdkDirectoryUri => _toUri(sdkDirectory); + Uri? get soundSdkSummaryUri => _toUri(soundSdkSummaryPath); + Uri? get unsoundSdkSummaryUri => _toUri(unsoundSdkSummaryPath); + Uri? get librariesUri => _toUri(librariesPath); /// Note: has to be ///file: Uri to run in an isolate. - Uri get compilerWorkerUri => _toAbsoluteUri(compilerWorkerPath); + Uri? get compilerWorkerUri => _toAbsoluteUri(compilerWorkerPath); /// Throws [InvalidSdkConfigurationException] if configuration does not /// exist on disk. - void validate({FileSystem fileSystem}) { + void validate({FileSystem? fileSystem}) { fileSystem ??= const LocalFileSystem(); validateSdkDir(fileSystem: fileSystem); @@ -77,7 +75,7 @@ class SdkConfiguration { /// Throws [InvalidSdkConfigurationException] if SDK root does not /// exist on the disk. - void validateSdkDir({FileSystem fileSystem}) { + void validateSdkDir({FileSystem? fileSystem}) { fileSystem ??= const LocalFileSystem(); if (sdkDirectory == null || !fileSystem.directory(sdkDirectory).existsSync()) { @@ -86,7 +84,7 @@ class SdkConfiguration { } } - void validateSummaries({FileSystem fileSystem}) { + void validateSummaries({FileSystem? fileSystem}) { fileSystem ??= const LocalFileSystem(); if (unsoundSdkSummaryPath == null || @@ -102,7 +100,7 @@ class SdkConfiguration { } } - void validateLibrariesSpec({FileSystem fileSystem}) { + void validateLibrariesSpec({FileSystem? fileSystem}) { fileSystem ??= const LocalFileSystem(); if (librariesPath == null || !fileSystem.file(librariesPath).existsSync()) { @@ -111,7 +109,7 @@ class SdkConfiguration { } } - void validateCompilerWorker({FileSystem fileSystem}) { + void validateCompilerWorker({FileSystem? fileSystem}) { fileSystem ??= const LocalFileSystem(); if (compilerWorkerPath == null || @@ -124,10 +122,10 @@ class SdkConfiguration { /// Implementation for the default SDK configuration layout. class DefaultSdkConfigurationProvider extends SdkConfigurationProvider { - SdkConfiguration _configuration; - DefaultSdkConfigurationProvider(); + SdkConfiguration? _configuration; + /// Create and validate configuration matching the default SDK layout. @override Future get configuration async { @@ -146,6 +144,6 @@ class DefaultSdkConfigurationProvider extends SdkConfigurationProvider { p.join(binDir, 'snapshots', 'dartdevc.dart.snapshot'), ); } - return _configuration; + return _configuration!; } } diff --git a/dwds/lib/src/utilities/shared.dart b/dwds/lib/src/utilities/shared.dart index 613b64a6f..78a2663d9 100644 --- a/dwds/lib/src/utilities/shared.dart +++ b/dwds/lib/src/utilities/shared.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -// @dart = 2.9 - import 'dart:async'; import 'dart:io'; @@ -15,7 +13,7 @@ import 'package:vm_service/vm_service.dart'; import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart' as wip; -import '../../dwds.dart' show ChromeDebugException; +import 'package:dwds/src/services/chrome_debug_exception.dart'; VMRef toVMRef(VM vm) => VMRef(name: vm.name); @@ -28,11 +26,12 @@ String createId() { /// Returns `true` if [hostname] is bound to an IPv6 address. Future useIPv6ForHost(String hostname) async { final addresses = await InternetAddress.lookup(hostname); + if (addresses.isEmpty) return false; final address = addresses.firstWhere( (a) => a.type == InternetAddressType.IPv6, - orElse: () => null, + orElse: () => addresses.first, ); - return address != null; + return address.type == InternetAddressType.IPv6; } /// Returns a port that is probably, but not definitely, not in use. @@ -58,23 +57,23 @@ Future findUnusedPort() async { /// Retries a few times to recover from errors due to /// another thread or process opening the same port. /// Starts by trying to bind to [port] if specified. -Future startHttpServer(String hostname, {int port}) async { - HttpServer httpServer; +Future startHttpServer(String hostname, {int? port}) async { + HttpServer? httpServer; var retries = 5; var i = 0; port = port ?? await findUnusedPort(); while (i < retries) { i++; try { - httpServer = await HttpMultiServer.bind(hostname, port); + httpServer = await HttpMultiServer.bind(hostname, port!); } on SocketException { if (i == retries) rethrow; } - if (httpServer != null || i == retries) return httpServer; + if (httpServer != null || i == retries) return httpServer!; port = await findUnusedPort(); await Future.delayed(const Duration(milliseconds: 100)); } - return httpServer; + return httpServer!; } /// Handles [requests] using [handler]. @@ -90,12 +89,12 @@ void serveHttpRequests(Stream requests, Handler handler, /// Throws an [wip.ExceptionDetails] object if `exceptionDetails` is present on the /// result. -void handleErrorIfPresent(wip.WipResponse response, - {String evalContents, Object additionalDetails}) { - if (response == null) return; - if (response.result.containsKey('exceptionDetails')) { +void handleErrorIfPresent(wip.WipResponse? response, + {String? evalContents, Object? additionalDetails}) { + if (response == null || response.result == null) return; + if (response.result!.containsKey('exceptionDetails')) { throw ChromeDebugException( - response.result['exceptionDetails'] as Map, + response.result!['exceptionDetails'] as Map, evalContents: evalContents, additionalDetails: additionalDetails); } diff --git a/dwds/pubspec.yaml b/dwds/pubspec.yaml index 471750663..2694a79f6 100644 --- a/dwds/pubspec.yaml +++ b/dwds/pubspec.yaml @@ -1,6 +1,6 @@ name: dwds # Every time this changes you need to run `dart run build_runner build`. -version: 14.0.3 +version: 14.0.4-dev description: >- A service that proxies between the Chrome debug protocol and the Dart VM service protocol. From 19f7933138706a7a1901564741c1ad45c689cc90 Mon Sep 17 00:00:00 2001 From: Anna Gringauze Date: Thu, 2 Jun 2022 17:34:31 -0700 Subject: [PATCH 05/10] Update test infrastructure code --- frontend_server_common/lib/src/frontend_server_client.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend_server_common/lib/src/frontend_server_client.dart b/frontend_server_common/lib/src/frontend_server_client.dart index 9d3f92050..d534ea891 100644 --- a/frontend_server_common/lib/src/frontend_server_client.dart +++ b/frontend_server_common/lib/src/frontend_server_client.dart @@ -613,7 +613,8 @@ class TestExpressionCompiler implements ExpressionCompiler { true; @override - Future initialize({String moduleFormat, bool soundNullSafety}) async {} + Future initialize( + {String moduleFormat, bool soundNullSafety = false}) async {} } /// Convert a file URI into a multi-root scheme URI if provided, otherwise From 2d8723a39faf718d2e8e2e25f750d818fac48857 Mon Sep 17 00:00:00 2001 From: Anna Gringauze Date: Thu, 2 Jun 2022 17:38:30 -0700 Subject: [PATCH 06/10] Built --- dwds/lib/src/injected/client.js | 605 ++++++++++++++++++++------------ dwds/lib/src/version.dart | 2 +- 2 files changed, 385 insertions(+), 222 deletions(-) diff --git a/dwds/lib/src/injected/client.js b/dwds/lib/src/injected/client.js index 3bb8773af..cfbd254fe 100644 --- a/dwds/lib/src/injected/client.js +++ b/dwds/lib/src/injected/client.js @@ -1,4 +1,4 @@ -// Generated by dart2js (NullSafetyMode.unsound, csp), the Dart to JavaScript compiler version: 2.17.3. +// Generated by dart2js (NullSafetyMode.unsound, csp), the Dart to JavaScript compiler version: 2.18.0-159.0.dev. // The code supports the following hooks: // dartPrint(message): // if this function is defined it is called instead of the Dart [print] @@ -245,7 +245,10 @@ return new A.LateError("Field '" + A.S(fieldName) + "' has been assigned during initialization."); }, LateError$fieldNI(fieldName) { - return new A.LateError("Field '" + fieldName + "' has not been initialized."); + return new A.LateError("Field '" + A.S(fieldName) + "' has not been initialized."); + }, + LateError$fieldAI(fieldName) { + return new A.LateError("Field '" + A.S(fieldName) + "' has already been initialized."); }, ReachabilityError$(_message) { return new A.ReachabilityError(_message); @@ -1870,6 +1873,12 @@ _.__js_helper$_index = t2; _.__js_helper$_current = null; }, + throwLateFieldNI(fieldName) { + return A.throwExpression(A.LateError$fieldNI(fieldName)); + }, + throwLateFieldAI(fieldName) { + return A.throwExpression(A.LateError$fieldAI(fieldName)); + }, throwLateFieldADI(fieldName) { return A.throwExpression(A.LateError$fieldADI(fieldName)); }, @@ -1877,19 +1886,6 @@ var t1 = new A._Cell(_name); return t1.__late_helper$_value = t1; }, - _lateReadCheck(value, $name) { - if (value === $) - throw A.wrapException(A.LateError$fieldNI($name)); - return value; - }, - _lateWriteOnceCheck(value, $name) { - if (value !== $) - throw A.wrapException(new A.LateError("Field '" + $name + "' has already been initialized.")); - }, - _lateInitializeOnceCheck(value, $name) { - if (value !== $) - throw A.wrapException(A.LateError$fieldADI($name)); - }, _Cell: function _Cell(t0) { this.__late_helper$_name = t0; this.__late_helper$_value = null; @@ -4248,30 +4244,6 @@ this.$function = t1; this.$ti = t2; }, - _RunNullaryZoneFunction: function _RunNullaryZoneFunction(t0, t1) { - this.zone = t0; - this.$function = t1; - }, - _RunUnaryZoneFunction: function _RunUnaryZoneFunction(t0, t1) { - this.zone = t0; - this.$function = t1; - }, - _RunBinaryZoneFunction: function _RunBinaryZoneFunction(t0, t1) { - this.zone = t0; - this.$function = t1; - }, - _RegisterNullaryZoneFunction: function _RegisterNullaryZoneFunction(t0, t1) { - this.zone = t0; - this.$function = t1; - }, - _RegisterUnaryZoneFunction: function _RegisterUnaryZoneFunction(t0, t1) { - this.zone = t0; - this.$function = t1; - }, - _RegisterBinaryZoneFunction: function _RegisterBinaryZoneFunction(t0, t1) { - this.zone = t0; - this.$function = t1; - }, _ZoneSpecification: function _ZoneSpecification(t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12) { var _ = this; _.handleUncaughtError = t0; @@ -7522,9 +7494,6 @@ jsPromise.then(A.convertDartClosureToJS(new A.promiseToFuture_closure(completer, $T), 1), A.convertDartClosureToJS(new A.promiseToFuture_closure0(completer), 1)); return t1; }, - NullRejectionException: function NullRejectionException(t0) { - this.isUndefined = t0; - }, promiseToFuture_closure: function promiseToFuture_closure(t0, t1) { this.completer = t0; this.T = t1; @@ -7532,6 +7501,9 @@ promiseToFuture_closure0: function promiseToFuture_closure0(t0) { this.completer = t0; }, + NullRejectionException: function NullRejectionException(t0) { + this.isUndefined = t0; + }, Random_Random(seed) { var t1; if (seed == null) @@ -8321,7 +8293,7 @@ BatchedStreamController: function BatchedStreamController(t0, t1, t2) { var _ = this; _._batchDelayMilliseconds = t0; - _._outputController = _._inputQueue = _._inputController = null; + _.__BatchedStreamController__outputController = _.__BatchedStreamController__inputQueue = _.__BatchedStreamController__inputController = $; _._completer = t1; _.$ti = t2; }, @@ -8604,7 +8576,7 @@ Uuid: function Uuid() { }, HtmlWebSocketChannel$connect(url, protocols) { - var t2, t3, localToForeignController, foreignToLocalController, t4, t5, t6, _null = null, + var t2, t3, localToForeignController, foreignToLocalController, t4, t5, _null = null, t1 = A.WebSocket_WebSocket(url.toString$0(0), protocols); B.WebSocket_methods.set$binaryType(t1, "arraybuffer"); t2 = new A.StreamChannelController(type$.StreamChannelController_dynamic); @@ -8613,11 +8585,10 @@ foreignToLocalController = A.StreamController_StreamController(_null, _null, true, t3); t4 = A._instanceType(foreignToLocalController); t5 = A._instanceType(localToForeignController); - t6 = A.GuaranteeChannel$(new A._ControllerStream(foreignToLocalController, t4._eval$1("_ControllerStream<1>")), new A._StreamSinkWrapper(localToForeignController, t5._eval$1("_StreamSinkWrapper<1>")), true, t3); - A._lateWriteOnceCheck($, "_local"); - t2.set$__StreamChannelController__local(t6); + t2.set$__StreamChannelController__local(A.GuaranteeChannel$(new A._ControllerStream(foreignToLocalController, t4._eval$1("_ControllerStream<1>")), new A._StreamSinkWrapper(localToForeignController, t5._eval$1("_StreamSinkWrapper<1>")), true, t3)); t3 = A.GuaranteeChannel$(new A._ControllerStream(localToForeignController, t5._eval$1("_ControllerStream<1>")), new A._StreamSinkWrapper(foreignToLocalController, t4._eval$1("_StreamSinkWrapper<1>")), false, t3); - A._lateWriteOnceCheck(t2.__StreamChannelController__foreign, "_foreign"); + if (t2.__StreamChannelController__foreign !== $) + A.throwLateFieldAI("_foreign"); t2.set$__StreamChannelController__foreign(t3); t2 = new A.HtmlWebSocketChannel(t1, t2); t2.HtmlWebSocketChannel$1(t1); @@ -9113,9 +9084,6 @@ _removeEventListener$3$x(receiver, a0, a1, a2) { return J.getInterceptor$x(receiver)._removeEventListener$3(receiver, a0, a1, a2); }, - add$1$ax(receiver, a0) { - return J.getInterceptor$ax(receiver).add$1(receiver, a0); - }, addEventListener$3$x(receiver, a0, a1, a2) { return J.getInterceptor$x(receiver).addEventListener$3(receiver, a0, a1, a2); }, @@ -9179,9 +9147,6 @@ remove$0$x(receiver) { return J.getInterceptor$x(receiver).remove$0(receiver); }, - remove$1$x(receiver, a0) { - return J.getInterceptor$x(receiver).remove$1(receiver, a0); - }, skip$1$ax(receiver, a0) { return J.getInterceptor$ax(receiver).skip$1(receiver, a0); }, @@ -9389,6 +9354,11 @@ for (i = 0; i < len; ++i) receiver.push(array[i]); }, + clear$0(receiver) { + if (!!receiver.fixed$length) + A.throwExpression(A.UnsupportedError$("clear")); + receiver.length = 0; + }, forEach$1(receiver, f) { var end, i; A._arrayInstanceType(receiver)._eval$1("~(1)")._as(f); @@ -9542,13 +9512,6 @@ get$length(receiver) { return receiver.length; }, - set$length(receiver, newLength) { - if (!!receiver.fixed$length) - A.throwExpression(A.UnsupportedError$("set length")); - if (newLength < 0) - throw A.wrapException(A.RangeError$range(newLength, 0, null, "newLength", null)); - receiver.length = newLength; - }, $index(receiver, index) { if (!A._isInt(index)) throw A.wrapException(A.diagnoseIndexError(receiver, index)); @@ -9778,23 +9741,14 @@ }; J.JSInt.prototype = { get$bitLength(receiver) { - var wordBits, i, + var wordBits, t1 = receiver < 0 ? -receiver - 1 : receiver, nonneg = t1; for (wordBits = 32; nonneg >= 4294967296;) { nonneg = this._tdivFast$1(nonneg, 4294967296); wordBits += 32; } - i = nonneg | nonneg >> 1; - i |= i >> 2; - i |= i >> 4; - i |= i >> 8; - i = (i | i >> 16) >>> 0; - i = (i >>> 0) - (i >>> 1 & 1431655765); - i = (i & 858993459) + (i >>> 2 & 858993459); - i = i + (i >>> 4) & 252645135; - i += i >>> 8; - return wordBits - (32 - (i + (i >>> 16) & 63)); + return wordBits - Math.clz32(nonneg); }, get$runtimeType(receiver) { return B.Type_int_tHn; @@ -12869,12 +12823,6 @@ } }; A._ZoneFunction.prototype = {}; - A._RunNullaryZoneFunction.prototype = {}; - A._RunUnaryZoneFunction.prototype = {}; - A._RunBinaryZoneFunction.prototype = {}; - A._RegisterNullaryZoneFunction.prototype = {}; - A._RegisterUnaryZoneFunction.prototype = {}; - A._RegisterBinaryZoneFunction.prototype = {}; A._ZoneSpecification.prototype = {$isZoneSpecification: 1}; A._ZoneDelegate.prototype = {$isZoneDelegate: 1}; A._Zone.prototype = { @@ -13140,22 +13088,22 @@ }; A._RootZone.prototype = { get$_run() { - return B._RunNullaryZoneFunction__RootZone__rootRun; + return B._ZoneFunction__RootZone__rootRun; }, get$_runUnary() { - return B._RunUnaryZoneFunction__RootZone__rootRunUnary; + return B._ZoneFunction__RootZone__rootRunUnary; }, get$_runBinary() { - return B._RunBinaryZoneFunction__RootZone__rootRunBinary; + return B._ZoneFunction__RootZone__rootRunBinary; }, get$_registerCallback() { - return B._RegisterNullaryZoneFunction__RootZone__rootRegisterCallback; + return B._ZoneFunction__RootZone__rootRegisterCallback; }, get$_registerUnaryCallback() { - return B._RegisterUnaryZoneFunction_Bqo; + return B._ZoneFunction_Eeh; }, get$_registerBinaryCallback() { - return B._RegisterBinaryZoneFunction_kGu; + return B._ZoneFunction_7G2; }, get$_errorCallback() { return B._ZoneFunction__RootZone__rootErrorCallback; @@ -14661,7 +14609,7 @@ return false; if (_this._splayCount !== t2._splayCount) { t3 = _this.$ti._eval$1("_SplayTreeIterator.K")._as(B.JSArray_methods.get$last(t1).key); - B.JSArray_methods.set$length(t1, 0); + B.JSArray_methods.clear$0(t1); t2._splay$1(t3); t3 = t2._root; t3.toString; @@ -14868,7 +14816,7 @@ if (t1 === 0) B.JSArray_methods.add$1(keys, ""); else - B.JSArray_methods.set$length(keys, 0); + B.JSArray_methods.clear$0(keys); _this._original = _this._processed = null; return _this._data = result; }, @@ -15812,6 +15760,7 @@ toString$0(_) { var minutes, minutesPadding, seconds, secondsPadding, microseconds = this._duration, + sign = microseconds < 0 ? "-" : "", hours = B.JSInt_methods._tdivFast$1(microseconds, 3600000000); microseconds %= 3600000000; if (microseconds < 0) @@ -15821,7 +15770,7 @@ minutesPadding = minutes < 10 ? "0" : ""; seconds = B.JSInt_methods._tdivFast$1(microseconds, 1000000); secondsPadding = seconds < 10 ? "0" : ""; - return "" + hours + ":" + minutesPadding + minutes + ":" + secondsPadding + seconds + "." + B.JSString_methods.padLeft$2(B.JSInt_methods.toString$0(microseconds % 1000000), 6, "0"); + return sign + Math.abs(hours) + ":" + minutesPadding + minutes + ":" + secondsPadding + seconds + "." + B.JSString_methods.padLeft$2(B.JSInt_methods.toString$0(microseconds % 1000000), 6, "0"); }, $isComparable: 1 }; @@ -16237,7 +16186,8 @@ t2 = _this._fragment; if (t2 != null) t1 = t1 + "#" + t2; - A._lateInitializeOnceCheck(value, "_text"); + if (value !== $) + A.throwLateFieldADI("_text"); value = _this.___Uri__text = t1.charCodeAt(0) == 0 ? t1 : t1; } return value; @@ -16247,7 +16197,8 @@ value = _this.___Uri_hashCode; if (value === $) { result = B.JSString_methods.get$hashCode(_this.get$_text()); - A._lateInitializeOnceCheck(_this.___Uri_hashCode, "hashCode"); + if (_this.___Uri_hashCode !== $) + A.throwLateFieldADI("hashCode"); _this.___Uri_hashCode = result; value = result; } @@ -18704,11 +18655,6 @@ return this.super$JsObject$$indexSet(0, property, value); } }; - A.NullRejectionException.prototype = { - toString$0(_) { - return "Promise was rejected with a value of `" + (this.isUndefined ? "undefined" : "null") + "`."; - } - }; A.promiseToFuture_closure.prototype = { call$1(r) { return this.completer.complete$1(0, this.T._eval$1("0/?")._as(r)); @@ -18723,6 +18669,11 @@ }, $signature: 4 }; + A.NullRejectionException.prototype = { + toString$0(_) { + return "Promise was rejected with a value of `" + (this.isUndefined ? "undefined" : "null") + "`."; + } + }; A._JSRandom.prototype = { nextInt$1(max) { if (max <= 0 || max > 4294967296) @@ -19348,7 +19299,9 @@ build$0() { var t1, t2, t3, _this = this; if (_this._listOwner == null) { - t1 = A._lateReadCheck(_this.__ListBuilder__list, "_list"); + t1 = _this.__ListBuilder__list; + if (t1 === $) + A.throwLateFieldNI("_list"); t2 = _this.$ti; t3 = t2._eval$1("_BuiltList<1>"); t3 = t3._as(new A._BuiltList(t1, t3)); @@ -19374,15 +19327,20 @@ } }, get$length(_) { - return J.get$length$asx(A._lateReadCheck(this.__ListBuilder__list, "_list")); + var t1 = this.__ListBuilder__list; + if (t1 === $) + A.throwLateFieldNI("_list"); + return t1.length; }, map$1(_, f) { var t2, t3, t4, t5, result, _this = this, t1 = _this.$ti; t1._eval$1("1(1)")._as(f); - t2 = A._lateReadCheck(_this.__ListBuilder__list, "_list"); + t2 = _this.__ListBuilder__list; + if (t2 === $) + A.throwLateFieldNI("_list"); t3 = t1._precomputed1; - t4 = A.instanceType(t2); + t4 = A._arrayInstanceType(t2); t5 = t4._eval$1("@<1>")._bind$1(t3)._eval$1("MappedListIterable<1,2>"); result = A.List_List$of(new A.MappedListIterable(t2, t4._bind$1(t3)._eval$1("1(2)")._as(f), t5), true, t5._eval$1("ListIterable.E")); _this._list$_maybeCheckElements$1(result); @@ -19502,11 +19460,20 @@ _s11_ = "_builderMap", _s9_ = "_builtMap"; if (_this._list_multimap$_builtMapOwner == null) { - for (t1 = A._lateReadCheck(_this.__ListMultimapBuilder__builderMap, _s11_), t1 = A.LinkedHashMapKeyIterator$(t1, t1._modifications, A.instanceType(t1)._precomputed1); t1.moveNext$0();) { + t1 = _this.__ListMultimapBuilder__builderMap; + if (t1 === $) + A.throwLateFieldNI(_s11_); + t1 = A.LinkedHashMapKeyIterator$(t1, t1._modifications, A._instanceType(t1)._precomputed1); + for (; t1.moveNext$0();) { key = t1.__js_helper$_current; - t2 = J.$index$asx(A._lateReadCheck(_this.__ListMultimapBuilder__builderMap, _s11_), key); + t2 = _this.__ListMultimapBuilder__builderMap; + if (t2 === $) + A.throwLateFieldNI(_s11_); + t2 = t2.$index(0, key); if (t2._listOwner == null) { - t3 = A._lateReadCheck(t2.__ListBuilder__list, "_list"); + t3 = t2.__ListBuilder__list; + if (t3 === $) + A.throwLateFieldNI("_list"); t4 = A._instanceType(t2); t5 = t4._eval$1("_BuiltList<1>"); t5 = t5._as(new A._BuiltList(t3, t5)); @@ -19516,14 +19483,22 @@ builtList = t2._listOwner; t2 = builtList._list.length; t3 = _this.__ListMultimapBuilder__builtMap; - if (t2 === 0) - J.remove$1$x(A._lateReadCheck(t3, _s9_), key); - else - J.$indexSet$ax(A._lateReadCheck(t3, _s9_), key, builtList); + if (t2 === 0) { + if (t3 === $) + A.throwLateFieldNI(_s9_); + t3.remove$1(0, key); + } else { + if (t3 === $) + A.throwLateFieldNI(_s9_); + t3.$indexSet(0, key, builtList); + } } - t1 = _this.$ti; - t2 = t1._rest[1]; - _this.set$_list_multimap$_builtMapOwner(new A._BuiltListMultimap(A._lateReadCheck(_this.__ListMultimapBuilder__builtMap, _s9_), A.BuiltList_BuiltList$from(B.List_empty0, t2), t1._eval$1("@<1>")._bind$1(t2)._eval$1("_BuiltListMultimap<1,2>"))); + t1 = _this.__ListMultimapBuilder__builtMap; + if (t1 === $) + A.throwLateFieldNI(_s9_); + t2 = _this.$ti; + t3 = t2._rest[1]; + _this.set$_list_multimap$_builtMapOwner(new A._BuiltListMultimap(t1, A.BuiltList_BuiltList$from(B.List_empty0, t3), t2._eval$1("@<1>")._bind$1(t3)._eval$1("_BuiltListMultimap<1,2>"))); } t1 = _this._list_multimap$_builtMapOwner; t1.toString; @@ -19533,20 +19508,29 @@ this._list_multimap$_setWithCopyAndCheck$2(multimap.get$keys(multimap), new A.ListMultimapBuilder_replace_closure(multimap)); }, _list_multimap$_getValuesBuilder$1(key) { - var result, builtValues, _this = this, + var t2, result, builtValues, _this = this, _s11_ = "_builderMap", t1 = _this.$ti; t1._precomputed1._as(key); - result = J.$index$asx(A._lateReadCheck(_this.__ListMultimapBuilder__builderMap, _s11_), key); + t2 = _this.__ListMultimapBuilder__builderMap; + if (t2 === $) + A.throwLateFieldNI(_s11_); + result = t2.$index(0, key); if (result == null) { - builtValues = J.$index$asx(A._lateReadCheck(_this.__ListMultimapBuilder__builtMap, "_builtMap"), key); + t2 = _this.__ListMultimapBuilder__builtMap; + if (t2 === $) + A.throwLateFieldNI("_builtMap"); + builtValues = t2.$index(0, key); result = builtValues == null ? A.ListBuilder_ListBuilder(B.List_empty0, t1._rest[1]) : A.ListBuilder_ListBuilder(builtValues, builtValues.$ti._precomputed1); - J.$indexSet$ax(A._lateReadCheck(_this.__ListMultimapBuilder__builderMap, _s11_), key, result); + t1 = _this.__ListMultimapBuilder__builderMap; + if (t1 === $) + A.throwLateFieldNI(_s11_); + t1.$indexSet(0, key, result); } return result; }, _list_multimap$_setWithCopyAndCheck$2(keys, lookup) { - var t1, t2, t3, t4, t5, t6, key, t7, value, t8, t9, t10, _this = this, _null = null; + var t1, t2, t3, t4, t5, t6, key, t7, value, t8, t9, t10, t11, _this = this, _null = null; _this.set$_list_multimap$_builtMapOwner(_null); t1 = _this.$ti; t2 = t1._precomputed1; @@ -19563,7 +19547,10 @@ t2._as(key); t1._as(value); if (_this._list_multimap$_builtMapOwner != null) { - _this.set$__ListMultimapBuilder__builtMap(t4._as(A.LinkedHashMap_LinkedHashMap$from(A._lateReadCheck(_this.__ListMultimapBuilder__builtMap, "_builtMap"), t2, t3))); + t8 = _this.__ListMultimapBuilder__builtMap; + if (t8 === $) + A.throwLateFieldNI("_builtMap"); + _this.set$__ListMultimapBuilder__builtMap(t4._as(A.LinkedHashMap_LinkedHashMap$from(t8, t2, t3))); _this.set$_list_multimap$_builtMapOwner(_null); } _this._list_multimap$_checkKey$1(key); @@ -19576,10 +19563,16 @@ if (value == null) A.throwExpression(A.ArgumentError$("null element", _null)); if (t8._listOwner != null) { - t8.set$__ListBuilder__list(t9._eval$1("List<1>")._as(A.List_List$from(A._lateReadCheck(t8.__ListBuilder__list, "_list"), true, t10))); + t11 = t8.__ListBuilder__list; + if (t11 === $) + A.throwLateFieldNI("_list"); + t8.set$__ListBuilder__list(t9._eval$1("List<1>")._as(A.List_List$from(t11, true, t10))); t8.set$_listOwner(_null); } - J.add$1$ax(A._lateReadCheck(t8.__ListBuilder__list, "_list"), value); + t8 = t8.__ListBuilder__list; + if (t8 === $) + A.throwLateFieldNI("_list"); + B.JSArray_methods.add$1(t8, value); } else throw A.wrapException(A.ArgumentError$("map contained invalid value: " + A.S(value) + ", for key " + A.S(key), _null)); } @@ -19726,10 +19719,13 @@ }; A.MapBuilder.prototype = { build$0() { - var t1, _this = this; + var t1, t2, _this = this; if (_this._mapOwner == null) { - t1 = _this.$ti; - _this.set$_mapOwner(new A._BuiltMap(_this._mapFactory, A._lateReadCheck(_this.__MapBuilder__map, "_map"), t1._eval$1("@<1>")._bind$1(t1._rest[1])._eval$1("_BuiltMap<1,2>"))); + t1 = _this.__MapBuilder__map; + if (t1 === $) + A.throwLateFieldNI("_map"); + t2 = _this.$ti; + _this.set$_mapOwner(new A._BuiltMap(_this._mapFactory, t1, t2._eval$1("@<1>")._bind$1(t2._rest[1])._eval$1("_BuiltMap<1,2>"))); } t1 = _this._mapOwner; t1.toString; @@ -19744,7 +19740,7 @@ _this.set$__MapBuilder__map(replacement); }, $indexSet(_, key, value) { - var t2, _this = this, + var t2, t3, _this = this, t1 = _this.$ti; t1._precomputed1._as(key); t1._rest[1]._as(value); @@ -19752,24 +19748,39 @@ _this._checkValue$1(value); if (_this._mapOwner != null) { t2 = _this._createMap$0(); - t2.addAll$1(0, A._lateReadCheck(_this.__MapBuilder__map, "_map")); + t3 = _this.__MapBuilder__map; + if (t3 === $) + A.throwLateFieldNI("_map"); + t2.addAll$1(0, t3); _this.set$__MapBuilder__map(t1._eval$1("Map<1,2>")._as(t2)); _this.set$_mapOwner(null); } - J.$indexSet$ax(A._lateReadCheck(_this.__MapBuilder__map, "_map"), key, value); + t1 = _this.__MapBuilder__map; + if (t1 === $) + A.throwLateFieldNI("_map"); + t1.$indexSet(0, key, value); }, get$length(_) { - return A._lateReadCheck(this.__MapBuilder__map, "_map")._length; + var t1 = this.__MapBuilder__map; + if (t1 === $) + A.throwLateFieldNI("_map"); + return t1._length; }, get$_safeMap() { - var t1, _this = this; + var t1, t2, _this = this; if (_this._mapOwner != null) { t1 = _this._createMap$0(); - t1.addAll$1(0, A._lateReadCheck(_this.__MapBuilder__map, "_map")); + t2 = _this.__MapBuilder__map; + if (t2 === $) + A.throwLateFieldNI("_map"); + t1.addAll$1(0, t2); _this.set$__MapBuilder__map(_this.$ti._eval$1("Map<1,2>")._as(t1)); _this.set$_mapOwner(null); } - return A._lateReadCheck(_this.__MapBuilder__map, "_map"); + t1 = _this.__MapBuilder__map; + if (t1 === $) + A.throwLateFieldNI("_map"); + return t1; }, _createMap$0() { var t1 = this.$ti; @@ -19909,8 +19920,12 @@ A.SetBuilder.prototype = { build$0() { var t1, _this = this; - if (_this._setOwner == null) - _this.set$_setOwner(new A._BuiltSet(_this._setFactory, A._lateReadCheck(_this.__SetBuilder__set, "_set"), _this.$ti._eval$1("_BuiltSet<1>"))); + if (_this._setOwner == null) { + t1 = _this.__SetBuilder__set; + if (t1 === $) + A.throwLateFieldNI("_set"); + _this.set$_setOwner(new A._BuiltSet(_this._setFactory, t1, _this.$ti._eval$1("_BuiltSet<1>"))); + } t1 = _this._setOwner; t1.toString; return t1; @@ -19930,14 +19945,19 @@ _this.set$__SetBuilder__set(set); }, get$length(_) { - return A._lateReadCheck(this.__SetBuilder__set, "_set")._collection$_length; + var t1 = this.__SetBuilder__set; + if (t1 === $) + A.throwLateFieldNI("_set"); + return t1._collection$_length; }, map$1(_, f) { var result, t2, t3, t4, _this = this, t1 = _this.$ti; t1._eval$1("1(1)")._as(f); result = _this._createSet$0(); - t2 = A._lateReadCheck(_this.__SetBuilder__set, "_set"); + t2 = _this.__SetBuilder__set; + if (t2 === $) + A.throwLateFieldNI("_set"); t3 = t1._precomputed1; t4 = A._instanceType(t2); result.addAll$1(0, new A.EfficientLengthMappedIterable(t2, t4._bind$1(t3)._eval$1("1(2)")._as(f), t4._eval$1("@<1>")._bind$1(t3)._eval$1("EfficientLengthMappedIterable<1,2>"))); @@ -19947,14 +19967,20 @@ _this.set$__SetBuilder__set(result); }, get$_safeSet() { - var t1, _this = this; + var t1, t2, _this = this; if (_this._setOwner != null) { t1 = _this._createSet$0(); - t1.addAll$1(0, A._lateReadCheck(_this.__SetBuilder__set, "_set")); + t2 = _this.__SetBuilder__set; + if (t2 === $) + A.throwLateFieldNI("_set"); + t1.addAll$1(0, t2); _this.set$__SetBuilder__set(_this.$ti._eval$1("Set<1>")._as(t1)); _this.set$_setOwner(null); } - return A._lateReadCheck(_this.__SetBuilder__set, "_set"); + t1 = _this.__SetBuilder__set; + if (t1 === $) + A.throwLateFieldNI("_set"); + return t1; }, _createSet$0() { return A.LinkedHashSet_LinkedHashSet$_empty(this.$ti._precomputed1); @@ -20051,26 +20077,46 @@ A._BuiltSetMultimap.prototype = {}; A.SetMultimapBuilder.prototype = { build$0() { - var t1, key, t2, builtSet, t3, _this = this, + var t1, key, t2, t3, t4, builtSet, _this = this, _s11_ = "_builderMap", _s9_ = "_builtMap"; if (_this._builtMapOwner == null) { - for (t1 = A._lateReadCheck(_this.__SetMultimapBuilder__builderMap, _s11_), t1 = A.LinkedHashMapKeyIterator$(t1, t1._modifications, A.instanceType(t1)._precomputed1); t1.moveNext$0();) { + t1 = _this.__SetMultimapBuilder__builderMap; + if (t1 === $) + A.throwLateFieldNI(_s11_); + t1 = A.LinkedHashMapKeyIterator$(t1, t1._modifications, A._instanceType(t1)._precomputed1); + for (; t1.moveNext$0();) { key = t1.__js_helper$_current; - t2 = J.$index$asx(A._lateReadCheck(_this.__SetMultimapBuilder__builderMap, _s11_), key); - if (t2._setOwner == null) - t2.set$_setOwner(new A._BuiltSet(t2._setFactory, A._lateReadCheck(t2.__SetBuilder__set, "_set"), A._instanceType(t2)._eval$1("_BuiltSet<1>"))); + t2 = _this.__SetMultimapBuilder__builderMap; + if (t2 === $) + A.throwLateFieldNI(_s11_); + t2 = t2.$index(0, key); + if (t2._setOwner == null) { + t3 = t2._setFactory; + t4 = t2.__SetBuilder__set; + if (t4 === $) + A.throwLateFieldNI("_set"); + t2.set$_setOwner(new A._BuiltSet(t3, t4, A._instanceType(t2)._eval$1("_BuiltSet<1>"))); + } builtSet = t2._setOwner; t2 = builtSet._set$_set._collection$_length; t3 = _this.__SetMultimapBuilder__builtMap; - if (t2 === 0) - J.remove$1$x(A._lateReadCheck(t3, _s9_), key); - else - J.$indexSet$ax(A._lateReadCheck(t3, _s9_), key, builtSet); + if (t2 === 0) { + if (t3 === $) + A.throwLateFieldNI(_s9_); + t3.remove$1(0, key); + } else { + if (t3 === $) + A.throwLateFieldNI(_s9_); + t3.$indexSet(0, key, builtSet); + } } - t1 = _this.$ti; - t2 = t1._rest[1]; - _this.set$_builtMapOwner(new A._BuiltSetMultimap(A._lateReadCheck(_this.__SetMultimapBuilder__builtMap, _s9_), A.BuiltSet_BuiltSet$from(B.List_empty0, t2), t1._eval$1("@<1>")._bind$1(t2)._eval$1("_BuiltSetMultimap<1,2>"))); + t1 = _this.__SetMultimapBuilder__builtMap; + if (t1 === $) + A.throwLateFieldNI(_s9_); + t2 = _this.$ti; + t3 = t2._rest[1]; + _this.set$_builtMapOwner(new A._BuiltSetMultimap(t1, A.BuiltSet_BuiltSet$from(B.List_empty0, t3), t2._eval$1("@<1>")._bind$1(t3)._eval$1("_BuiltSetMultimap<1,2>"))); } t1 = _this._builtMapOwner; t1.toString; @@ -20080,13 +20126,19 @@ this._setWithCopyAndCheck$2(multimap.get$keys(multimap), new A.SetMultimapBuilder_replace_closure(multimap)); }, _getValuesBuilder$1(key) { - var result, builtValues, _this = this, + var t2, result, builtValues, _this = this, _s11_ = "_builderMap", t1 = _this.$ti; t1._precomputed1._as(key); - result = J.$index$asx(A._lateReadCheck(_this.__SetMultimapBuilder__builderMap, _s11_), key); + t2 = _this.__SetMultimapBuilder__builderMap; + if (t2 === $) + A.throwLateFieldNI(_s11_); + result = t2.$index(0, key); if (result == null) { - builtValues = J.$index$asx(A._lateReadCheck(_this.__SetMultimapBuilder__builtMap, "_builtMap"), key); + t2 = _this.__SetMultimapBuilder__builtMap; + if (t2 === $) + A.throwLateFieldNI("_builtMap"); + builtValues = t2.$index(0, key); if (builtValues == null) result = A.SetBuilder_SetBuilder(t1._rest[1]); else { @@ -20094,7 +20146,10 @@ t1._eval$1("_BuiltSet<1>")._as(builtValues); result = new A.SetBuilder(builtValues._setFactory, builtValues._set$_set, builtValues, t1._eval$1("SetBuilder<1>")); } - J.$indexSet$ax(A._lateReadCheck(_this.__SetMultimapBuilder__builderMap, _s11_), key, result); + t1 = _this.__SetMultimapBuilder__builderMap; + if (t1 === $) + A.throwLateFieldNI(_s11_); + t1.$indexSet(0, key, result); } return result; }, @@ -20116,7 +20171,10 @@ t2._as(key); t1._as(value); if (_this._builtMapOwner != null) { - _this.set$__SetMultimapBuilder__builtMap(t4._as(A.LinkedHashMap_LinkedHashMap$from(A._lateReadCheck(_this.__SetMultimapBuilder__builtMap, "_builtMap"), t2, t3))); + t8 = _this.__SetMultimapBuilder__builtMap; + if (t8 === $) + A.throwLateFieldNI("_builtMap"); + _this.set$__SetMultimapBuilder__builtMap(t4._as(A.LinkedHashMap_LinkedHashMap$from(t8, t2, t3))); _this.set$_builtMapOwner(_null); } _this._set_multimap$_checkKey$1(key); @@ -20681,7 +20739,7 @@ return this.serialize$3$specifiedType(serializers, builtListMultimap, B.FullType_null_List_empty_false); }, deserialize$3$specifiedType(serializers, serialized, specifiedType) { - var isUnderspecified, t2, t3, t4, keyType, valueType, result, i, key, values, value, t5, t6, t7, _null = null, + var isUnderspecified, t2, t3, t4, keyType, valueType, result, i, key, values, value, t5, t6, t7, t8, _null = null, t1 = type$.Iterable_nullable_Object; t1._as(serialized); isUnderspecified = specifiedType.root == null || specifiedType.parameters.length === 0; @@ -20721,7 +20779,10 @@ t6._as(key); t5._rest[1]._as(value); if (result._list_multimap$_builtMapOwner != null) { - result.set$__ListMultimapBuilder__builtMap(t5._eval$1("Map<1,BuiltList<2>>")._as(A.LinkedHashMap_LinkedHashMap$from(A._lateReadCheck(result.__ListMultimapBuilder__builtMap, "_builtMap"), t6, t5._eval$1("BuiltList<2>")))); + t7 = result.__ListMultimapBuilder__builtMap; + if (t7 === $) + A.throwLateFieldNI("_builtMap"); + result.set$__ListMultimapBuilder__builtMap(t5._eval$1("Map<1,BuiltList<2>>")._as(A.LinkedHashMap_LinkedHashMap$from(t7, t6, t5._eval$1("BuiltList<2>")))); result.set$_list_multimap$_builtMapOwner(_null); } result._list_multimap$_checkKey$1(key); @@ -20734,10 +20795,16 @@ if (value == null) A.throwExpression(A.ArgumentError$("null element", _null)); if (t5._listOwner != null) { - t5.set$__ListBuilder__list(t6._eval$1("List<1>")._as(A.List_List$from(A._lateReadCheck(t5.__ListBuilder__list, "_list"), true, t7))); + t8 = t5.__ListBuilder__list; + if (t8 === $) + A.throwLateFieldNI("_list"); + t5.set$__ListBuilder__list(t6._eval$1("List<1>")._as(A.List_List$from(t8, true, t7))); t5.set$_listOwner(_null); } - J.add$1$ax(A._lateReadCheck(t5.__ListBuilder__list, "_list"), value); + t5 = t5.__ListBuilder__list; + if (t5 === $) + A.throwLateFieldNI("_list"); + B.JSArray_methods.add$1(t5, value); } } return result.build$0(); @@ -20958,7 +21025,7 @@ return this.serialize$3$specifiedType(serializers, builtSetMultimap, B.FullType_null_List_empty_false); }, deserialize$3$specifiedType(serializers, serialized, specifiedType) { - var isUnderspecified, t2, t3, t4, keyType, valueType, result, i, key, value, t5, + var isUnderspecified, t2, t3, t4, keyType, valueType, result, i, key, value, t5, t6, t1 = type$.Iterable_dynamic; t1._as(serialized); isUnderspecified = specifiedType.root == null || specifiedType.parameters.length === 0; @@ -20997,7 +21064,10 @@ t5._as(key); t4._rest[1]._as(value); if (result._builtMapOwner != null) { - result.set$__SetMultimapBuilder__builtMap(t4._eval$1("Map<1,BuiltSet<2>>")._as(A.LinkedHashMap_LinkedHashMap$from(A._lateReadCheck(result.__SetMultimapBuilder__builtMap, "_builtMap"), t5, t4._eval$1("BuiltSet<2>")))); + t6 = result.__SetMultimapBuilder__builtMap; + if (t6 === $) + A.throwLateFieldNI("_builtMap"); + result.set$__SetMultimapBuilder__builtMap(t4._eval$1("Map<1,BuiltSet<2>>")._as(A.LinkedHashMap_LinkedHashMap$from(t6, t5, t4._eval$1("BuiltSet<2>")))); result.set$_builtMapOwner(null); } result._set_multimap$_checkKey$1(key); @@ -23254,21 +23324,33 @@ t1 = this._channel, value = t1.__HtmlWebSocketChannel_sink; if (value === $) { - t2 = A._lateReadCheck(A._lateReadCheck(t1._html0$_controller.__StreamChannelController__foreign, "_foreign").__GuaranteeChannel__sink, "_sink"); - A._lateInitializeOnceCheck(t1.__HtmlWebSocketChannel_sink, "sink"); + t2 = t1._html0$_controller.__StreamChannelController__foreign; + if (t2 === $) + A.throwLateFieldNI("_foreign"); + t2 = t2.__GuaranteeChannel__sink; + if (t2 === $) + A.throwLateFieldNI("_sink"); + if (value !== $) + A.throwLateFieldADI("sink"); value = t1.__HtmlWebSocketChannel_sink = new A._HtmlWebSocketSink(t1, t2); } return value; }, get$stream(_) { - var t1 = A._lateReadCheck(A._lateReadCheck(this._channel._html0$_controller.__StreamChannelController__foreign, "_foreign").__GuaranteeChannel__streamController, "_streamController"), - t2 = A._instanceType(t1)._eval$1("_ControllerStream<1>"); - return new A._MapStream(t2._eval$1("String*(Stream.T)")._as(new A.WebSocketClient_stream_closure()), new A._ControllerStream(t1, t2), t2._eval$1("_MapStream")); + var t2, + t1 = this._channel._html0$_controller.__StreamChannelController__foreign; + if (t1 === $) + A.throwLateFieldNI("_foreign"); + t1 = t1.__GuaranteeChannel__streamController; + if (t1 === $) + A.throwLateFieldNI("_streamController"); + t2 = A._instanceType(t1)._eval$1("_ControllerStream<1>"); + return new A._MapStream(t2._eval$1("String(Stream.T)")._as(new A.WebSocketClient_stream_closure()), new A._ControllerStream(t1, t2), t2._eval$1("_MapStream")); } }; A.WebSocketClient_stream_closure.prototype = { call$1(o) { - return o == null ? null : J.toString$0$(o); + return J.toString$0$(o); }, $signature: 59 }; @@ -23285,9 +23367,9 @@ case 0: // Function start t1 = $async$self.$ti; - buffer = A._setArrayType([], t1._eval$1("JSArray<1*>")); + buffer = A._setArrayType([], t1._eval$1("JSArray<1>")); lastSendTime = Date.now(); - t2 = $async$self._batchDelayMilliseconds, t1 = t1._eval$1("1*"); + t2 = $async$self._batchDelayMilliseconds, t1 = t1._precomputed1; case 2: // for condition $async$temp1 = A; @@ -23309,7 +23391,9 @@ break; case 5: // then - t3 = $async$self._inputQueue; + t3 = $async$self.__BatchedStreamController__inputQueue; + if (t3 === $) + A.throwLateFieldNI("_inputQueue"); t4 = t3.$ti; t5 = new A._Future($.Zone__current, t4._eval$1("_Future<1>")); t3._addRequest$1(new A._NextRequest(new A._AsyncCompleter(t5, t4._eval$1("_AsyncCompleter<1>")), t4._eval$1("_NextRequest<1>"))); @@ -23325,7 +23409,9 @@ lastSendTime0 = Date.now(); if (lastSendTime0 > lastSendTime + t2) { if (buffer.length !== 0) { - t3 = $async$self._outputController; + t3 = $async$self.__BatchedStreamController__outputController; + if (t3 === $) + A.throwLateFieldNI("_outputController"); t4 = A._instanceType(t3); t5 = t4._precomputed1._as(A.List_List$from(buffer, true, t1)); t6 = t3._state; @@ -23344,7 +23430,7 @@ t3.lastPendingEvent = t4; } } - B.JSArray_methods.set$length(buffer, 0); + B.JSArray_methods.clear$0(buffer); } lastSendTime = lastSendTime0; } @@ -23354,7 +23440,9 @@ case 3: // after for if (buffer.length !== 0) { - t2 = $async$self._outputController; + t2 = $async$self.__BatchedStreamController__outputController; + if (t2 === $) + A.throwLateFieldNI("_outputController"); t2.add$1(0, A._instanceType(t2)._precomputed1._as(A.List_List$from(buffer, true, t1))); } $async$self._completer.complete$1(0, true); @@ -23365,19 +23453,25 @@ return A._asyncStartSync($async$_batchAndSendEvents$0, $async$completer); }, _hasEventOrTimeOut$1(duration) { - return this._inputQueue.get$hasNext().timeout$2$onTimeout(0, duration, new A.BatchedStreamController__hasEventOrTimeOut_closure()); + var t1 = this.__BatchedStreamController__inputQueue; + if (t1 === $) + A.throwLateFieldNI("_inputQueue"); + return t1.get$hasNext().timeout$2$onTimeout(0, duration, new A.BatchedStreamController__hasEventOrTimeOut_closure()); }, _hasEventDuring$1(duration) { - return this._inputQueue.get$hasNext().timeout$2$onTimeout(0, duration, new A.BatchedStreamController__hasEventDuring_closure()); + var t1 = this.__BatchedStreamController__inputQueue; + if (t1 === $) + A.throwLateFieldNI("_inputQueue"); + return t1.get$hasNext().timeout$2$onTimeout(0, duration, new A.BatchedStreamController__hasEventDuring_closure()); }, - set$_inputController(_inputController) { - this._inputController = this.$ti._eval$1("StreamController<1*>*")._as(_inputController); + set$__BatchedStreamController__inputController(__BatchedStreamController__inputController) { + this.__BatchedStreamController__inputController = this.$ti._eval$1("StreamController<1>")._as(__BatchedStreamController__inputController); }, - set$_inputQueue(_inputQueue) { - this._inputQueue = this.$ti._eval$1("StreamQueue<1*>*")._as(_inputQueue); + set$__BatchedStreamController__inputQueue(__BatchedStreamController__inputQueue) { + this.__BatchedStreamController__inputQueue = this.$ti._eval$1("StreamQueue<1>")._as(__BatchedStreamController__inputQueue); }, - set$_outputController(_outputController) { - this._outputController = this.$ti._eval$1("StreamController*>*")._as(_outputController); + set$__BatchedStreamController__outputController(__BatchedStreamController__outputController) { + this.__BatchedStreamController__outputController = this.$ti._eval$1("StreamController>")._as(__BatchedStreamController__outputController); } }; A.BatchedStreamController__hasEventOrTimeOut_closure.prototype = { @@ -23765,23 +23859,35 @@ t2 = A.EventSource__factoryEventSource(t1, A.LinkedHashMap_LinkedHashMap$_literal(["withCredentials", true], type$.String, type$.dynamic)); _this.__SseClient__eventSource = t2; _this.__SseClient__serverUrl = t1; - t2 = new A._EventStream(A._lateReadCheck(t2, _s12_), "open", false, type$._EventStream_legacy_Event); + t2 = new A._EventStream(t2, "open", false, type$._EventStream_legacy_Event); t2.get$first(t2).whenComplete$1(new A.SseClient_closure(_this)); - t2 = A._lateReadCheck(_this.__SseClient__eventSource, _s12_); - (t2 && B.EventSource_methods).addEventListener$2(t2, "message", _this.get$_onIncomingMessage()); - t2 = A._lateReadCheck(_this.__SseClient__eventSource, _s12_); - (t2 && B.EventSource_methods).addEventListener$2(t2, "control", _this.get$_onIncomingControlMessage()); - t2 = A._lateReadCheck(_this.__SseClient__eventSource, _s12_); + t2 = _this.__SseClient__eventSource; + if (t2 === $) + A.throwLateFieldNI(_s12_); + B.EventSource_methods.addEventListener$2(t2, "message", _this.get$_onIncomingMessage()); + t2 = _this.__SseClient__eventSource; + if (t2 === $) + A.throwLateFieldNI(_s12_); + B.EventSource_methods.addEventListener$2(t2, "control", _this.get$_onIncomingControlMessage()); + t2 = _this.__SseClient__eventSource; + if (t2 === $) + A.throwLateFieldNI(_s12_); t1 = type$.nullable_void_Function_legacy_Event; t3 = t1._as(new A.SseClient_closure0(_this)); type$.nullable_void_Function._as(null); t4 = type$.legacy_Event; A._EventStreamSubscription$(t2, "open", t3, false, t4); - A._EventStreamSubscription$(A._lateReadCheck(_this.__SseClient__eventSource, _s12_), "error", t1._as(new A.SseClient_closure1(_this)), false, t4); + t3 = _this.__SseClient__eventSource; + if (t3 === $) + A.throwLateFieldNI(_s12_); + A._EventStreamSubscription$(t3, "error", t1._as(new A.SseClient_closure1(_this)), false, t4); }, close$0(_) { - var t1, _this = this; - A._lateReadCheck(_this.__SseClient__eventSource, "_eventSource").close(); + var _this = this, + t1 = _this.__SseClient__eventSource; + if (t1 === $) + A.throwLateFieldNI("_eventSource"); + t1.close(); if ((_this._onConnected.future._state & 30) === 0) { t1 = _this._outgoingController; new A._ControllerStream(t1, A._instanceType(t1)._eval$1("_ControllerStream<1>")).listen$2$cancelOnError(null, true).asFuture$1$1(null, type$.dynamic); @@ -23873,7 +23979,7 @@ call$0() { var $async$goto = 0, $async$completer = A._makeAsyncAwaitCompleter(type$.Null), - $async$handler = 1, $async$currentError, $async$next = [], $async$self = this, e, e0, e1, exception, t1, $async$exception; + $async$handler = 1, $async$currentError, $async$self = this, e, e0, e1, exception, t1, t2, $async$exception; var $async$call$0 = A._wrapJsFunctionForAsync(function($async$errorCode, $async$result) { if ($async$errorCode === 1) { $async$currentError = $async$result; @@ -23898,8 +24004,11 @@ } $async$handler = 3; t1 = $async$self.$this; + t2 = t1.__SseClient__serverUrl; + if (t2 === $) + A.throwLateFieldNI("_serverUrl"); $async$goto = 6; - return A._asyncAwait(A.HttpRequest_request(A.S(A._lateReadCheck(t1.__SseClient__serverUrl, "_serverUrl")) + "&messageId=" + ++t1._lastMessageId, "POST", null, $async$self._box_0.encodedMessage, true), $async$call$0); + return A._asyncAwait(A.HttpRequest_request(t2 + "&messageId=" + ++t1._lastMessageId, "POST", null, $async$self._box_0.encodedMessage, true), $async$call$0); case 6: // returning from await. $async$handler = 1; @@ -23958,18 +24067,24 @@ var _this = this, t1 = _this.$ti, t2 = t1._eval$1("_GuaranteeSink<1>")._as(new A._GuaranteeSink(innerSink, _this, new A._AsyncCompleter(new A._Future($.Zone__current, type$._Future_dynamic), type$._AsyncCompleter_dynamic), allowSinkErrors, $T._eval$1("_GuaranteeSink<0>"))); - A._lateWriteOnceCheck(_this.__GuaranteeChannel__sink, "_sink"); + if (_this.__GuaranteeChannel__sink !== $) + A.throwLateFieldAI("_sink"); _this.set$__GuaranteeChannel__sink(t2); t1 = t1._eval$1("StreamController<1>")._as(A.StreamController_StreamController(null, new A.GuaranteeChannel_closure(_box_0, _this, $T), true, $T)); - A._lateWriteOnceCheck(_this.__GuaranteeChannel__streamController, "_streamController"); + if (_this.__GuaranteeChannel__streamController !== $) + A.throwLateFieldAI("_streamController"); _this.set$__GuaranteeChannel__streamController(t1); }, _onSinkDisconnected$0() { + var subscription, t1; this._disconnected = true; - var subscription = this._guarantee_channel$_subscription; + subscription = this._guarantee_channel$_subscription; if (subscription != null) subscription.cancel$0(0); - A._lateReadCheck(this.__GuaranteeChannel__streamController, "_streamController").close$0(0); + t1 = this.__GuaranteeChannel__streamController; + if (t1 === $) + A.throwLateFieldNI("_streamController"); + t1.close$0(0); }, set$__GuaranteeChannel__sink(__GuaranteeChannel__sink) { this.__GuaranteeChannel__sink = this.$ti._eval$1("_GuaranteeSink<1>")._as(__GuaranteeChannel__sink); @@ -23984,21 +24099,28 @@ A.GuaranteeChannel_closure.prototype = { call$0() { var t2, t3, - _s17_ = "_streamController", t1 = this.$this; if (t1._disconnected) return; t2 = this._box_0.innerStream; - t3 = A._lateReadCheck(t1.__GuaranteeChannel__streamController, _s17_); - t1.set$_guarantee_channel$_subscription(t2.listen$3$onDone$onError(this.T._eval$1("~(0)")._as(t3.get$add(t3)), new A.GuaranteeChannel__closure(t1), A._lateReadCheck(t1.__GuaranteeChannel__streamController, _s17_).get$addError())); + t3 = t1.__GuaranteeChannel__streamController; + if (t3 === $) + A.throwLateFieldNI("_streamController"); + t1.set$_guarantee_channel$_subscription(t2.listen$3$onDone$onError(this.T._eval$1("~(0)")._as(t3.get$add(t3)), new A.GuaranteeChannel__closure(t1), t3.get$addError())); }, $signature: 0 }; A.GuaranteeChannel__closure.prototype = { call$0() { - var t1 = this.$this; - A._lateReadCheck(t1.__GuaranteeChannel__sink, "_sink")._onStreamDisconnected$0(); - A._lateReadCheck(t1.__GuaranteeChannel__streamController, "_streamController").close$0(0); + var t1 = this.$this, + t2 = t1.__GuaranteeChannel__sink; + if (t2 === $) + A.throwLateFieldNI("_sink"); + t2._onStreamDisconnected$0(); + t1 = t1.__GuaranteeChannel__streamController; + if (t1 === $) + A.throwLateFieldNI("_streamController"); + t1.close$0(0); }, $signature: 0 }; @@ -24266,7 +24388,12 @@ t1.get$first(t1).then$1$1(0, new A.HtmlWebSocketChannel_closure2(_this), t3); }, _listen$0() { - var t1 = A._lateReadCheck(A._lateReadCheck(this._html0$_controller.__StreamChannelController__local, "_local").__GuaranteeChannel__streamController, "_streamController"); + var t1 = this._html0$_controller.__StreamChannelController__local; + if (t1 === $) + A.throwLateFieldNI("_local"); + t1 = t1.__GuaranteeChannel__streamController; + if (t1 === $) + A.throwLateFieldNI("_streamController"); new A._ControllerStream(t1, A._instanceType(t1)._eval$1("_ControllerStream<1>")).listen$2$onDone(B.WebSocket_methods.get$send(this.innerWebSocket), new A.HtmlWebSocketChannel__listen_closure(this)); }, $isWebSocketChannel: 1 @@ -24280,29 +24407,55 @@ }; A.HtmlWebSocketChannel_closure0.prototype = { call$1(_) { - var t1; + var t1, t2; type$.Event._as(_); t1 = this.$this._html0$_controller; - A._lateReadCheck(A._lateReadCheck(t1.__StreamChannelController__local, "_local").__GuaranteeChannel__sink, "_sink").addError$1(new A.WebSocketChannelException("WebSocket connection failed.")); - A._lateReadCheck(A._lateReadCheck(t1.__StreamChannelController__local, "_local").__GuaranteeChannel__sink, "_sink").close$0(0); + t2 = t1.__StreamChannelController__local; + if (t2 === $) + A.throwLateFieldNI("_local"); + t2 = t2.__GuaranteeChannel__sink; + if (t2 === $) + A.throwLateFieldNI("_sink"); + t2.addError$1(new A.WebSocketChannelException("WebSocket connection failed.")); + t1 = t1.__StreamChannelController__local; + if (t1 === $) + A.throwLateFieldNI("_local"); + t1 = t1.__GuaranteeChannel__sink; + if (t1 === $) + A.throwLateFieldNI("_sink"); + t1.close$0(0); }, $signature: 25 }; A.HtmlWebSocketChannel_closure1.prototype = { call$1($event) { - var data = new A._AcceptStructuredCloneDart2Js([], []).convertNativeToDart_AcceptStructuredClone$2$mustCopy(type$.MessageEvent._as($event).data, true); + var t1, + data = new A._AcceptStructuredCloneDart2Js([], []).convertNativeToDart_AcceptStructuredClone$2$mustCopy(type$.MessageEvent._as($event).data, true); if (type$.ByteBuffer._is(data)) data = A.NativeUint8List_NativeUint8List$view(data, 0, null); - A._lateReadCheck(A._lateReadCheck(this.$this._html0$_controller.__StreamChannelController__local, "_local").__GuaranteeChannel__sink, "_sink").add$1(0, data); + t1 = this.$this._html0$_controller.__StreamChannelController__local; + if (t1 === $) + A.throwLateFieldNI("_local"); + t1 = t1.__GuaranteeChannel__sink; + if (t1 === $) + A.throwLateFieldNI("_sink"); + t1.add$1(0, data); }, $signature: 65 }; A.HtmlWebSocketChannel_closure2.prototype = { call$1($event) { + var t1; type$.CloseEvent._as($event); $event.code; $event.reason; - A._lateReadCheck(A._lateReadCheck(this.$this._html0$_controller.__StreamChannelController__local, "_local").__GuaranteeChannel__sink, "_sink").close$0(0); + t1 = this.$this._html0$_controller.__StreamChannelController__local; + if (t1 === $) + A.throwLateFieldNI("_local"); + t1 = t1.__GuaranteeChannel__sink; + if (t1 === $) + A.throwLateFieldNI("_sink"); + t1.close$0(0); }, $signature: 66 }; @@ -24323,7 +24476,7 @@ call$0() { var $async$goto = 0, $async$completer = A._makeAsyncAwaitCompleter(type$.Null), - uri, fixedPath, fixedUri, client, restarter, manager, debugEventController, t1, t2, t3; + uri, fixedPath, fixedUri, client, restarter, manager, debugEventController, t1, t2, t3, t4; var $async$call$0 = A._wrapJsFunctionForAsync(function($async$errorCode, $async$result) { if ($async$errorCode === 1) return A._asyncRethrow($async$result, $async$completer); @@ -24363,15 +24516,20 @@ // join manager = new A.ReloadingManager(client, restarter); self.$dartHotRestartDwds = A.allowInterop(new A.main__closure(manager), type$.legacy_legacy_Promise_legacy_bool_Function_legacy_String); - debugEventController = new A.BatchedStreamController(1000, new A._AsyncCompleter(new A._Future($.Zone__current, type$._Future_legacy_bool), type$._AsyncCompleter_legacy_bool), type$.BatchedStreamController_legacy_DebugEvent); - debugEventController.set$_inputController(A.StreamController_StreamController(null, null, false, type$.legacy_DebugEvent)); - t1 = debugEventController._inputController; + debugEventController = new A.BatchedStreamController(1000, new A._AsyncCompleter(new A._Future($.Zone__current, type$._Future_bool), type$._AsyncCompleter_bool), type$.BatchedStreamController_legacy_DebugEvent); + debugEventController.set$__BatchedStreamController__inputController(type$.StreamController_legacy_DebugEvent._as(A.StreamController_StreamController(null, null, false, type$.legacy_DebugEvent))); + t1 = debugEventController.__BatchedStreamController__inputController; + if (t1 === $) + A.throwLateFieldNI("_inputController"); t2 = A.List_List$filled(A.QueueList__computeInitialCapacity(null), null, false, type$.nullable_Result_legacy_DebugEvent); t3 = A.ListQueue$(type$._EventRequest_dynamic); - debugEventController.set$_inputQueue(new A.StreamQueue(new A._ControllerStream(t1, A._instanceType(t1)._eval$1("_ControllerStream<1>")), new A.QueueList(t2, 0, 0, type$.QueueList_Result_legacy_DebugEvent), t3, type$.StreamQueue_legacy_DebugEvent)); - debugEventController.set$_outputController(A.StreamController_StreamController(null, null, false, type$.legacy_List_legacy_DebugEvent)); + t4 = type$.StreamQueue_legacy_DebugEvent; + debugEventController.set$__BatchedStreamController__inputQueue(t4._as(new A.StreamQueue(new A._ControllerStream(t1, A._instanceType(t1)._eval$1("_ControllerStream<1>")), new A.QueueList(t2, 0, 0, type$.QueueList_Result_legacy_DebugEvent), t3, t4))); + debugEventController.set$__BatchedStreamController__outputController(type$.StreamController_List_legacy_DebugEvent._as(A.StreamController_StreamController(null, null, false, type$.List_legacy_DebugEvent))); debugEventController._batchAndSendEvents$0(); - t1 = debugEventController._outputController; + t1 = debugEventController.__BatchedStreamController__outputController; + if (t1 === $) + A.throwLateFieldNI("_outputController"); new A._ControllerStream(t1, A._instanceType(t1)._eval$1("_ControllerStream<1>")).listen$1(new A.main__closure0(client)); self.$emitDebugEvent = A.allowInterop(new A.main__closure1(debugEventController), type$.legacy_void_Function_2_legacy_String_and_legacy_String); self.$emitRegisterEvent = A.allowInterop(new A.main__closure2(client), type$.legacy_void_Function_legacy_String); @@ -24435,7 +24593,9 @@ A._asStringS(kind); A._asStringS(eventData); if (A.boolConversionCheck(self.$dartEmitDebugEvents)) { - t1 = this.debugEventController._inputController; + t1 = this.debugEventController.__BatchedStreamController__inputController; + if (t1 === $) + A.throwLateFieldNI("_inputController"); t2 = new A.DebugEventBuilder(); type$.nullable_void_Function_DebugEventBuilder._as(new A.main___closure1(kind, eventData)).call$1(t2); A._trySendEvent(new A._StreamSinkWrapper(t1, A._instanceType(t1)._eval$1("_StreamSinkWrapper<1>")), t2._debug_event$_build$0(), type$.legacy_DebugEvent); @@ -24894,7 +25054,7 @@ _reload$body$RequireRestarter(modules) { var $async$goto = 0, $async$completer = A._makeAsyncAwaitCompleter(type$.legacy_bool), - $async$returnValue, $async$handler = 2, $async$currentError, $async$next = [], $async$self = this, reloadedModules, previousModuleId, moduleId, parentIds, childModule, e, t2, t3, t4, t5, exception, t1, $async$exception; + $async$returnValue, $async$handler = 2, $async$currentError, $async$self = this, reloadedModules, previousModuleId, moduleId, parentIds, childModule, e, t2, t3, t4, t5, exception, t1, $async$exception; var $async$_reload$1 = A._wrapJsFunctionForAsync(function($async$errorCode, $async$result) { if ($async$errorCode === 1) { $async$currentError = $async$result; @@ -25214,7 +25374,7 @@ _inherit = hunkHelpers.inherit, _inheritMany = hunkHelpers.inheritMany; _inherit(A.Object, null); - _inheritMany(A.Object, [A.JS_CONST, J.Interceptor, J.ArrayIterator, A.Iterable, A.CastIterator, A.Closure, A.MapMixin, A.Error, A.SentinelValue, A.ListIterator, A.Iterator, A.EmptyIterator, A.FixedLengthListMixin, A.UnmodifiableListMixin, A._ListBase_Object_ListMixin, A.Symbol, A.MapView, A.ConstantMap, A.JSInvocationMirror, A.TypeErrorDecoder, A.NullThrownFromJavaScriptException, A.ExceptionAndStackTrace, A._StackTrace, A._Required, A.LinkedHashMapCell, A.LinkedHashMapKeyIterator, A.JSSyntaxRegExp, A._MatchImplementation, A._AllMatchesIterator, A.StringMatch, A._StringAllMatchesIterator, A._Cell, A.Rti, A._FunctionParameters, A._Type, A._TimerImpl, A._AsyncAwaitCompleter, A.AsyncError, A._Completer, A._FutureListener, A._Future, A._AsyncCallbackEntry, A.Stream, A.StreamSubscription, A.StreamTransformerBase, A._StreamController, A._SyncStreamControllerDispatch, A._AsyncStreamControllerDispatch, A._BufferingStreamSubscription, A._StreamSinkWrapper, A._DelayedEvent, A._DelayedDone, A._PendingEvents, A._StreamIterator, A._ZoneFunction, A._RunNullaryZoneFunction, A._RunUnaryZoneFunction, A._RunBinaryZoneFunction, A._RegisterNullaryZoneFunction, A._RegisterUnaryZoneFunction, A._RegisterBinaryZoneFunction, A._ZoneSpecification, A._ZoneDelegate, A._Zone, A._HashMapKeyIterator, A.__SetBase_Object_SetMixin, A._HashSetIterator, A._LinkedHashSetCell, A._LinkedHashSetIterator, A.IterableMixin, A.ListMixin, A._UnmodifiableMapMixin, A._ListQueueIterator, A.SetMixin, A._SplayTreeNode, A._SplayTree, A._SplayTreeIterator, A.Codec, A._JsonStringifier, A._Utf8Encoder, A._BigIntImpl, A.DateTime, A.Duration, A.OutOfMemoryError, A.StackOverflowError, A._Exception, A.FormatException, A.IntegerDivisionByZeroException, A.Null, A._StringStackTrace, A.StringBuffer, A._Uri, A.UriData, A._SimpleUri, A.Expando, A.CssStyleDeclarationBase, A.EventStreamProvider, A._Html5NodeValidator, A.ImmutableListMixin, A.NodeValidatorBuilder, A._SimpleNodeValidator, A._SvgNodeValidator, A.FixedSizeListIterator, A._DOMWindowCrossFrame, A._SameOriginUriPolicy, A._ValidatingTreeSanitizer, A._StructuredClone, A._AcceptStructuredClone, A.JsObject, A.NullRejectionException, A._JSRandom, A._Random, A.AsyncMemoizer, A.DelegatingStreamSink, A.ErrorResult, A.ValueResult, A.StreamQueue, A._NextRequest, A._HasNextRequest, A.CopyOnWriteList, A.BuiltList, A.ListBuilder, A.BuiltListMultimap, A.ListMultimapBuilder, A.BuiltMap, A.MapBuilder, A.BuiltSet, A.SetBuilder, A.BuiltSetMultimap, A.SetMultimapBuilder, A.EnumClass, A.IndentingBuiltValueToStringHelper, A.JsonObject, A.FullType, A.BigIntSerializer, A.BoolSerializer, A.BuiltJsonSerializers, A.BuiltJsonSerializersBuilder, A.BuiltListMultimapSerializer, A.BuiltListSerializer, A.BuiltMapSerializer, A.BuiltSetMultimapSerializer, A.BuiltSetSerializer, A.DateTimeSerializer, A.DoubleSerializer, A.DurationSerializer, A.Int64Serializer, A.IntSerializer, A.JsonObjectSerializer, A.NullSerializer, A.NumSerializer, A.RegExpSerializer, A.StringSerializer, A.UriSerializer, A.DefaultEquality, A.IterableEquality, A.ListEquality, A._UnorderedEquality, A._MapEntry, A.MapEquality, A.DeepCollectionEquality, A._QueueList_Object_ListMixin, A.BuildResult, A._$BuildStatusSerializer, A._$BuildResultSerializer, A.BuildResultBuilder, A.ConnectRequest, A._$ConnectRequestSerializer, A.ConnectRequestBuilder, A.DebugEvent, A.BatchedDebugEvents, A._$DebugEventSerializer, A._$BatchedDebugEventsSerializer, A.DebugEventBuilder, A.BatchedDebugEventsBuilder, A.DevToolsRequest, A.DevToolsResponse, A._$DevToolsRequestSerializer, A._$DevToolsResponseSerializer, A.DevToolsRequestBuilder, A.DevToolsResponseBuilder, A.ErrorResponse, A._$ErrorResponseSerializer, A.ErrorResponseBuilder, A.ExtensionRequest, A.ExtensionResponse, A.ExtensionEvent, A.BatchedEvents, A._$ExtensionRequestSerializer, A._$ExtensionResponseSerializer, A._$ExtensionEventSerializer, A._$BatchedEventsSerializer, A.ExtensionRequestBuilder, A.ExtensionResponseBuilder, A.ExtensionEventBuilder, A.BatchedEventsBuilder, A.IsolateExit, A.IsolateStart, A._$IsolateExitSerializer, A._$IsolateStartSerializer, A.IsolateExitBuilder, A.IsolateStartBuilder, A.RegisterEvent, A._$RegisterEventSerializer, A.RegisterEventBuilder, A.RunRequest, A._$RunRequestSerializer, A.SocketClient, A.BatchedStreamController, A.Int64, A.Level, A.LogRecord, A.Logger, A.Pool, A.PoolResource, A.StreamChannelMixin, A._GuaranteeSink, A.StreamChannelController, A.Uuid, A.WebSocketChannelException, A.LegacyRestarter, A.ReloadingManager, A.HotReloadFailedException, A.RequireRestarter]); + _inheritMany(A.Object, [A.JS_CONST, J.Interceptor, J.ArrayIterator, A.Iterable, A.CastIterator, A.Closure, A.MapMixin, A.Error, A.SentinelValue, A.ListIterator, A.Iterator, A.EmptyIterator, A.FixedLengthListMixin, A.UnmodifiableListMixin, A._ListBase_Object_ListMixin, A.Symbol, A.MapView, A.ConstantMap, A.JSInvocationMirror, A.TypeErrorDecoder, A.NullThrownFromJavaScriptException, A.ExceptionAndStackTrace, A._StackTrace, A._Required, A.LinkedHashMapCell, A.LinkedHashMapKeyIterator, A.JSSyntaxRegExp, A._MatchImplementation, A._AllMatchesIterator, A.StringMatch, A._StringAllMatchesIterator, A._Cell, A.Rti, A._FunctionParameters, A._Type, A._TimerImpl, A._AsyncAwaitCompleter, A.AsyncError, A._Completer, A._FutureListener, A._Future, A._AsyncCallbackEntry, A.Stream, A.StreamSubscription, A.StreamTransformerBase, A._StreamController, A._SyncStreamControllerDispatch, A._AsyncStreamControllerDispatch, A._BufferingStreamSubscription, A._StreamSinkWrapper, A._DelayedEvent, A._DelayedDone, A._PendingEvents, A._StreamIterator, A._ZoneFunction, A._ZoneSpecification, A._ZoneDelegate, A._Zone, A._HashMapKeyIterator, A.__SetBase_Object_SetMixin, A._HashSetIterator, A._LinkedHashSetCell, A._LinkedHashSetIterator, A.IterableMixin, A.ListMixin, A._UnmodifiableMapMixin, A._ListQueueIterator, A.SetMixin, A._SplayTreeNode, A._SplayTree, A._SplayTreeIterator, A.Codec, A._JsonStringifier, A._Utf8Encoder, A._BigIntImpl, A.DateTime, A.Duration, A.OutOfMemoryError, A.StackOverflowError, A._Exception, A.FormatException, A.IntegerDivisionByZeroException, A.Null, A._StringStackTrace, A.StringBuffer, A._Uri, A.UriData, A._SimpleUri, A.Expando, A.CssStyleDeclarationBase, A.EventStreamProvider, A._Html5NodeValidator, A.ImmutableListMixin, A.NodeValidatorBuilder, A._SimpleNodeValidator, A._SvgNodeValidator, A.FixedSizeListIterator, A._DOMWindowCrossFrame, A._SameOriginUriPolicy, A._ValidatingTreeSanitizer, A._StructuredClone, A._AcceptStructuredClone, A.JsObject, A.NullRejectionException, A._JSRandom, A._Random, A.AsyncMemoizer, A.DelegatingStreamSink, A.ErrorResult, A.ValueResult, A.StreamQueue, A._NextRequest, A._HasNextRequest, A.CopyOnWriteList, A.BuiltList, A.ListBuilder, A.BuiltListMultimap, A.ListMultimapBuilder, A.BuiltMap, A.MapBuilder, A.BuiltSet, A.SetBuilder, A.BuiltSetMultimap, A.SetMultimapBuilder, A.EnumClass, A.IndentingBuiltValueToStringHelper, A.JsonObject, A.FullType, A.BigIntSerializer, A.BoolSerializer, A.BuiltJsonSerializers, A.BuiltJsonSerializersBuilder, A.BuiltListMultimapSerializer, A.BuiltListSerializer, A.BuiltMapSerializer, A.BuiltSetMultimapSerializer, A.BuiltSetSerializer, A.DateTimeSerializer, A.DoubleSerializer, A.DurationSerializer, A.Int64Serializer, A.IntSerializer, A.JsonObjectSerializer, A.NullSerializer, A.NumSerializer, A.RegExpSerializer, A.StringSerializer, A.UriSerializer, A.DefaultEquality, A.IterableEquality, A.ListEquality, A._UnorderedEquality, A._MapEntry, A.MapEquality, A.DeepCollectionEquality, A._QueueList_Object_ListMixin, A.BuildResult, A._$BuildStatusSerializer, A._$BuildResultSerializer, A.BuildResultBuilder, A.ConnectRequest, A._$ConnectRequestSerializer, A.ConnectRequestBuilder, A.DebugEvent, A.BatchedDebugEvents, A._$DebugEventSerializer, A._$BatchedDebugEventsSerializer, A.DebugEventBuilder, A.BatchedDebugEventsBuilder, A.DevToolsRequest, A.DevToolsResponse, A._$DevToolsRequestSerializer, A._$DevToolsResponseSerializer, A.DevToolsRequestBuilder, A.DevToolsResponseBuilder, A.ErrorResponse, A._$ErrorResponseSerializer, A.ErrorResponseBuilder, A.ExtensionRequest, A.ExtensionResponse, A.ExtensionEvent, A.BatchedEvents, A._$ExtensionRequestSerializer, A._$ExtensionResponseSerializer, A._$ExtensionEventSerializer, A._$BatchedEventsSerializer, A.ExtensionRequestBuilder, A.ExtensionResponseBuilder, A.ExtensionEventBuilder, A.BatchedEventsBuilder, A.IsolateExit, A.IsolateStart, A._$IsolateExitSerializer, A._$IsolateStartSerializer, A.IsolateExitBuilder, A.IsolateStartBuilder, A.RegisterEvent, A._$RegisterEventSerializer, A.RegisterEventBuilder, A.RunRequest, A._$RunRequestSerializer, A.SocketClient, A.BatchedStreamController, A.Int64, A.Level, A.LogRecord, A.Logger, A.Pool, A.PoolResource, A.StreamChannelMixin, A._GuaranteeSink, A.StreamChannelController, A.Uuid, A.WebSocketChannelException, A.LegacyRestarter, A.ReloadingManager, A.HotReloadFailedException, A.RequireRestarter]); _inheritMany(J.Interceptor, [J.JSBool, J.JSNull, J.JavaScriptObject, J.JSArray, J.JSNumber, J.JSString, A.NativeByteBuffer, A.NativeTypedData]); _inheritMany(J.JavaScriptObject, [J.LegacyJavaScriptObject, A.EventTarget, A.AccessibleNodeList, A.Blob, A.Event, A.CssTransformComponent, A.CssRule, A._CssStyleDeclaration_JavaScriptObject_CssStyleDeclarationBase, A.CssStyleValue, A.DataTransferItemList, A.DomException, A.DomImplementation, A._DomRectList_JavaScriptObject_ListMixin, A.DomRectReadOnly, A._DomStringList_JavaScriptObject_ListMixin, A.DomTokenList, A._FileList_JavaScriptObject_ListMixin, A.Gamepad, A.History, A._HtmlCollection_JavaScriptObject_ListMixin, A.ImageData, A.Location, A.MediaList, A._MidiInputMap_JavaScriptObject_MapMixin, A._MidiOutputMap_JavaScriptObject_MapMixin, A.MimeType, A._MimeTypeArray_JavaScriptObject_ListMixin, A._NodeList_JavaScriptObject_ListMixin, A.Plugin, A._PluginArray_JavaScriptObject_ListMixin, A._RtcStatsReport_JavaScriptObject_MapMixin, A.SpeechGrammar, A._SpeechGrammarList_JavaScriptObject_ListMixin, A.SpeechRecognitionResult, A._Storage_JavaScriptObject_MapMixin, A.StyleSheet, A._TextTrackCueList_JavaScriptObject_ListMixin, A.TimeRanges, A.Touch, A._TouchList_JavaScriptObject_ListMixin, A.TrackDefaultList, A.Url, A.__CssRuleList_JavaScriptObject_ListMixin, A.__GamepadList_JavaScriptObject_ListMixin, A.__NamedNodeMap_JavaScriptObject_ListMixin, A.__SpeechRecognitionResultList_JavaScriptObject_ListMixin, A.__StyleSheetList_JavaScriptObject_ListMixin, A.KeyRange, A.Length, A._LengthList_JavaScriptObject_ListMixin, A.Number, A._NumberList_JavaScriptObject_ListMixin, A.PointList, A._StringList_JavaScriptObject_ListMixin, A.Transform, A._TransformList_JavaScriptObject_ListMixin, A.AudioBuffer, A._AudioParamMap_JavaScriptObject_MapMixin]); _inheritMany(J.LegacyJavaScriptObject, [J.PlainJavaScriptObject, J.UnknownJavaScriptObject, J.JavaScriptFunction, A.Promise, A.RequireLoader, A.JsError, A.JsMap]); @@ -25447,7 +25607,7 @@ typeUniverse: {eC: new Map(), tR: {}, eT: {}, tPV: {}, sEA: []}, mangledGlobalNames: {int: "int", double: "double", num: "num", String: "String", bool: "bool", Null: "Null", List: "List"}, mangledNames: {}, - types: ["~()", "@(@)", "Null()", "Object?(@)", "~(@)", "~(Event)", "~(String,@)", "Null(@)", "Null(Object,StackTrace)", "~(@,@)", "~(~())", "bool(@)", "Set<0^>()", "bool(Object?,Object?)", "int(Object?)", "int(@,@)", "~(Object?)", "~(Object?,Object?)", "~(Symbol0,@)", "int(int,int)", "int(int)", "String(String)", "~(Uint8List,String,int)", "bool(Element,String,String,_Html5NodeValidator)", "ScriptElement*()", "Null(Event)", "String(int,int)", "Object?(Object?)", "~(Object[StackTrace?])", "bool*()", "bool(String)", "~(Object,StackTrace)", "bool(NodeValidator)", "Future()", "~(ProgressEvent)", "~(int,@)", "bool(Node)", "Uint8List(@,@)", "~(Node,Node?)", "Null(@,@)", "@(@,@)", "@(Object?)", "JsFunction(@)", "JsArray<@>(@)", "JsObject(@)", "int(int,@)", "IndentingBuiltValueToStringHelper(String)", "ListBuilder()", "ListMultimapBuilder()", "MapBuilder()", "SetBuilder()", "~(String,String)", "~(String,int?)", "~(String,int)", "~([Object?])", "Null(@,StackTrace)", "bool(Object?)", "ListBuilder()", "ListBuilder()", "String*(@)", "Null(~())", "Logger()", "~(String?)", "@(@,String)", "~(Zone,ZoneDelegate,Zone,Object,StackTrace)", "~(MessageEvent)", "Null(CloseEvent)", "Future*()", "bool(Object,Object)", "Null(List*)", "ListBuilder*(BatchedDebugEventsBuilder*)", "Null(String*,String*)", "DebugEventBuilder*(DebugEventBuilder*)", "Null(String*)", "RegisterEventBuilder*(RegisterEventBuilder*)", "DevToolsRequestBuilder*(DevToolsRequestBuilder*)", "Future*(String*)", "Null(Event*)", "ConnectRequestBuilder*(ConnectRequestBuilder*)", "Null(Object*,StackTrace*)", "Null(MessageEvent*)", "List*(String*)", "int*(String*,String*)", "~(JsError*)", "ScriptElement*()*()", "~(@,StackTrace)", "Promise<1&>*(String*)", "@(String)", "~(Zone?,ZoneDelegate?,Zone,Object,StackTrace)", "0^(Zone?,ZoneDelegate?,Zone,0^())", "0^(Zone?,ZoneDelegate?,Zone,0^(1^),1^)", "0^(Zone?,ZoneDelegate?,Zone,0^(1^,2^),1^,2^)", "0^()(Zone,ZoneDelegate,Zone,0^())", "0^(1^)(Zone,ZoneDelegate,Zone,0^(1^))", "0^(1^,2^)(Zone,ZoneDelegate,Zone,0^(1^,2^))", "AsyncError?(Zone,ZoneDelegate,Zone,Object,StackTrace?)", "~(Zone?,ZoneDelegate?,Zone,~())", "Timer(Zone,ZoneDelegate,Zone,Duration,~())", "Timer(Zone,ZoneDelegate,Zone,Duration,~(Timer))", "~(Zone,ZoneDelegate,Zone,String)", "~(String)", "Zone(Zone?,ZoneDelegate?,Zone,ZoneSpecification?,Map?)", "_Future<@>(@)", "SetMultimapBuilder()"], + types: ["~()", "@(@)", "Null()", "Object?(@)", "~(@)", "~(Event)", "~(String,@)", "Null(@)", "Null(Object,StackTrace)", "~(@,@)", "~(~())", "bool(@)", "Set<0^>()", "bool(Object?,Object?)", "int(Object?)", "int(@,@)", "~(Object?)", "~(Object?,Object?)", "~(Symbol0,@)", "int(int,int)", "int(int)", "String(String)", "~(Uint8List,String,int)", "bool(Element,String,String,_Html5NodeValidator)", "ScriptElement*()", "Null(Event)", "String(int,int)", "Object?(Object?)", "~(Object[StackTrace?])", "bool()", "bool(String)", "~(Object,StackTrace)", "bool(NodeValidator)", "Future()", "~(ProgressEvent)", "~(int,@)", "bool(Node)", "Uint8List(@,@)", "~(Node,Node?)", "Null(@,@)", "@(@,@)", "@(Object?)", "JsFunction(@)", "JsArray<@>(@)", "JsObject(@)", "int(int,@)", "IndentingBuiltValueToStringHelper(String)", "ListBuilder()", "ListMultimapBuilder()", "MapBuilder()", "SetBuilder()", "~(String,String)", "~(String,int?)", "~(String,int)", "~([Object?])", "Null(@,StackTrace)", "bool(Object?)", "ListBuilder()", "ListBuilder()", "String(@)", "Null(~())", "Logger()", "~(String?)", "@(@,String)", "~(Zone,ZoneDelegate,Zone,Object,StackTrace)", "~(MessageEvent)", "Null(CloseEvent)", "Future*()", "bool(Object,Object)", "Null(List*)", "ListBuilder*(BatchedDebugEventsBuilder*)", "Null(String*,String*)", "DebugEventBuilder*(DebugEventBuilder*)", "Null(String*)", "RegisterEventBuilder*(RegisterEventBuilder*)", "DevToolsRequestBuilder*(DevToolsRequestBuilder*)", "Future*(String*)", "Null(Event*)", "ConnectRequestBuilder*(ConnectRequestBuilder*)", "Null(Object*,StackTrace*)", "Null(MessageEvent*)", "List*(String*)", "int*(String*,String*)", "~(JsError*)", "ScriptElement*()*()", "~(@,StackTrace)", "Promise<1&>*(String*)", "@(String)", "~(Zone?,ZoneDelegate?,Zone,Object,StackTrace)", "0^(Zone?,ZoneDelegate?,Zone,0^())", "0^(Zone?,ZoneDelegate?,Zone,0^(1^),1^)", "0^(Zone?,ZoneDelegate?,Zone,0^(1^,2^),1^,2^)", "0^()(Zone,ZoneDelegate,Zone,0^())", "0^(1^)(Zone,ZoneDelegate,Zone,0^(1^))", "0^(1^,2^)(Zone,ZoneDelegate,Zone,0^(1^,2^))", "AsyncError?(Zone,ZoneDelegate,Zone,Object,StackTrace?)", "~(Zone?,ZoneDelegate?,Zone,~())", "Timer(Zone,ZoneDelegate,Zone,Duration,~())", "Timer(Zone,ZoneDelegate,Zone,Duration,~(Timer))", "~(Zone,ZoneDelegate,Zone,String)", "~(String)", "Zone(Zone?,ZoneDelegate?,Zone,ZoneSpecification?,Map?)", "_Future<@>(@)", "SetMultimapBuilder()"], interceptorsByTag: null, leafTags: null, arrayRti: Symbol("$ti") @@ -25543,6 +25703,7 @@ List_DebugEvent: findType("List"), List_ExtensionEvent: findType("List"), List_dynamic: findType("List<@>"), + List_legacy_DebugEvent: findType("List"), List_nullable_Object: findType("List"), Logger: findType("Logger"), MapBuilder_dynamic_dynamic: findType("MapBuilder<@,@>"), @@ -25583,6 +25744,8 @@ SpeechRecognitionResult: findType("SpeechRecognitionResult"), StackTrace: findType("StackTrace"), StreamChannelController_dynamic: findType("StreamChannelController<@>"), + StreamController_List_legacy_DebugEvent: findType("StreamController>"), + StreamController_legacy_DebugEvent: findType("StreamController"), StreamQueue_legacy_DebugEvent: findType("StreamQueue"), String: findType("String"), String_Function_legacy_String: findType("String(String*)"), @@ -26010,19 +26173,19 @@ B.Type_Uri_EFX = A.typeLiteral("Uri"); B.Type_double_K1J = A.typeLiteral("double"); B.Type_num_cv7 = A.typeLiteral("num"); - B._RegisterBinaryZoneFunction_kGu = new A._RegisterBinaryZoneFunction(B.C__RootZone, A.async___rootRegisterBinaryCallback$closure()); - B._RegisterNullaryZoneFunction__RootZone__rootRegisterCallback = new A._RegisterNullaryZoneFunction(B.C__RootZone, A.async___rootRegisterCallback$closure()); - B._RegisterUnaryZoneFunction_Bqo = new A._RegisterUnaryZoneFunction(B.C__RootZone, A.async___rootRegisterUnaryCallback$closure()); - B._RunBinaryZoneFunction__RootZone__rootRunBinary = new A._RunBinaryZoneFunction(B.C__RootZone, A.async___rootRunBinary$closure()); - B._RunNullaryZoneFunction__RootZone__rootRun = new A._RunNullaryZoneFunction(B.C__RootZone, A.async___rootRun$closure()); - B._RunUnaryZoneFunction__RootZone__rootRunUnary = new A._RunUnaryZoneFunction(B.C__RootZone, A.async___rootRunUnary$closure()); B._StringStackTrace_3uE = new A._StringStackTrace(""); B._ZoneFunction_3bB = new A._ZoneFunction(B.C__RootZone, A.async___rootCreatePeriodicTimer$closure(), A.findType("_ZoneFunction")); + B._ZoneFunction_7G2 = new A._ZoneFunction(B.C__RootZone, A.async___rootRegisterBinaryCallback$closure(), A.findType("_ZoneFunction<0^*(1^*,2^*)*(Zone*,ZoneDelegate*,Zone*,0^*(1^*,2^*)*)*>")); + B._ZoneFunction_Eeh = new A._ZoneFunction(B.C__RootZone, A.async___rootRegisterUnaryCallback$closure(), A.findType("_ZoneFunction<0^*(1^*)*(Zone*,ZoneDelegate*,Zone*,0^*(1^*)*)*>")); B._ZoneFunction_NMc = new A._ZoneFunction(B.C__RootZone, A.async___rootHandleUncaughtError$closure(), A.findType("_ZoneFunction<~(Zone*,ZoneDelegate*,Zone*,Object*,StackTrace*)*>")); B._ZoneFunction__RootZone__rootCreateTimer = new A._ZoneFunction(B.C__RootZone, A.async___rootCreateTimer$closure(), A.findType("_ZoneFunction")); B._ZoneFunction__RootZone__rootErrorCallback = new A._ZoneFunction(B.C__RootZone, A.async___rootErrorCallback$closure(), A.findType("_ZoneFunction")); B._ZoneFunction__RootZone__rootFork = new A._ZoneFunction(B.C__RootZone, A.async___rootFork$closure(), A.findType("_ZoneFunction?)*>")); B._ZoneFunction__RootZone__rootPrint = new A._ZoneFunction(B.C__RootZone, A.async___rootPrint$closure(), A.findType("_ZoneFunction<~(Zone*,ZoneDelegate*,Zone*,String*)*>")); + B._ZoneFunction__RootZone__rootRegisterCallback = new A._ZoneFunction(B.C__RootZone, A.async___rootRegisterCallback$closure(), A.findType("_ZoneFunction<0^*()*(Zone*,ZoneDelegate*,Zone*,0^*()*)*>")); + B._ZoneFunction__RootZone__rootRun = new A._ZoneFunction(B.C__RootZone, A.async___rootRun$closure(), A.findType("_ZoneFunction<0^*(Zone*,ZoneDelegate*,Zone*,0^*()*)*>")); + B._ZoneFunction__RootZone__rootRunBinary = new A._ZoneFunction(B.C__RootZone, A.async___rootRunBinary$closure(), A.findType("_ZoneFunction<0^*(Zone*,ZoneDelegate*,Zone*,0^*(1^*,2^*)*,1^*,2^*)*>")); + B._ZoneFunction__RootZone__rootRunUnary = new A._ZoneFunction(B.C__RootZone, A.async___rootRunUnary$closure(), A.findType("_ZoneFunction<0^*(Zone*,ZoneDelegate*,Zone*,0^*(1^*)*,1^*)*>")); B._ZoneFunction__RootZone__rootScheduleMicrotask = new A._ZoneFunction(B.C__RootZone, A.async___rootScheduleMicrotask$closure(), A.findType("_ZoneFunction<~(Zone*,ZoneDelegate*,Zone*,~()*)*>")); B._ZoneSpecification_ALf = new A._ZoneSpecification(null, null, null, null, null, null, null, null, null, null, null, null, null); })(); diff --git a/dwds/lib/src/version.dart b/dwds/lib/src/version.dart index 4eaa47d98..646943ab9 100644 --- a/dwds/lib/src/version.dart +++ b/dwds/lib/src/version.dart @@ -1,2 +1,2 @@ // Generated code. Do not modify. -const packageVersion = '14.0.3'; +const packageVersion = '14.0.4-dev'; From bf32316fbf8521d4cffccbda12cec182e895b497 Mon Sep 17 00:00:00 2001 From: Anna Gringauze Date: Thu, 2 Jun 2022 17:47:11 -0700 Subject: [PATCH 07/10] Remove unneded null check --- dwds/lib/src/services/expression_compiler_service.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/dwds/lib/src/services/expression_compiler_service.dart b/dwds/lib/src/services/expression_compiler_service.dart index aac744211..d2768a402 100644 --- a/dwds/lib/src/services/expression_compiler_service.dart +++ b/dwds/lib/src/services/expression_compiler_service.dart @@ -264,7 +264,6 @@ class ExpressionCompilerService implements ExpressionCompiler { Future initialize( {String moduleFormat, bool soundNullSafety = false}) async { if (_compiler.isCompleted) return; - soundNullSafety ??= false; var compiler = await _Compiler.start( _address, From 7d50fcb8faaffa33cdd23ee4a752ffda04526378 Mon Sep 17 00:00:00 2001 From: Anna Gringauze Date: Tue, 7 Jun 2022 12:00:45 -0700 Subject: [PATCH 08/10] Address CR comments --- dwds/lib/expression_compiler.dart | 2 +- dwds/lib/src/debugging/execution_context.dart | 8 ++- dwds/lib/src/readers/asset_reader.dart | 3 +- .../src/services/chrome_debug_exception.dart | 2 +- dwds/lib/src/utilities/batched_stream.dart | 10 ++-- dwds/lib/src/utilities/conversions.dart | 23 ++++---- dwds/lib/src/utilities/sdk_configuration.dart | 54 ++++++++----------- 7 files changed, 47 insertions(+), 55 deletions(-) diff --git a/dwds/lib/expression_compiler.dart b/dwds/lib/expression_compiler.dart index 1bce79920..0c5cc734e 100644 --- a/dwds/lib/expression_compiler.dart +++ b/dwds/lib/expression_compiler.dart @@ -1,4 +1,4 @@ -// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. diff --git a/dwds/lib/src/debugging/execution_context.dart b/dwds/lib/src/debugging/execution_context.dart index 64b9a3af2..8ac103de9 100644 --- a/dwds/lib/src/debugging/execution_context.dart +++ b/dwds/lib/src/debugging/execution_context.dart @@ -19,7 +19,9 @@ class RemoteDebuggerExecutionContext extends ExecutionContext { final RemoteDebugger _remoteDebugger; final _logger = Logger('RemoteDebuggerExecutionContext'); - // Contexts that may contain a Dart application. + /// Contexts that may contain a Dart application. + /// Context can be null if an error has occured and we cannot detect + /// and parse the context ID. late StreamQueue _contexts; int? _id; @@ -61,6 +63,10 @@ class RemoteDebuggerExecutionContext extends ExecutionContext { .eventStream('Runtime.executionContextsCleared', (e) => e) .listen((_) => _id = null); _remoteDebugger.eventStream('Runtime.executionContextCreated', (e) { + // Parse and add the context ID to the stream. + // If we cannot detect or parse the context ID, add `null` to the stream + // to indicate an error context - those will be skipped when trying to find + // the dart context, with a warning. var id = e.params?['context']?['id']?.toString(); return id == null ? null : int.parse(id); }).listen(contextController.add); diff --git a/dwds/lib/src/readers/asset_reader.dart b/dwds/lib/src/readers/asset_reader.dart index 55824fc99..39ef444ed 100644 --- a/dwds/lib/src/readers/asset_reader.dart +++ b/dwds/lib/src/readers/asset_reader.dart @@ -14,7 +14,8 @@ abstract class AssetReader { /// null if the resource does not exist. Future dartSourceContents(String serverPath); - /// Returns the contents for the merged metadata output at the provided path. + /// Returns the contents for the merged metadata output at the provided path, + /// or null if the resource does not exist. Future metadataContents(String serverPath); /// Closes connections diff --git a/dwds/lib/src/services/chrome_debug_exception.dart b/dwds/lib/src/services/chrome_debug_exception.dart index 5fc41f92e..de966a307 100644 --- a/dwds/lib/src/services/chrome_debug_exception.dart +++ b/dwds/lib/src/services/chrome_debug_exception.dart @@ -1,4 +1,4 @@ -// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. diff --git a/dwds/lib/src/utilities/batched_stream.dart b/dwds/lib/src/utilities/batched_stream.dart index eb5bdbf8f..ef67ab1a3 100644 --- a/dwds/lib/src/utilities/batched_stream.dart +++ b/dwds/lib/src/utilities/batched_stream.dart @@ -12,10 +12,10 @@ class BatchedStreamController { final int _batchDelayMilliseconds; - late StreamController _inputController; + final StreamController _inputController; late StreamQueue _inputQueue; - late StreamController> _outputController; + final StreamController> _outputController; final Completer _completer = Completer(); /// Create batched stream controller. @@ -24,10 +24,10 @@ class BatchedStreamController { /// output [stream] every [delay] milliseconds. Keeps the original order. BatchedStreamController({ int delay = _defaultBatchDelayMilliseconds, - }) : _batchDelayMilliseconds = delay { - _inputController = StreamController(); + }) : _batchDelayMilliseconds = delay, + _inputController = StreamController(), + _outputController = StreamController>() { _inputQueue = StreamQueue(_inputController.stream); - _outputController = StreamController>(); unawaited(_batchAndSendEvents()); } diff --git a/dwds/lib/src/utilities/conversions.dart b/dwds/lib/src/utilities/conversions.dart index be5a22d88..3babbf0e0 100644 --- a/dwds/lib/src/utilities/conversions.dart +++ b/dwds/lib/src/utilities/conversions.dart @@ -15,7 +15,7 @@ import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart'; /// consistently where the callArgument format doesn't, at least if we're /// using the `arguments` pseudo-variable in JS instead of passing directly /// as real arguments. -Map callArgumentFor(Object argument) { +Map callArgumentFor(Object argument) { if (argument is RemoteObject) { return _isPrimitive(argument) ? _callArgumentForPrimitive(argument.value) @@ -49,22 +49,23 @@ List remoteObjectsFor(Iterable dartIds) { /// InstanceRef identifier in the protocol. Libraries aren't first class, and /// must be handled separately. RemoteObject remoteObjectFor(String dartId) { - var data = {}; + var data = {}; data['objectId'] = dartId; if (isStringId(dartId)) { data['type'] = 'string'; data['value'] = _stringFromDartId(dartId); } else if (isDoubleId(dartId)) { data['type'] = 'number'; - data['value'] = _doubleFromDartId(dartId)!; + data['value'] = _doubleFromDartId(dartId); } else if (isIntId(dartId)) { data['type'] = 'number'; - data['value'] = _intFromDartId(dartId)!; + data['value'] = _intFromDartId(dartId); } else if (isBoolId(dartId)) { data['type'] = 'boolean'; data['value'] = _boolFromDartId(dartId); } else if (dartId == _nullId) { data['type'] = 'undefined'; + data['value'] = null; } else { data['type'] = 'object'; } @@ -133,19 +134,13 @@ bool isDoubleId(String dartId) => dartId.startsWith(_prefixForDoubleIds); bool isLibraryId(String dartId) => _uriPrefixes.any(dartId.startsWith); /// A Map representing a RemoteObject for a primitive object. -Map _callArgumentForPrimitive(Object? primitive) { - return { - 'type': _jsTypeOf(primitive), - if (primitive != null) 'value': primitive, - }; +Map _callArgumentForPrimitive(Object? primitive) { + return {'type': _jsTypeOf(primitive), 'value': primitive}; } /// A Map representing a RemoteObject from an actual RemoteObject. -Map _callArgumentForRemote(RemoteObject remote) { - return { - 'type': 'object', - if (remote.objectId != null) 'objectId': remote.objectId!, - }; +Map _callArgumentForRemote(RemoteObject remote) { + return {'type': 'object', 'objectId': remote.objectId}; } /// The JS type name to use in a RemoteObject reference to [object]. diff --git a/dwds/lib/src/utilities/sdk_configuration.dart b/dwds/lib/src/utilities/sdk_configuration.dart index 4a83e37f7..59dbada90 100644 --- a/dwds/lib/src/utilities/sdk_configuration.dart +++ b/dwds/lib/src/utilities/sdk_configuration.dart @@ -64,9 +64,7 @@ class SdkConfiguration { /// Throws [InvalidSdkConfigurationException] if configuration does not /// exist on disk. - void validate({FileSystem? fileSystem}) { - fileSystem ??= const LocalFileSystem(); - + void validate({FileSystem fileSystem = const LocalFileSystem()}) { validateSdkDir(fileSystem: fileSystem); validateSummaries(fileSystem: fileSystem); validateLibrariesSpec(fileSystem: fileSystem); @@ -75,8 +73,7 @@ class SdkConfiguration { /// Throws [InvalidSdkConfigurationException] if SDK root does not /// exist on the disk. - void validateSdkDir({FileSystem? fileSystem}) { - fileSystem ??= const LocalFileSystem(); + void validateSdkDir({FileSystem fileSystem = const LocalFileSystem()}) { if (sdkDirectory == null || !fileSystem.directory(sdkDirectory).existsSync()) { throw InvalidSdkConfigurationException( @@ -84,9 +81,7 @@ class SdkConfiguration { } } - void validateSummaries({FileSystem? fileSystem}) { - fileSystem ??= const LocalFileSystem(); - + void validateSummaries({FileSystem fileSystem = const LocalFileSystem()}) { if (unsoundSdkSummaryPath == null || !fileSystem.file(unsoundSdkSummaryPath).existsSync()) { throw InvalidSdkConfigurationException( @@ -100,18 +95,16 @@ class SdkConfiguration { } } - void validateLibrariesSpec({FileSystem? fileSystem}) { - fileSystem ??= const LocalFileSystem(); - + void validateLibrariesSpec( + {FileSystem fileSystem = const LocalFileSystem()}) { if (librariesPath == null || !fileSystem.file(librariesPath).existsSync()) { throw InvalidSdkConfigurationException( 'Libraries spec $librariesPath does not exist'); } } - void validateCompilerWorker({FileSystem? fileSystem}) { - fileSystem ??= const LocalFileSystem(); - + void validateCompilerWorker( + {FileSystem fileSystem = const LocalFileSystem()}) { if (compilerWorkerPath == null || !fileSystem.file(compilerWorkerPath).existsSync()) { throw InvalidSdkConfigurationException( @@ -124,26 +117,23 @@ class SdkConfiguration { class DefaultSdkConfigurationProvider extends SdkConfigurationProvider { DefaultSdkConfigurationProvider(); - SdkConfiguration? _configuration; + late SdkConfiguration _configuration = _create(); /// Create and validate configuration matching the default SDK layout. @override - Future get configuration async { - if (_configuration == null) { - final binDir = p.dirname(Platform.resolvedExecutable); - final sdkDir = p.dirname(binDir); - - _configuration = SdkConfiguration( - sdkDirectory: sdkDir, - unsoundSdkSummaryPath: - p.join(sdkDir, 'lib', '_internal', 'ddc_sdk.dill'), - soundSdkSummaryPath: - p.join(sdkDir, 'lib', '_internal', 'ddc_outline_sound.dill'), - librariesPath: p.join(sdkDir, 'lib', 'libraries.json'), - compilerWorkerPath: - p.join(binDir, 'snapshots', 'dartdevc.dart.snapshot'), - ); - } - return _configuration!; + Future get configuration async => _configuration; + + SdkConfiguration _create() { + final binDir = p.dirname(Platform.resolvedExecutable); + final sdkDir = p.dirname(binDir); + + return SdkConfiguration( + sdkDirectory: sdkDir, + unsoundSdkSummaryPath: p.join(sdkDir, 'lib', '_internal', 'ddc_sdk.dill'), + soundSdkSummaryPath: + p.join(sdkDir, 'lib', '_internal', 'ddc_outline_sound.dill'), + librariesPath: p.join(sdkDir, 'lib', 'libraries.json'), + compilerWorkerPath: p.join(binDir, 'snapshots', 'dartdevc.dart.snapshot'), + ); } } From fb6fab7b427ac897d014864bcfbddcc08517f6fd Mon Sep 17 00:00:00 2001 From: Anna Gringauze Date: Wed, 8 Jun 2022 11:10:50 -0700 Subject: [PATCH 09/10] Addressed CR comments --- dwds/lib/src/debugging/execution_context.dart | 16 ++- dwds/lib/src/injected/client.js | 101 +++++++----------- dwds/lib/src/utilities/conversions.dart | 5 +- dwds/lib/src/utilities/objects.dart | 16 ++- dwds/lib/src/utilities/sdk_configuration.dart | 3 + dwds/lib/src/utilities/shared.dart | 6 +- 6 files changed, 73 insertions(+), 74 deletions(-) diff --git a/dwds/lib/src/debugging/execution_context.dart b/dwds/lib/src/debugging/execution_context.dart index 8ac103de9..c5b65881e 100644 --- a/dwds/lib/src/debugging/execution_context.dart +++ b/dwds/lib/src/debugging/execution_context.dart @@ -22,7 +22,7 @@ class RemoteDebuggerExecutionContext extends ExecutionContext { /// Contexts that may contain a Dart application. /// Context can be null if an error has occured and we cannot detect /// and parse the context ID. - late StreamQueue _contexts; + late StreamQueue _contexts; int? _id; @@ -58,7 +58,7 @@ class RemoteDebuggerExecutionContext extends ExecutionContext { } RemoteDebuggerExecutionContext(this._id, this._remoteDebugger) { - var contextController = StreamController(); + var contextController = StreamController(); _remoteDebugger .eventStream('Runtime.executionContextsCleared', (e) => e) .listen((_) => _id = null); @@ -68,8 +68,16 @@ class RemoteDebuggerExecutionContext extends ExecutionContext { // to indicate an error context - those will be skipped when trying to find // the dart context, with a warning. var id = e.params?['context']?['id']?.toString(); - return id == null ? null : int.parse(id); - }).listen(contextController.add); + var parsedId = id == null ? null : int.parse(id); + if (id == null) { + _logger.warning('Cannot find execution context id: $e'); + } else if (parsedId == null) { + _logger.warning('Cannot parse execution context id: $id'); + } + return parsedId; + }).listen((e) { + if (e != null) contextController.add(e); + }); _contexts = StreamQueue(contextController.stream); } } diff --git a/dwds/lib/src/injected/client.js b/dwds/lib/src/injected/client.js index cfbd254fe..3a63f9227 100644 --- a/dwds/lib/src/injected/client.js +++ b/dwds/lib/src/injected/client.js @@ -1,4 +1,4 @@ -// Generated by dart2js (NullSafetyMode.unsound, csp), the Dart to JavaScript compiler version: 2.18.0-159.0.dev. +// Generated by dart2js (NullSafetyMode.unsound, csp), the Dart to JavaScript compiler version: 2.18.0-163.0.dev. // The code supports the following hooks: // dartPrint(message): // if this function is defined it is called instead of the Dart [print] @@ -8290,12 +8290,14 @@ }, WebSocketClient_stream_closure: function WebSocketClient_stream_closure() { }, - BatchedStreamController: function BatchedStreamController(t0, t1, t2) { + BatchedStreamController: function BatchedStreamController(t0, t1, t2, t3, t4) { var _ = this; _._batchDelayMilliseconds = t0; - _.__BatchedStreamController__outputController = _.__BatchedStreamController__inputQueue = _.__BatchedStreamController__inputController = $; - _._completer = t1; - _.$ti = t2; + _._inputController = t1; + _.__BatchedStreamController__inputQueue = $; + _._outputController = t2; + _._completer = t3; + _.$ti = t4; }, BatchedStreamController__hasEventOrTimeOut_closure: function BatchedStreamController__hasEventOrTimeOut_closure() { }, @@ -23358,7 +23360,7 @@ _batchAndSendEvents$0() { var $async$goto = 0, $async$completer = A._makeAsyncAwaitCompleter(type$.void), - $async$self = this, t2, t3, t4, t5, lastSendTime0, t6, lastEvent, t1, buffer, lastSendTime, $async$temp1, $async$temp2; + $async$self = this, t2, t3, t4, t5, t6, t7, t8, lastSendTime0, lastEvent, t1, buffer, lastSendTime, $async$temp1, $async$temp2; var $async$_batchAndSendEvents$0 = A._wrapJsFunctionForAsync(function($async$errorCode, $async$result) { if ($async$errorCode === 1) return A._asyncRethrow($async$result, $async$completer); @@ -23369,7 +23371,7 @@ t1 = $async$self.$ti; buffer = A._setArrayType([], t1._eval$1("JSArray<1>")); lastSendTime = Date.now(); - t2 = $async$self._batchDelayMilliseconds, t1 = t1._precomputed1; + t2 = $async$self._batchDelayMilliseconds, t3 = $async$self._outputController, t4 = A._instanceType(t3), t1 = t1._precomputed1, t5 = t4._precomputed1, t4 = t4._eval$1("_DelayedData<1>"); case 2: // for condition $async$temp1 = A; @@ -23391,16 +23393,16 @@ break; case 5: // then - t3 = $async$self.__BatchedStreamController__inputQueue; - if (t3 === $) + t6 = $async$self.__BatchedStreamController__inputQueue; + if (t6 === $) A.throwLateFieldNI("_inputQueue"); - t4 = t3.$ti; - t5 = new A._Future($.Zone__current, t4._eval$1("_Future<1>")); - t3._addRequest$1(new A._NextRequest(new A._AsyncCompleter(t5, t4._eval$1("_AsyncCompleter<1>")), t4._eval$1("_NextRequest<1>"))); + t7 = t6.$ti; + t8 = new A._Future($.Zone__current, t7._eval$1("_Future<1>")); + t6._addRequest$1(new A._NextRequest(new A._AsyncCompleter(t8, t7._eval$1("_AsyncCompleter<1>")), t7._eval$1("_NextRequest<1>"))); $async$temp1 = B.JSArray_methods; $async$temp2 = buffer; $async$goto = 8; - return A._asyncAwait(t5, $async$_batchAndSendEvents$0); + return A._asyncAwait(t8, $async$_batchAndSendEvents$0); case 8: // returning from await. $async$temp1.add$1($async$temp2, $async$result); @@ -23409,25 +23411,21 @@ lastSendTime0 = Date.now(); if (lastSendTime0 > lastSendTime + t2) { if (buffer.length !== 0) { - t3 = $async$self.__BatchedStreamController__outputController; - if (t3 === $) - A.throwLateFieldNI("_outputController"); - t4 = A._instanceType(t3); - t5 = t4._precomputed1._as(A.List_List$from(buffer, true, t1)); - t6 = t3._state; - if (t6 >= 4) + t6 = t5._as(A.List_List$from(buffer, true, t1)); + t7 = t3._state; + if (t7 >= 4) A.throwExpression(t3._badEventState$0()); - if ((t6 & 1) !== 0) - t3._sendData$1(t5); - else if ((t6 & 3) === 0) { - t3 = t3._ensurePendingEvents$0(); - t4 = new A._DelayedData(t5, t4._eval$1("_DelayedData<1>")); - lastEvent = t3.lastPendingEvent; + if ((t7 & 1) !== 0) + t3._sendData$1(t6); + else if ((t7 & 3) === 0) { + t7 = t3._ensurePendingEvents$0(); + t6 = new A._DelayedData(t6, t4); + lastEvent = t7.lastPendingEvent; if (lastEvent == null) - t3.firstPendingEvent = t3.lastPendingEvent = t4; + t7.firstPendingEvent = t7.lastPendingEvent = t6; else { - lastEvent.set$next(0, t4); - t3.lastPendingEvent = t4; + lastEvent.set$next(0, t6); + t7.lastPendingEvent = t6; } } B.JSArray_methods.clear$0(buffer); @@ -23439,12 +23437,8 @@ break; case 3: // after for - if (buffer.length !== 0) { - t2 = $async$self.__BatchedStreamController__outputController; - if (t2 === $) - A.throwLateFieldNI("_outputController"); - t2.add$1(0, A._instanceType(t2)._precomputed1._as(A.List_List$from(buffer, true, t1))); - } + if (buffer.length !== 0) + t3.add$1(0, t5._as(A.List_List$from(buffer, true, t1))); $async$self._completer.complete$1(0, true); // implicit return return A._asyncReturn(null, $async$completer); @@ -23464,14 +23458,8 @@ A.throwLateFieldNI("_inputQueue"); return t1.get$hasNext().timeout$2$onTimeout(0, duration, new A.BatchedStreamController__hasEventDuring_closure()); }, - set$__BatchedStreamController__inputController(__BatchedStreamController__inputController) { - this.__BatchedStreamController__inputController = this.$ti._eval$1("StreamController<1>")._as(__BatchedStreamController__inputController); - }, set$__BatchedStreamController__inputQueue(__BatchedStreamController__inputQueue) { this.__BatchedStreamController__inputQueue = this.$ti._eval$1("StreamQueue<1>")._as(__BatchedStreamController__inputQueue); - }, - set$__BatchedStreamController__outputController(__BatchedStreamController__outputController) { - this.__BatchedStreamController__outputController = this.$ti._eval$1("StreamController>")._as(__BatchedStreamController__outputController); } }; A.BatchedStreamController__hasEventOrTimeOut_closure.prototype = { @@ -24476,7 +24464,7 @@ call$0() { var $async$goto = 0, $async$completer = A._makeAsyncAwaitCompleter(type$.Null), - uri, fixedPath, fixedUri, client, restarter, manager, debugEventController, t1, t2, t3, t4; + uri, fixedPath, fixedUri, client, restarter, manager, t1, t2, t3, debugEventController, t4, t5; var $async$call$0 = A._wrapJsFunctionForAsync(function($async$errorCode, $async$result) { if ($async$errorCode === 1) return A._asyncRethrow($async$result, $async$completer); @@ -24516,21 +24504,16 @@ // join manager = new A.ReloadingManager(client, restarter); self.$dartHotRestartDwds = A.allowInterop(new A.main__closure(manager), type$.legacy_legacy_Promise_legacy_bool_Function_legacy_String); - debugEventController = new A.BatchedStreamController(1000, new A._AsyncCompleter(new A._Future($.Zone__current, type$._Future_bool), type$._AsyncCompleter_bool), type$.BatchedStreamController_legacy_DebugEvent); - debugEventController.set$__BatchedStreamController__inputController(type$.StreamController_legacy_DebugEvent._as(A.StreamController_StreamController(null, null, false, type$.legacy_DebugEvent))); - t1 = debugEventController.__BatchedStreamController__inputController; - if (t1 === $) - A.throwLateFieldNI("_inputController"); - t2 = A.List_List$filled(A.QueueList__computeInitialCapacity(null), null, false, type$.nullable_Result_legacy_DebugEvent); - t3 = A.ListQueue$(type$._EventRequest_dynamic); - t4 = type$.StreamQueue_legacy_DebugEvent; - debugEventController.set$__BatchedStreamController__inputQueue(t4._as(new A.StreamQueue(new A._ControllerStream(t1, A._instanceType(t1)._eval$1("_ControllerStream<1>")), new A.QueueList(t2, 0, 0, type$.QueueList_Result_legacy_DebugEvent), t3, t4))); - debugEventController.set$__BatchedStreamController__outputController(type$.StreamController_List_legacy_DebugEvent._as(A.StreamController_StreamController(null, null, false, type$.List_legacy_DebugEvent))); + t1 = $.Zone__current; + t2 = A.StreamController_StreamController(null, null, false, type$.legacy_DebugEvent); + t3 = A.StreamController_StreamController(null, null, false, type$.List_legacy_DebugEvent); + debugEventController = new A.BatchedStreamController(1000, t2, t3, new A._AsyncCompleter(new A._Future(t1, type$._Future_bool), type$._AsyncCompleter_bool), type$.BatchedStreamController_legacy_DebugEvent); + t1 = A.List_List$filled(A.QueueList__computeInitialCapacity(null), null, false, type$.nullable_Result_legacy_DebugEvent); + t4 = A.ListQueue$(type$._EventRequest_dynamic); + t5 = type$.StreamQueue_legacy_DebugEvent; + debugEventController.set$__BatchedStreamController__inputQueue(t5._as(new A.StreamQueue(new A._ControllerStream(t2, A._instanceType(t2)._eval$1("_ControllerStream<1>")), new A.QueueList(t1, 0, 0, type$.QueueList_Result_legacy_DebugEvent), t4, t5))); debugEventController._batchAndSendEvents$0(); - t1 = debugEventController.__BatchedStreamController__outputController; - if (t1 === $) - A.throwLateFieldNI("_outputController"); - new A._ControllerStream(t1, A._instanceType(t1)._eval$1("_ControllerStream<1>")).listen$1(new A.main__closure0(client)); + new A._ControllerStream(t3, A._instanceType(t3)._eval$1("_ControllerStream<1>")).listen$1(new A.main__closure0(client)); self.$emitDebugEvent = A.allowInterop(new A.main__closure1(debugEventController), type$.legacy_void_Function_2_legacy_String_and_legacy_String); self.$emitRegisterEvent = A.allowInterop(new A.main__closure2(client), type$.legacy_void_Function_legacy_String); self.$launchDevTools = A.allowInterop(new A.main__closure3(client), type$.legacy_void_Function); @@ -24593,9 +24576,7 @@ A._asStringS(kind); A._asStringS(eventData); if (A.boolConversionCheck(self.$dartEmitDebugEvents)) { - t1 = this.debugEventController.__BatchedStreamController__inputController; - if (t1 === $) - A.throwLateFieldNI("_inputController"); + t1 = this.debugEventController._inputController; t2 = new A.DebugEventBuilder(); type$.nullable_void_Function_DebugEventBuilder._as(new A.main___closure1(kind, eventData)).call$1(t2); A._trySendEvent(new A._StreamSinkWrapper(t1, A._instanceType(t1)._eval$1("_StreamSinkWrapper<1>")), t2._debug_event$_build$0(), type$.legacy_DebugEvent); @@ -25744,8 +25725,6 @@ SpeechRecognitionResult: findType("SpeechRecognitionResult"), StackTrace: findType("StackTrace"), StreamChannelController_dynamic: findType("StreamChannelController<@>"), - StreamController_List_legacy_DebugEvent: findType("StreamController>"), - StreamController_legacy_DebugEvent: findType("StreamController"), StreamQueue_legacy_DebugEvent: findType("StreamQueue"), String: findType("String"), String_Function_legacy_String: findType("String(String*)"), diff --git a/dwds/lib/src/utilities/conversions.dart b/dwds/lib/src/utilities/conversions.dart index 3babbf0e0..edd021ca5 100644 --- a/dwds/lib/src/utilities/conversions.dart +++ b/dwds/lib/src/utilities/conversions.dart @@ -93,7 +93,10 @@ String dartIdFor(Object? argument) { return '$_prefixForStringIds$argument'; } if (argument is RemoteObject) { - return argument.objectId ?? null.toString(); + if (argument.objectId == null) { + throw ArgumentError.value(argument, 'objectId', 'No objectId found'); + } + return argument.objectId!; } if (argument is Map) { var id = argument['objectId'] as String?; diff --git a/dwds/lib/src/utilities/objects.dart b/dwds/lib/src/utilities/objects.dart index 5d67a85c8..56fa7c1bc 100644 --- a/dwds/lib/src/utilities/objects.dart +++ b/dwds/lib/src/utilities/objects.dart @@ -27,6 +27,7 @@ class Property { /// requested). (optional) RemoteObject? get value { if (_remoteObjectValue != null) return _remoteObjectValue!; + if (_map == null) return null; if (rawValue == null) return null; var val = _map!['value']; if (val is RemoteObject) { @@ -38,11 +39,13 @@ class Property { } /// The name of the property - String get name { + String? get name { + if (_map == null) return null; + if (rawName == null) return null; const prefix = 'Symbol('; - var nonSymbol = (rawName.startsWith(prefix)) - ? rawName.substring(prefix.length, rawName.length - 1) - : rawName; + var nonSymbol = (rawName!.startsWith(prefix)) + ? rawName!.substring(prefix.length, rawName!.length - 1) + : rawName!; // Adjust names for late fields: // '_#MyTestClass#myselfField' -> 'myselfField' // TODO(annagrin): Use debug symbols to map from dart to JS symbols. @@ -54,7 +57,10 @@ class Property { /// The raw name of the property in JS. /// /// Will be of the form 'Symbol(_actualName)' for private fields. - String get rawName => _map!['name'] as String; + String? get rawName { + if (_map == null) return null; + return _map!['name'] as String; + } @override String toString() => '$name $value'; diff --git a/dwds/lib/src/utilities/sdk_configuration.dart b/dwds/lib/src/utilities/sdk_configuration.dart index 59dbada90..74e9169f7 100644 --- a/dwds/lib/src/utilities/sdk_configuration.dart +++ b/dwds/lib/src/utilities/sdk_configuration.dart @@ -36,6 +36,9 @@ abstract class SdkConfigurationProvider { /// Call [validate] method to make sure the files in the configuration /// layout exist before reading the files. class SdkConfiguration { + // TODO(annagrin): update the tests to take those parameters + // and make all of the paths required (except for the compilerWorkerPath + // that is not used in Flutter). String? sdkDirectory; String? unsoundSdkSummaryPath; String? soundSdkSummaryPath; diff --git a/dwds/lib/src/utilities/shared.dart b/dwds/lib/src/utilities/shared.dart index 78a2663d9..ff90ccacd 100644 --- a/dwds/lib/src/utilities/shared.dart +++ b/dwds/lib/src/utilities/shared.dart @@ -61,16 +61,16 @@ Future startHttpServer(String hostname, {int? port}) async { HttpServer? httpServer; var retries = 5; var i = 0; - port = port ?? await findUnusedPort(); + var foundPort = port ?? await findUnusedPort(); while (i < retries) { i++; try { - httpServer = await HttpMultiServer.bind(hostname, port!); + httpServer = await HttpMultiServer.bind(hostname, foundPort); } on SocketException { if (i == retries) rethrow; } if (httpServer != null || i == retries) return httpServer!; - port = await findUnusedPort(); + foundPort = await findUnusedPort(); await Future.delayed(const Duration(milliseconds: 100)); } return httpServer!; From 096beb5918acd14ed133f8b3d539adfd4bf5d8bf Mon Sep 17 00:00:00 2001 From: Anna Gringauze Date: Mon, 13 Jun 2022 10:15:35 -0700 Subject: [PATCH 10/10] Addressed CR comments --- dwds/lib/asset_reader.dart | 2 +- dwds/lib/src/debugging/execution_context.dart | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/dwds/lib/asset_reader.dart b/dwds/lib/asset_reader.dart index e542e64ae..f7aeaf1c8 100644 --- a/dwds/lib/asset_reader.dart +++ b/dwds/lib/asset_reader.dart @@ -1,4 +1,4 @@ -// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. diff --git a/dwds/lib/src/debugging/execution_context.dart b/dwds/lib/src/debugging/execution_context.dart index 65218c9e2..157c4f49e 100644 --- a/dwds/lib/src/debugging/execution_context.dart +++ b/dwds/lib/src/debugging/execution_context.dart @@ -20,6 +20,7 @@ class RemoteDebuggerExecutionContext extends ExecutionContext { final _logger = Logger('RemoteDebuggerExecutionContext'); /// Contexts that may contain a Dart application. + /// /// Context can be null if an error has occured and we cannot detect /// and parse the context ID. late StreamQueue _contexts;