Skip to content

Commit 784e28b

Browse files
author
Anna Gringauze
authored
Remove unnecessary awaits (#1982)
* Validate only needed summaries in expression_compiler_service * Remove unnecessary asyncs and awaits
1 parent 3cbaf37 commit 784e28b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+71
-98
lines changed

dwds/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- Display records as a container of fields.
1212
- Remove test-only code from `sdk_configuration.dart`.
1313
- Move shared test-only code to a new `test_common` package.
14+
- Convert unnecessary async code to sync.
1415

1516
**Breaking changes**
1617

dwds/debug_extension/tool/update_dev_files.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
import 'dart:async';
65
import 'dart:io';
76

87
void main() async {

dwds/debug_extension_mv3/tool/build_extension.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
// - For prod: dart run tool/build_extension.dart prod
1313
// - For MV3: dart run tool/build_extension.dart --mv3
1414

15-
import 'dart:async';
1615
import 'dart:convert';
1716
import 'dart:io';
1817

dwds/debug_extension_mv3/tool/update_dev_files.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
import 'dart:async';
65
import 'dart:io';
76

87
void main() async {

dwds/debug_extension_mv3/web/background.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
@JS()
66
library background;
77

8-
import 'dart:async';
9-
108
import 'package:dwds/data/debug_info.dart';
119
import 'package:js/js.dart';
1210

dwds/lib/shared/batched_stream.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class BatchedStreamController<T> {
3939
Stream<List<T>> get stream => _outputController.stream;
4040

4141
/// Close the controller.
42-
Future<dynamic> close() async {
42+
Future<dynamic> close() {
4343
safeUnawaited(_inputController.close());
4444
return _completer.future.then((value) => _outputController.close());
4545
}

dwds/lib/src/debugging/classes.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
22
// for details. All rights reserved. Use of this source code is governed by a
3-
// BSD-style license that can be found in the LICENSE file.import 'dart:async';
3+
// BSD-style license that can be found in the LICENSE file.
44

55
import 'package:dwds/src/debugging/metadata/class.dart';
66
import 'package:dwds/src/loaders/strategy.dart';
@@ -191,7 +191,7 @@ class ClassHelper extends Domain {
191191
});
192192
final fieldRefs = <FieldRef>[];
193193
final fieldDescriptors = classDescriptor['fields'] as Map<String, dynamic>;
194-
fieldDescriptors.forEach((name, descriptor) async {
194+
fieldDescriptors.forEach((name, descriptor) {
195195
final classMetaData = ClassMetaData(
196196
jsName: descriptor['classRefName'],
197197
libraryId: descriptor['classRefLibraryId'],
@@ -214,7 +214,7 @@ class ClassHelper extends Domain {
214214

215215
final staticFieldDescriptors =
216216
classDescriptor['staticFields'] as Map<String, dynamic>;
217-
staticFieldDescriptors.forEach((name, descriptor) async {
217+
staticFieldDescriptors.forEach((name, descriptor) {
218218
fieldRefs.add(
219219
FieldRef(
220220
name: name,

dwds/lib/src/debugging/debugger.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ class Debugger extends Domain {
367367
// TODO(alanknight): Can these be moved to dart_scope.dart?
368368
final properties = await visibleProperties(debugger: this, frame: frame);
369369
final boundVariables = await Future.wait(
370-
properties.map((property) async => await _boundVariable(property)),
370+
properties.map(_boundVariable),
371371
);
372372

373373
// Filter out variables that do not come from dart code, such as native
@@ -659,7 +659,7 @@ class Debugger extends Domain {
659659
// TODO(grouma) - In the future we should send all previously computed
660660
// skipLists.
661661
await _remoteDebugger.stepInto(params: {
662-
'skipList': await _skipLists.compute(
662+
'skipList': _skipLists.compute(
663663
scriptId,
664664
await _locations.locationsForUrl(url),
665665
)

dwds/lib/src/debugging/inspector.dart

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
22
// for details. All rights reserved. Use of this source code is governed by a
3-
// BSD-style license that can be found in the LICENSE file.import 'dart:async';
3+
// BSD-style license that can be found in the LICENSE file.
44

55
import 'package:async/async.dart';
66
import 'package:collection/collection.dart';
@@ -114,9 +114,8 @@ class AppInspector implements AppInspectorInterface {
114114
final scripts = await scriptRefs;
115115

116116
await DartUri.initialize();
117-
await DartUri.recordAbsoluteUris(
118-
libraries.map((lib) => lib.uri).whereNotNull());
119-
await DartUri.recordAbsoluteUris(
117+
DartUri.recordAbsoluteUris(libraries.map((lib) => lib.uri).whereNotNull());
118+
DartUri.recordAbsoluteUris(
120119
scripts.map((script) => script.uri).whereNotNull());
121120

122121
isolate.extensionRPCs?.addAll(await _getExtensionRpcs());

dwds/lib/src/debugging/instance.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class InstanceHelper extends Domain {
7979
..offset = (truncated ? offset : null);
8080
}
8181

82-
Future<Instance?> _closureInstanceFor(RemoteObject remoteObject) async {
82+
Instance? _closureInstanceFor(RemoteObject remoteObject) {
8383
final objectId = remoteObject.objectId;
8484
if (objectId == null) return null;
8585
final result = Instance(
@@ -354,8 +354,8 @@ class InstanceHelper extends Domain {
354354
count: count, elementCount: elements.length, length: length);
355355
final range = elements.sublist(0, rangeCount);
356356

357-
return Future.wait(range
358-
.map((element) async => await _instanceRefForRemote(element.value)));
357+
return Future.wait(
358+
range.map((element) => _instanceRefForRemote(element.value)));
359359
}
360360

361361
/// Return elements of the list from [properties].

0 commit comments

Comments
 (0)