Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 54cc31c

Browse files
author
Dart CI
committed
Version 2.19.0-4.0.dev
Merge commit '54b7f4b72a1701f8f9a0334c94ce6f59732bd261' into 'dev'
2 parents 92c7843 + 54b7f4b commit 54cc31c

File tree

56 files changed

+1221
-309
lines changed

Some content is hidden

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

56 files changed

+1221
-309
lines changed

pkg/analysis_server/lib/src/context_manager.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ class ContextManagerImpl implements ContextManager {
454454
/// A helper that performs the context rebuild and waits for all watchers
455455
/// to be fully initialized.
456456
Future<void> performContextRebuild() async {
457-
_destroyAnalysisContexts();
457+
await _destroyAnalysisContexts();
458458
_fileContentCache.invalidateAll();
459459

460460
var watchers = <ResourceWatcher>[];
@@ -610,7 +610,6 @@ class ContextManagerImpl implements ContextManager {
610610

611611
/// Clean up and destroy the context associated with the given folder.
612612
void _destroyAnalysisContext(DriverBasedAnalysisContext context) {
613-
context.driver.dispose();
614613
var rootFolder = context.contextRoot.root;
615614
var watched = bazelWatchedPathsPerFolder.remove(rootFolder);
616615
if (watched != null) {
@@ -623,15 +622,16 @@ class ContextManagerImpl implements ContextManager {
623622
driverMap.remove(rootFolder);
624623
}
625624

626-
void _destroyAnalysisContexts() {
627-
var collection = _collection;
625+
Future<void> _destroyAnalysisContexts() async {
626+
final collection = _collection;
628627
if (collection != null) {
629628
for (final subscription in watcherSubscriptions) {
630-
subscription.cancel();
629+
await subscription.cancel();
631630
}
632-
for (var analysisContext in collection.contexts) {
631+
for (final analysisContext in collection.contexts) {
633632
_destroyAnalysisContext(analysisContext);
634633
}
634+
await collection.dispose();
635635
callbacks.afterContextsDestroyed();
636636
}
637637
}

pkg/analysis_server/test/analysis/set_priority_files_test.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ analyzer:
7272
exclude:
7373
- 'samples/**'
7474
''');
75+
await pumpEventQueue(times: 5000);
7576
var file = newFile('$testPackageRootPath/samples/sample.dart', '');
7677
// attempt to set priority file
7778
await _setPriorityFile(file);
@@ -90,6 +91,7 @@ analyzer:
9091
exclude:
9192
- 'samples/**'
9293
''');
94+
await pumpEventQueue(times: 5000);
9395
// attempt to set priority file
9496
await _setPriorityFile(sampleFile);
9597
_verifyPriorityFiles(sampleFile);
@@ -107,6 +109,7 @@ analyzer:
107109
exclude:
108110
- 'child/samples/**'
109111
''');
112+
await pumpEventQueue(times: 5000);
110113
// attempt to set priority file
111114
await _setPriorityFile(sampleFile);
112115
_verifyPriorityFiles(sampleFile);

pkg/analysis_server/test/domain_analysis_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ void f(int? a) {}
5858
dart_package(null_safety = True)
5959
''');
6060

61-
await pumpEventQueue();
61+
await pumpEventQueue(times: 5000);
6262
await server.onAnalysisComplete;
6363

6464
// We have null safety enabled, so no errors.

pkg/analysis_server/test/edit/sort_members_test.dart

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,6 @@ class MyAnnotation {
203203
}
204204

205205
Future<void> test_OK_genericFunctionType() async {
206-
newAnalysisOptionsYamlFile(testPackageRootPath, '''
207-
analyzer:
208-
strong-mode: true
209-
''');
210206
addTestFile('''
211207
class C {
212208
void caller() {

pkg/analysis_server/test/lsp/code_actions_refactor_test.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,11 +262,12 @@ void f() {
262262

263263
// Send an edit request immediately after the refactor request.
264264
final req1 = executeCodeAction(codeAction);
265-
await replaceFile(100, mainFileUri, 'new test content');
265+
final req2 = replaceFile(100, mainFileUri, 'new test content');
266266

267267
// Expect the first to fail because of the modified content.
268268
await expectLater(
269269
req1, throwsA(isResponseError(ErrorCodes.ContentModified)));
270+
await req2;
270271
}
271272

272273
Future<void> test_filtersCorrectly() async {

pkg/analysis_server/test/lsp/server_abstract.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ abstract class AbstractLspAnalysisServerTest
167167
@override
168168
Future sendNotificationToServer(NotificationMessage notification) async {
169169
channel.sendNotificationToServer(notification);
170-
await pumpEventQueue();
170+
await pumpEventQueue(times: 5000);
171171
}
172172

173173
@override

pkg/analysis_server/test/services/completion/dart/location/directive_uri_test.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import 'package:analyzer/src/test_utilities/package_config_file_builder.dart';
66
import 'package:analyzer_utilities/check/check.dart';
7+
import 'package:test/test.dart';
78
import 'package:test_reflective_loader/test_reflective_loader.dart';
89

910
import '../../../../client/completion_driver_test.dart';
@@ -59,6 +60,7 @@ class DirectiveUriTest extends AbstractCompletionDriverTest {
5960
required void Function(CompletionResponseForTesting response) validator,
6061
}) async {
6162
_configurePackagesFooBar();
63+
await pumpEventQueue(times: 5000);
6264

6365
{
6466
var response = await getTestCodeSuggestions('''

pkg/analyzer/lib/dart/constant/value.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ abstract class DartObject {
6464
/// would return `false` from [hasKnownValue].
6565
DartType? get type;
6666

67+
/// If this object is the value of a constant variable, the variable.
68+
VariableElement? get variable;
69+
6770
/// Return a representation of the value of the field with the given [name].
6871
///
6972
/// Return `null` if either the object being represented does not have a field

pkg/analyzer/lib/dart/element/element.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,13 +525,15 @@ abstract class DirectiveUri {}
525525
///
526526
/// Clients may not extend, implement or mix-in this class.
527527
abstract class DirectiveUriWithAugmentation extends DirectiveUriWithSource {
528+
/// The library augmentation referenced by the [source].
528529
LibraryAugmentationElement get augmentation;
529530
}
530531

531532
/// [DirectiveUriWithSource] that references a [LibraryElement].
532533
///
533534
/// Clients may not extend, implement or mix-in this class.
534535
abstract class DirectiveUriWithLibrary extends DirectiveUriWithSource {
536+
/// The library referenced by the [source].
535537
LibraryElement get library;
536538
}
537539

@@ -540,27 +542,31 @@ abstract class DirectiveUriWithLibrary extends DirectiveUriWithSource {
540542
/// Clients may not extend, implement or mix-in this class.
541543
abstract class DirectiveUriWithRelativeUri
542544
extends DirectiveUriWithRelativeUriString {
545+
/// The relative URI, parsed from [relativeUriString].
543546
Uri get relativeUri;
544547
}
545548

546549
/// [DirectiveUri] for which we can get its relative URI string.
547550
///
548551
/// Clients may not extend, implement or mix-in this class.
549552
abstract class DirectiveUriWithRelativeUriString extends DirectiveUri {
553+
/// The relative URI string specified in code.
550554
String get relativeUriString;
551555
}
552556

553557
/// [DirectiveUriWithRelativeUri] that resolves to a [Source].
554558
///
555559
/// Clients may not extend, implement or mix-in this class.
556560
abstract class DirectiveUriWithSource extends DirectiveUriWithRelativeUri {
561+
/// The result of resolving [relativeUri] against the enclosing URI.
557562
Source get source;
558563
}
559564

560565
/// [DirectiveUriWithSource] that references a [CompilationUnitElement].
561566
///
562567
/// Clients may not extend, implement or mix-in this class.
563568
abstract class DirectiveUriWithUnit extends DirectiveUriWithSource {
569+
/// The unit referenced by the [source].
564570
CompilationUnitElement get unit;
565571
}
566572

pkg/analyzer/lib/src/dart/analysis/analysis_context_collection.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,16 +140,16 @@ class AnalysisContextCollectionImpl implements AnalysisContextCollection {
140140
throw StateError('Unable to find the context to $path');
141141
}
142142

143-
void dispose({
143+
Future<void> dispose({
144144
bool forTesting = false,
145-
}) {
146-
for (var analysisContext in contexts) {
147-
analysisContext.driver.dispose();
145+
}) async {
146+
for (final analysisContext in contexts) {
147+
await analysisContext.driver.dispose2();
148148
}
149-
macroExecutor.close();
149+
await macroExecutor.close();
150150
// If there are other collections, they will have to start it again.
151151
if (!forTesting) {
152-
KernelCompilationService.dispose();
152+
await KernelCompilationService.dispose();
153153
}
154154
}
155155

0 commit comments

Comments
 (0)