Version 2.15.0-275.0.dev
Merge commit '941bfb4aeea5b4df0d65391d0bd5201144dc25a9' into 'dev'
diff --git a/DEPS b/DEPS
index 18e0f7a..166c99b 100644
--- a/DEPS
+++ b/DEPS
@@ -107,7 +107,7 @@
"dart_style_rev": "08b0294d0a500d5c02168ef57dcb8868d0c3cb48",
"dartdoc_rev" : "520e64977de7a87b2fd5be56e5c2e1a58d55bdad",
- "devtools_rev" : "8881a7caa9067471008a8e00750b161f53cdb843",
+ "devtools_rev" : "3a2f570813200e6dee141f3e7a9edcae5f31c2e8",
"jsshell_tag": "version:88.0",
"ffi_rev": "4dd32429880a57b64edaf54c9d5af8a9fa9a4ffb",
"fixnum_rev": "16d3890c6dc82ca629659da1934e412292508bba",
diff --git a/pkg/analysis_server/lib/src/domain_completion.dart b/pkg/analysis_server/lib/src/domain_completion.dart
index 18b8ab3..06753db 100644
--- a/pkg/analysis_server/lib/src/domain_completion.dart
+++ b/pkg/analysis_server/lib/src/domain_completion.dart
@@ -3,6 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
+import 'dart:collection';
import 'package:analysis_server/protocol/protocol.dart';
import 'package:analysis_server/protocol/protocol_constants.dart';
@@ -16,6 +17,7 @@
import 'package:analysis_server/src/services/completion/completion_performance.dart';
import 'package:analysis_server/src/services/completion/dart/completion_manager.dart';
import 'package:analysis_server/src/services/completion/dart/fuzzy_filter_sort.dart';
+import 'package:analysis_server/src/services/completion/dart/suggestion_builder.dart';
import 'package:analysis_server/src/services/completion/yaml/analysis_options_generator.dart';
import 'package:analysis_server/src/services/completion/yaml/fix_data_generator.dart';
import 'package:analysis_server/src/services/completion/yaml/pubspec_generator.dart';
@@ -72,7 +74,7 @@
Set<ElementKind>? includedElementKinds,
Set<String>? includedElementNames,
List<IncludedSuggestionRelevanceTag>? includedSuggestionRelevanceTags,
- List<Uri>? librariesToImport,
+ Map<CompletionSuggestion, Uri>? notImportedSuggestions,
}) async {
//
// Allow plugins to start computing fixes.
@@ -91,7 +93,7 @@
includedElementKinds: includedElementKinds,
includedElementNames: includedElementNames,
includedSuggestionRelevanceTags: includedSuggestionRelevanceTags,
- librariesToImport: librariesToImport,
+ notImportedSuggestions: notImportedSuggestions,
);
suggestions.addAll(
@@ -273,7 +275,20 @@
var provider = server.resourceProvider;
var pathContext = provider.pathContext;
- // TODO(scheglov) Support non-Dart files.
+ if (file.endsWith('.yaml')) {
+ final suggestions = computeYamlSuggestions(file, offset);
+ server.sendResponse(
+ CompletionGetSuggestions2Result(
+ suggestions.replacementOffset,
+ suggestions.replacementLength,
+ suggestions.suggestions,
+ [],
+ false,
+ ).toResponse(request.id),
+ );
+ return;
+ }
+
if (!file_paths.isDart(pathContext, file)) {
server.sendResponse(
CompletionGetSuggestions2Result(offset, 0, [], [], false)
@@ -324,14 +339,15 @@
);
setNewRequest(completionRequest);
- var librariesToImport = <Uri>[];
+ var notImportedSuggestions =
+ HashMap<CompletionSuggestion, Uri>.identity();
var suggestions = <CompletionSuggestion>[];
try {
suggestions = await computeSuggestions(
budget: budget,
performance: performance,
request: completionRequest,
- librariesToImport: librariesToImport,
+ notImportedSuggestions: notImportedSuggestions,
);
} on AbortCompletion {
return server.sendResponse(
@@ -358,12 +374,29 @@
var isIncomplete = lengthRestricted.length < suggestions.length;
completionPerformance.suggestionCount = lengthRestricted.length;
+ // Update `libraryUriToImportIndex` for not yet imported.
+ // Gather referenced unique libraries to import.
+ var librariesToImport = <Uri, int>{};
+ for (var i = 0; i < lengthRestricted.length; i++) {
+ var suggestion = lengthRestricted[i];
+ var libraryToImport = notImportedSuggestions[suggestion];
+ if (libraryToImport != null) {
+ var index = librariesToImport.putIfAbsent(
+ libraryToImport,
+ () => librariesToImport.length,
+ );
+ lengthRestricted[i] = suggestion.copyWith(
+ libraryUriToImportIndex: CopyWithValue(index),
+ );
+ }
+ }
+
server.sendResponse(
CompletionGetSuggestions2Result(
completionRequest.replacementOffset,
completionRequest.replacementLength,
lengthRestricted,
- librariesToImport.map((e) => '$e').toList(),
+ librariesToImport.keys.map((e) => '$e').toList(),
isIncomplete,
).toResponse(request.id),
);
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart b/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart
index 78fef2f..a5aacbf 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart
@@ -90,10 +90,11 @@
/// suggestions, or `null` if no notification should occur.
final SuggestionListener? listener;
- /// If specified, will be filled with URIs of libraries that are not yet
- /// imported, but could be imported into the requested target. Corresponding
- /// [CompletionSuggestion] will have the import index into this list.
- final List<Uri>? librariesToImport;
+ /// If specified, will be filled with suggestions and URIs from libraries
+ /// that are not yet imported, but could be imported into the requested
+ /// target. It is up to the client to make copies of [CompletionSuggestion]s
+ /// with the import index property updated.
+ final Map<protocol.CompletionSuggestion, Uri>? notImportedSuggestions;
/// Initialize a newly created completion manager. The parameters
/// [includedElementKinds], [includedElementNames], and
@@ -105,7 +106,7 @@
this.includedElementNames,
this.includedSuggestionRelevanceTags,
this.listener,
- this.librariesToImport,
+ this.notImportedSuggestions,
}) : assert((includedElementKinds != null &&
includedElementNames != null &&
includedSuggestionRelevanceTags != null) ||
@@ -163,10 +164,11 @@
);
}
- final librariesToImport = this.librariesToImport;
- if (librariesToImport != null) {
+ final notImportedSuggestions = this.notImportedSuggestions;
+ if (notImportedSuggestions != null) {
contributors.add(
- NotImportedContributor(request, builder, budget, librariesToImport),
+ NotImportedContributor(
+ request, builder, budget, notImportedSuggestions),
);
}
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/not_imported_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/not_imported_contributor.dart
index 629fe475..1bf599e 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/not_imported_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/not_imported_contributor.dart
@@ -4,6 +4,7 @@
import 'dart:async';
+import 'package:analysis_server/src/protocol_server.dart' as protocol;
import 'package:analysis_server/src/provisional/completion/dart/completion_dart.dart';
import 'package:analysis_server/src/services/completion/dart/completion_manager.dart';
import 'package:analysis_server/src/services/completion/dart/extension_member_contributor.dart';
@@ -25,13 +26,13 @@
static void Function(FileState)? onFile;
final CompletionBudget budget;
- final List<Uri> librariesToImport;
+ final Map<protocol.CompletionSuggestion, Uri> notImportedSuggestions;
NotImportedContributor(
DartCompletionRequest request,
SuggestionBuilder builder,
this.budget,
- this.librariesToImport,
+ this.notImportedSuggestions,
) : super(request, builder);
@override
@@ -72,7 +73,10 @@
var exportNamespace = elementResult.element.exportNamespace;
var exportElements = exportNamespace.definedNames.values.toList();
- var newSuggestions = builder.markSuggestions();
+ builder.laterReplacesEarlier = false;
+ builder.suggestionAdded = (suggestion) {
+ notImportedSuggestions[suggestion] = file.uri;
+ };
if (request.includeIdentifiers) {
_buildSuggestions(exportElements);
@@ -81,12 +85,10 @@
extensionContributor.addExtensions(
exportElements.whereType<ExtensionElement>().toList(),
);
-
- newSuggestions.setLibraryUriToImportIndex(() {
- librariesToImport.add(file.uri);
- return librariesToImport.length - 1;
- });
}
+
+ builder.laterReplacesEarlier = true;
+ builder.suggestionAdded = null;
}
_Filter _buildFilter(FileSystemState fsState) {
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart b/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart
index 1a432af..1766158 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart
@@ -148,30 +148,6 @@
}
}
-class NewSuggestionsProcessor {
- final SuggestionBuilder _builder;
- final Set<protocol.CompletionSuggestion> _current = Set.identity();
-
- NewSuggestionsProcessor._(this._builder) {
- _current.addAll(_builder._suggestionMap.values);
- }
-
- /// Update suggestions added since this marker was created.
- void setLibraryUriToImportIndex(int Function() produce) {
- int? libraryUriToImportIndex;
- var suggestionMap = _builder._suggestionMap;
- for (var entry in suggestionMap.entries.toList()) {
- var suggestion = entry.value;
- if (!_current.contains(suggestion)) {
- libraryUriToImportIndex ??= produce();
- suggestionMap[entry.key] = suggestion.copyWith(
- libraryUriToImportIndex: CopyWithValue(libraryUriToImportIndex),
- );
- }
- }
- }
-}
-
/// An object used to build a list of suggestions in response to a single
/// completion request.
class SuggestionBuilder {
@@ -198,6 +174,9 @@
/// suggestions, or `null` if no notification should occur.
final SuggestionListener? listener;
+ /// The function to be invoked when a new suggestion is added.
+ void Function(protocol.CompletionSuggestion)? suggestionAdded;
+
/// A map from a completion identifier to a completion suggestion.
final Map<String, CompletionSuggestion> _suggestionMap =
<String, CompletionSuggestion>{};
@@ -250,11 +229,6 @@
bool get _isNonNullableByDefault =>
request.libraryElement.isNonNullableByDefault;
- /// Return an object that knows which suggestions exist, and which are new.
- NewSuggestionsProcessor markSuggestions() {
- return NewSuggestionsProcessor._(this);
- }
-
/// Add a suggestion for an [accessor] declared within a class or extension.
/// If the accessor is being invoked with a target of `super`, then the
/// [containingMemberName] should be the name of the member containing the
@@ -965,10 +939,9 @@
key = '$key()';
}
listener?.builtSuggestion(suggestion);
- if (laterReplacesEarlier) {
+ if (laterReplacesEarlier || !_suggestionMap.containsKey(key)) {
_suggestionMap[key] = suggestion;
- } else {
- _suggestionMap.putIfAbsent(key, () => suggestion);
+ suggestionAdded?.call(suggestion);
}
}
}
diff --git a/pkg/analysis_server/test/domain_completion_test.dart b/pkg/analysis_server/test/domain_completion_test.dart
index 2a46330..30d1d34 100644
--- a/pkg/analysis_server/test/domain_completion_test.dart
+++ b/pkg/analysis_server/test/domain_completion_test.dart
@@ -75,8 +75,7 @@
}
Future<void> test_import_package_dependencies() async {
- // TODO(scheglov) Switch to PubspecYamlFileConfig
- newPubspecYamlFile(testPackageRootPath, r'''
+ writeTestPackagePubspecYamlFile(r'''
name: test
dependencies:
aaa: any
@@ -261,6 +260,33 @@
responseValidator.suggestions.assertEmpty();
}
+ Future<void> test_notImported_dart() async {
+ await _configureWithWorkspaceRoot();
+
+ var responseValidator = await _getTestCodeSuggestions('''
+void f() {
+ Rand^
+}
+''');
+
+ responseValidator
+ ..assertComplete()
+ ..assertReplacementBack(4)
+ ..assertLibrariesToImport(includes: [
+ 'dart:math',
+ ], excludes: [
+ 'dart:async',
+ 'dart:core',
+ 'package:test/test.dart',
+ ]);
+
+ var classes = responseValidator.suggestions.withElementClass();
+ classes.assertCompletions(['Random']);
+ classes.withCompletion('Random').assertSingle()
+ ..assertClass()
+ ..assertLibraryToImport('dart:math');
+ }
+
Future<void> test_notImported_emptyBudget() async {
await _configureWithWorkspaceRoot();
@@ -285,8 +311,7 @@
}
Future<void> test_notImported_pub_dependencies_inLib() async {
- // TODO(scheglov) Switch to PubspecYamlFileConfig
- newPubspecYamlFile(testPackageRootPath, r'''
+ writeTestPackagePubspecYamlFile(r'''
name: test
dependencies:
aaa: any
@@ -343,8 +368,7 @@
}
Future<void> test_notImported_pub_dependencies_inTest() async {
- // TODO(scheglov) Switch to PubspecYamlFileConfig
- newPubspecYamlFile(testPackageRootPath, r'''
+ writeTestPackagePubspecYamlFile(r'''
name: test
dependencies:
aaa: any
@@ -407,8 +431,6 @@
..assertLibraryToImport('package:bbb/f.dart');
}
- /// TODO(scheglov) Only lib/ libraries in lib/, no test/.
- /// TODO(scheglov) Suggestions from available Pub packages.
Future<void> test_notImported_pub_this() async {
newFile('$testPackageLibPath/a.dart', content: '''
class A01 {}
@@ -430,12 +452,12 @@
..assertComplete()
..assertReplacementBack(2)
..assertLibrariesToImport(includes: [
- 'dart:async',
- 'dart:math',
'package:test/a.dart',
'package:test/b.dart',
], excludes: [
+ 'dart:async',
'dart:core',
+ 'dart:math',
'package:test/test.dart',
]);
@@ -473,11 +495,11 @@
..assertComplete()
..assertReplacementBack(2)
..assertLibrariesToImport(includes: [
- 'dart:async',
- 'dart:math',
'package:test/b.dart',
], excludes: [
+ 'dart:async',
'dart:core',
+ 'dart:math',
'package:test/a.dart',
'package:test/test.dart',
]);
@@ -519,12 +541,12 @@
..assertComplete()
..assertReplacementBack(2)
..assertLibrariesToImport(includes: [
- 'dart:async',
- 'dart:math',
'package:test/a.dart',
'package:test/b.dart',
], excludes: [
+ 'dart:async',
'dart:core',
+ 'dart:math',
'package:test/test.dart',
]);
@@ -542,8 +564,7 @@
}
Future<void> test_notImported_pub_this_inLib_excludesTest() async {
- // TODO(scheglov) Switch to PubspecYamlFileConfig
- newPubspecYamlFile(testPackageRootPath, r'''
+ writeTestPackagePubspecYamlFile(r'''
name: test
''');
@@ -582,8 +603,7 @@
}
Future<void> test_notImported_pub_this_inLib_includesThisSrc() async {
- // TODO(scheglov) Switch to PubspecYamlFileConfig
- newPubspecYamlFile(testPackageRootPath, r'''
+ writeTestPackagePubspecYamlFile(r'''
name: test
''');
@@ -625,8 +645,7 @@
}
Future<void> test_notImported_pub_this_inTest_includesTest() async {
- // TODO(scheglov) Switch to PubspecYamlFileConfig
- newPubspecYamlFile(testPackageRootPath, r'''
+ writeTestPackagePubspecYamlFile(r'''
name: test
''');
@@ -673,8 +692,7 @@
}
Future<void> test_notImported_pub_this_inTest_includesThisSrc() async {
- // TODO(scheglov) Switch to PubspecYamlFileConfig
- newPubspecYamlFile(testPackageRootPath, r'''
+ writeTestPackagePubspecYamlFile(r'''
name: test
''');
@@ -1398,6 +1416,71 @@
suggestionsValidator.assertCompletions(['foo02', 'foo01']);
}
+ Future<void> test_yaml_analysisOptions_root() async {
+ await _configureWithWorkspaceRoot();
+
+ var path = convertPath('$testPackageRootPath/analysis_options.yaml');
+ var responseValidator = await _getCodeSuggestions(
+ path: path,
+ content: '^',
+ );
+
+ responseValidator
+ ..assertComplete()
+ ..assertEmptyReplacement();
+
+ responseValidator.suggestions
+ .withKindIdentifier()
+ .assertCompletionsContainsAll([
+ 'analyzer: ',
+ 'include: ',
+ 'linter: ',
+ ]);
+ }
+
+ Future<void> test_yaml_fixData_root() async {
+ await _configureWithWorkspaceRoot();
+
+ var path = convertPath('$testPackageRootPath/fix_data.yaml');
+ var responseValidator = await _getCodeSuggestions(
+ path: path,
+ content: '^',
+ );
+
+ responseValidator
+ ..assertComplete()
+ ..assertEmptyReplacement();
+
+ responseValidator.suggestions
+ .withKindIdentifier()
+ .assertCompletionsContainsAll([
+ 'version: ',
+ 'transforms:',
+ ]);
+ }
+
+ Future<void> test_yaml_pubspec_root() async {
+ await _configureWithWorkspaceRoot();
+
+ var path = convertPath('$testPackageRootPath/pubspec.yaml');
+ var responseValidator = await _getCodeSuggestions(
+ path: path,
+ content: '^',
+ );
+
+ responseValidator
+ ..assertComplete()
+ ..assertEmptyReplacement();
+
+ responseValidator.suggestions
+ .withKindIdentifier()
+ .assertCompletionsContainsAll([
+ 'name: ',
+ 'dependencies: ',
+ 'dev_dependencies: ',
+ ]);
+ }
+
Future<CompletionGetSuggestions2ResponseValidator> _getCodeSuggestions({
required String path,
required String content,
@@ -2493,6 +2576,10 @@
writePackageConfig(testPackageRoot, config);
}
+ void writeTestPackagePubspecYamlFile(String content) {
+ newPubspecYamlFile(testPackageRootPath, content);
+ }
+
Future<void> _configureWithWorkspaceRoot() async {
await setRoots(included: [workspaceRootPath], excluded: []);
await server.onAnalysisComplete;
@@ -2605,6 +2692,15 @@
expect(actual, completions);
}
+ /// Assert that this has suggestions with all [expected] completions.
+ /// There might be more suggestions, with other completions.
+ ///
+ /// Does not check the order, kinds, elements, etc.
+ void assertCompletionsContainsAll(Iterable<String> expected) {
+ var actual = suggestions.map((e) => e.completion).toSet();
+ expect(actual, containsAll(expected));
+ }
+
void assertEmpty() {
expect(suggestions, isEmpty);
}
@@ -2650,4 +2746,17 @@
libraryUrisToImport: libraryUrisToImport,
);
}
+
+ SuggestionsValidator withKind(CompletionSuggestionKind kind) {
+ return SuggestionsValidator(
+ suggestions.where((suggestion) {
+ return suggestion.kind == kind;
+ }).toList(),
+ libraryUrisToImport: libraryUrisToImport,
+ );
+ }
+
+ SuggestionsValidator withKindIdentifier() {
+ return withKind(CompletionSuggestionKind.IDENTIFIER);
+ }
}
diff --git a/pkg/analysis_server/test/services/completion/dart/imported_reference_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/imported_reference_contributor_test.dart
index 6f277c3..fae0f6f 100644
--- a/pkg/analysis_server/test/services/completion/dart/imported_reference_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/imported_reference_contributor_test.dart
@@ -331,7 +331,7 @@
}
Future<void> test_AsExpression() async {
- // SimpleIdentifier TypeName AsExpression
+ // SimpleIdentifier NamedType AsExpression
addTestSource('''
class A {var b; X _c; foo() {var a; (a as ^).foo();}''');
@@ -351,7 +351,7 @@
// suggesting types. We ought to do so because there's no reason to cast a
// value to the type it already has.
- // SimpleIdentifier TypeName AsExpression IfStatement
+ // SimpleIdentifier NamedType AsExpression IfStatement
addSource('/home/test/lib/b.dart', '''
foo() { }
class A {} class B extends A {} class C extends B {}
@@ -378,7 +378,7 @@
// suggesting types. We ought to do so because there's no reason to cast a
// value to the type it already has.
- // SimpleIdentifier TypeName AsExpression IfStatement
+ // SimpleIdentifier NamedType AsExpression IfStatement
addSource('/home/test/lib/b.dart', '''
foo() { }
class A {} class B implements A {} class C implements B {}
@@ -423,7 +423,7 @@
}
Future<void> test_AssignmentExpression_type() async {
- // SimpleIdentifier TypeName VariableDeclarationList
+ // SimpleIdentifier NamedType VariableDeclarationList
// VariableDeclarationStatement Block
addTestSource('''
class A {} void f() {
@@ -446,7 +446,7 @@
}
Future<void> test_AssignmentExpression_type_newline() async {
- // SimpleIdentifier TypeName VariableDeclarationList
+ // SimpleIdentifier NamedType VariableDeclarationList
// VariableDeclarationStatement Block
addTestSource('''
class A {} void f() {
@@ -468,7 +468,7 @@
}
Future<void> test_AssignmentExpression_type_partial() async {
- // SimpleIdentifier TypeName VariableDeclarationList
+ // SimpleIdentifier NamedType VariableDeclarationList
// VariableDeclarationStatement Block
addTestSource('''
class A {} void f() {
@@ -491,7 +491,7 @@
}
Future<void> test_AssignmentExpression_type_partial_newline() async {
- // SimpleIdentifier TypeName VariableDeclarationList
+ // SimpleIdentifier NamedType VariableDeclarationList
// VariableDeclarationStatement Block
addTestSource('''
class A {} void f() {
@@ -1342,7 +1342,7 @@
}
Future<void> test_CatchClause_onType() async {
- // TypeName CatchClause TryStatement
+ // NamedType CatchClause TryStatement
addTestSource('class A {a() {try{var x;} on ^ {}}}');
await computeSuggestions();
@@ -1355,7 +1355,7 @@
}
Future<void> test_CatchClause_onType_noBrackets() async {
- // TypeName CatchClause TryStatement
+ // NamedType CatchClause TryStatement
addTestSource('class A {a() {try{var x;} on ^}}');
await computeSuggestions();
@@ -1692,7 +1692,7 @@
}
Future<void> test_ConstructorName_importedClass() async {
- // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName
+ // SimpleIdentifier PrefixedIdentifier NamedType ConstructorName
// InstanceCreationExpression
addSource('/home/test/lib/b.dart', '''
lib B;
@@ -1717,7 +1717,7 @@
}
Future<void> test_ConstructorName_importedFactory() async {
- // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName
+ // SimpleIdentifier PrefixedIdentifier NamedType ConstructorName
// InstanceCreationExpression
addSource('/home/test/lib/b.dart', '''
lib B;
@@ -1742,7 +1742,7 @@
}
Future<void> test_ConstructorName_importedFactory2() async {
- // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName
+ // SimpleIdentifier PrefixedIdentifier NamedType ConstructorName
// InstanceCreationExpression
addTestSource('''
void f() {new String.fr^omCharCodes([]);}''');
@@ -1760,7 +1760,7 @@
}
Future<void> test_ConstructorName_localClass() async {
- // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName
+ // SimpleIdentifier PrefixedIdentifier NamedType ConstructorName
// InstanceCreationExpression
addTestSource('''
int T1;
@@ -1781,7 +1781,7 @@
}
Future<void> test_ConstructorName_localFactory() async {
- // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName
+ // SimpleIdentifier PrefixedIdentifier NamedType ConstructorName
// InstanceCreationExpression
addTestSource('''
int T1;
@@ -2911,7 +2911,7 @@
}
Future<void> test_InstanceCreationExpression_imported() async {
- // SimpleIdentifier TypeName ConstructorName InstanceCreationExpression
+ // SimpleIdentifier NamedType ConstructorName InstanceCreationExpression
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
@@ -2954,7 +2954,7 @@
}
Future<void> test_InstanceCreationExpression_unimported() async {
- // SimpleIdentifier TypeName ConstructorName InstanceCreationExpression
+ // SimpleIdentifier NamedType ConstructorName InstanceCreationExpression
addSource('/home/test/lib/ab.dart', 'class Clip { }');
addTestSource('class A {foo(){new C^}}');
@@ -3087,7 +3087,7 @@
}
Future<void> test_IsExpression() async {
- // SimpleIdentifier TypeName IsExpression IfStatement
+ // SimpleIdentifier NamedType IsExpression IfStatement
addSource('/home/test/lib/b.dart', '''
lib B;
foo() { }
@@ -3127,7 +3127,7 @@
}
Future<void> test_IsExpression_type() async {
- // SimpleIdentifier TypeName IsExpression IfStatement
+ // SimpleIdentifier NamedType IsExpression IfStatement
addTestSource('''
class A {int x; int y() => 0;}
void f(){var a; if (a is ^)}''');
@@ -3142,7 +3142,7 @@
}
Future<void> test_IsExpression_type_partial() async {
- // SimpleIdentifier TypeName IsExpression IfStatement
+ // SimpleIdentifier NamedType IsExpression IfStatement
addTestSource('''
class A {int x; int y() => 0;}
void f(){var a; if (a is Obj^)}''');
@@ -3162,7 +3162,7 @@
// suggesting types. We ought to do so because there's no reason to cast a
// value to the type it already has.
- // SimpleIdentifier TypeName IsExpression IfStatement
+ // SimpleIdentifier NamedType IsExpression IfStatement
addSource('/home/test/lib/b.dart', '''
foo() { }
class A {} class B extends A {} class C extends B {}
@@ -3189,7 +3189,7 @@
// suggesting types. We ought to do so because there's no reason to cast a
// value to the type it already has.
- // SimpleIdentifier TypeName IsExpression IfStatement
+ // SimpleIdentifier NamedType IsExpression IfStatement
addSource('/home/test/lib/b.dart', '''
foo() { }
class A {} class B implements A {} class C implements B {}
@@ -3872,7 +3872,7 @@
}
Future<void> test_partFile_TypeName() async {
- // SimpleIdentifier TypeName ConstructorName
+ // SimpleIdentifier NamedType ConstructorName
addSource('$testPackageLibPath/b.dart', '''
lib B;
int T1;
@@ -3909,7 +3909,7 @@
}
Future<void> test_partFile_TypeName2() async {
- // SimpleIdentifier TypeName ConstructorName
+ // SimpleIdentifier NamedType ConstructorName
addSource('/home/test/lib/b.dart', '''
lib libB;
int T1;
@@ -4097,7 +4097,7 @@
}
Future<void> test_PrefixedIdentifier_library_typesOnly() async {
- // SimpleIdentifier PrefixedIdentifier TypeName
+ // SimpleIdentifier PrefixedIdentifier NamedType
addSource('/home/test/lib/b.dart', '''
lib B;
var T1;
@@ -4124,7 +4124,7 @@
}
Future<void> test_PrefixedIdentifier_library_typesOnly2() async {
- // SimpleIdentifier PrefixedIdentifier TypeName
+ // SimpleIdentifier PrefixedIdentifier NamedType
addSource('/home/test/lib/b.dart', '''
lib B;
var T1;
@@ -4756,7 +4756,7 @@
}
Future<void> test_TypeArgumentList2() async {
- // TypeName TypeArgumentList TypeName
+ // NamedType TypeArgumentList NamedType
addSource('/home/test/lib/a.dart', '''
class C1 {int x;}
F1() => 0;
diff --git a/pkg/analysis_server/test/services/completion/dart/library_member_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/library_member_contributor_test.dart
index 5c1db88..646b75b 100644
--- a/pkg/analysis_server/test/services/completion/dart/library_member_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/library_member_contributor_test.dart
@@ -224,7 +224,7 @@
}
Future<void> test_PrefixedIdentifier_library_typesOnly() async {
- // SimpleIdentifier PrefixedIdentifier TypeName
+ // SimpleIdentifier PrefixedIdentifier NamedType
newFile('$testPackageLibPath/b.dart', content: '''
lib B;
var T1;
@@ -257,7 +257,7 @@
}
Future<void> test_PrefixedIdentifier_library_typesOnly2() async {
- // SimpleIdentifier PrefixedIdentifier TypeName
+ // SimpleIdentifier PrefixedIdentifier NamedType
newFile('$testPackageLibPath/b.dart', content: '''
lib B;
var T1;
diff --git a/pkg/analysis_server/test/services/completion/dart/local_library_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/local_library_contributor_test.dart
index 3a6fa56..52c6b90 100644
--- a/pkg/analysis_server/test/services/completion/dart/local_library_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/local_library_contributor_test.dart
@@ -28,7 +28,7 @@
}
Future<void> test_partFile_Constructor() async {
- // SimpleIdentifier TypeName ConstructorName
+ // SimpleIdentifier NamedType ConstructorName
newFile('$testPackageLibPath/b.dart', content: '''
lib B;
int T1;
@@ -63,7 +63,7 @@
}
Future<void> test_partFile_Constructor2() async {
- // SimpleIdentifier TypeName ConstructorName
+ // SimpleIdentifier NamedType ConstructorName
newFile('$testPackageLibPath/b.dart', content: '''
lib B;
int T1;
diff --git a/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart
index 6e7253d..878fc99 100644
--- a/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart
@@ -536,7 +536,7 @@
}
Future<void> test_AsExpression_type() async {
- // SimpleIdentifier TypeName AsExpression
+ // SimpleIdentifier NamedType AsExpression
addTestSource('''
class A {var b; X _c; foo() {var a; (a as ^).foo();}''');
await computeSuggestions();
@@ -556,7 +556,7 @@
// suggesting types. We ought to do so because there's no reason to cast a
// value to the type it already has.
- // SimpleIdentifier TypeName AsExpression
+ // SimpleIdentifier NamedType AsExpression
addTestSource('''
class A {} class B extends A {} class C extends A {} class D {}
f(A a){ (a as ^) }''');
@@ -577,7 +577,7 @@
// suggesting types. We ought to do so because there's no reason to cast a
// value to the type it already has.
- // SimpleIdentifier TypeName AsExpression
+ // SimpleIdentifier NamedType AsExpression
addTestSource('''
class A {} class B implements A {} class C implements A {} class D {}
f(A a){ (a as ^) }''');
@@ -593,7 +593,7 @@
}
Future<void> test_AsExpression_type_filter_undefined_type() async {
- // SimpleIdentifier TypeName AsExpression
+ // SimpleIdentifier NamedType AsExpression
addTestSource('''
class A {}
f(U u){ (u as ^) }''');
@@ -628,7 +628,7 @@
}
Future<void> test_AssignmentExpression_type() async {
- // SimpleIdentifier TypeName VariableDeclarationList
+ // SimpleIdentifier NamedType VariableDeclarationList
// VariableDeclarationStatement Block
addTestSource('''
class A {} void f() {
@@ -652,7 +652,7 @@
}
Future<void> test_AssignmentExpression_type_newline() async {
- // SimpleIdentifier TypeName VariableDeclarationList
+ // SimpleIdentifier NamedType VariableDeclarationList
// VariableDeclarationStatement Block
addTestSource('''
class A {} void f() {
@@ -675,7 +675,7 @@
}
Future<void> test_AssignmentExpression_type_partial() async {
- // SimpleIdentifier TypeName VariableDeclarationList
+ // SimpleIdentifier NamedType VariableDeclarationList
// VariableDeclarationStatement Block
addTestSource('''
class A {} void f() {
@@ -699,7 +699,7 @@
}
Future<void> test_AssignmentExpression_type_partial_newline() async {
- // SimpleIdentifier TypeName VariableDeclarationList
+ // SimpleIdentifier NamedType VariableDeclarationList
// VariableDeclarationStatement Block
addTestSource('''
class A {} void f() {
@@ -1616,7 +1616,7 @@
}
Future<void> test_CatchClause_onType() async {
- // TypeName CatchClause TryStatement
+ // NamedType CatchClause TryStatement
addTestSource('class A {a() {try{var x;} on ^ {}}}');
await computeSuggestions();
@@ -1629,7 +1629,7 @@
}
Future<void> test_CatchClause_onType_noBrackets() async {
- // TypeName CatchClause TryStatement
+ // NamedType CatchClause TryStatement
addTestSource('class A {a() {try{var x;} on ^}}');
await computeSuggestions();
@@ -2066,7 +2066,7 @@
}
Future<void> test_ConstructorName_importedClass() async {
- // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName
+ // SimpleIdentifier PrefixedIdentifier NamedType ConstructorName
// InstanceCreationExpression
addSource('/home/test/lib/b.dart', '''
lib B;
@@ -2091,7 +2091,7 @@
}
Future<void> test_ConstructorName_importedFactory() async {
- // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName
+ // SimpleIdentifier PrefixedIdentifier NamedType ConstructorName
// InstanceCreationExpression
addSource('/home/test/lib/b.dart', '''
lib B;
@@ -2116,7 +2116,7 @@
}
Future<void> test_ConstructorName_importedFactory2() async {
- // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName
+ // SimpleIdentifier PrefixedIdentifier NamedType ConstructorName
// InstanceCreationExpression
addTestSource('''
void f() {new String.fr^omCharCodes([]);}''');
@@ -2134,7 +2134,7 @@
}
Future<void> test_ConstructorName_localClass() async {
- // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName
+ // SimpleIdentifier PrefixedIdentifier NamedType ConstructorName
// InstanceCreationExpression
addTestSource('''
int T1;
@@ -2155,7 +2155,7 @@
}
Future<void> test_ConstructorName_localFactory() async {
- // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName
+ // SimpleIdentifier PrefixedIdentifier NamedType ConstructorName
// InstanceCreationExpression
addTestSource('''
int T1;
@@ -3762,7 +3762,7 @@
}
Future<void> test_InstanceCreationExpression_imported() async {
- // SimpleIdentifier TypeName ConstructorName InstanceCreationExpression
+ // SimpleIdentifier NamedType ConstructorName InstanceCreationExpression
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
@@ -3822,7 +3822,7 @@
}
Future<void> test_InstanceCreationExpression_unimported() async {
- // SimpleIdentifier TypeName ConstructorName InstanceCreationExpression
+ // SimpleIdentifier NamedType ConstructorName InstanceCreationExpression
addSource('/testAB.dart', 'class Foo { }');
addTestSource('class C {foo(){new F^}}');
await computeSuggestions();
@@ -3937,7 +3937,7 @@
}
Future<void> test_IsExpression() async {
- // SimpleIdentifier TypeName IsExpression IfStatement
+ // SimpleIdentifier NamedType IsExpression IfStatement
addSource('/home/test/lib/b.dart', '''
lib B;
foo() { }
@@ -3977,7 +3977,7 @@
}
Future<void> test_IsExpression_type() async {
- // SimpleIdentifier TypeName IsExpression IfStatement
+ // SimpleIdentifier NamedType IsExpression IfStatement
addTestSource('''
class A {int x; int y() => 0;}
void f(){var a; if (a is ^)}''');
@@ -3997,7 +3997,7 @@
// suggesting types. We ought to do so because there's no reason to cast a
// value to the type it already has.
- // SimpleIdentifier TypeName IsExpression IfStatement
+ // SimpleIdentifier NamedType IsExpression IfStatement
addTestSource('''
class A {} class B extends A {} class C extends A {} class D {}
f(A a){ if (a is ^) {}}''');
@@ -4018,7 +4018,7 @@
// suggesting types. We ought to do so because there's no reason to cast a
// value to the type it already has.
- // SimpleIdentifier TypeName IsExpression IfStatement
+ // SimpleIdentifier NamedType IsExpression IfStatement
addTestSource('''
class A {} class B implements A {} class C implements A {} class D {}
f(A a){ if (a is ^) {}}''');
@@ -4034,7 +4034,7 @@
}
Future<void> test_IsExpression_type_filter_undefined_type() async {
- // SimpleIdentifier TypeName AsExpression
+ // SimpleIdentifier NamedType AsExpression
addTestSource('''
class A {}
f(U u){ (u as ^) }''');
@@ -4046,7 +4046,7 @@
}
Future<void> test_IsExpression_type_partial() async {
- // SimpleIdentifier TypeName IsExpression IfStatement
+ // SimpleIdentifier NamedType IsExpression IfStatement
addTestSource('''
class A {int x; int y() => 0;}
void f(){var a; if (a is Obj^)}''');
@@ -5405,7 +5405,7 @@
}
Future<void> test_PrefixedIdentifier_library_typesOnly() async {
- // SimpleIdentifier PrefixedIdentifier TypeName
+ // SimpleIdentifier PrefixedIdentifier NamedType
addSource('/home/test/lib/b.dart', '''
lib B;
var T1;
@@ -5432,7 +5432,7 @@
}
Future<void> test_PrefixedIdentifier_library_typesOnly2() async {
- // SimpleIdentifier PrefixedIdentifier TypeName
+ // SimpleIdentifier PrefixedIdentifier NamedType
addSource('/home/test/lib/b.dart', '''
lib B;
var T1;
@@ -6133,7 +6133,7 @@
}
Future<void> test_TypeArgumentList2() async {
- // TypeName TypeArgumentList TypeName
+ // NamedType TypeArgumentList NamedType
addSource('/home/test/lib/a.dart', '''
class C1 {int x;}
F1() => 0;
diff --git a/pkg/analysis_server/test/services/completion/dart/named_constructor_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/named_constructor_contributor_test.dart
index a671eeb..c522a1f 100644
--- a/pkg/analysis_server/test/services/completion/dart/named_constructor_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/named_constructor_contributor_test.dart
@@ -290,7 +290,7 @@
}
Future<void> test_ConstructorName_importedClass() async {
- // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName
+ // SimpleIdentifier PrefixedIdentifier NamedType ConstructorName
// InstanceCreationExpression
addSource('/home/test/lib/b.dart', '''
lib B;
@@ -318,7 +318,7 @@
}
Future<void> test_ConstructorName_importedClass_unresolved() async {
- // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName
+ // SimpleIdentifier PrefixedIdentifier NamedType ConstructorName
// InstanceCreationExpression
addSource('/home/test/lib/b.dart', '''
lib B;
@@ -347,7 +347,7 @@
}
Future<void> test_ConstructorName_importedFactory() async {
- // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName
+ // SimpleIdentifier PrefixedIdentifier NamedType ConstructorName
// InstanceCreationExpression
addSource('/home/test/lib/b.dart', '''
lib B;
@@ -375,7 +375,7 @@
}
Future<void> test_ConstructorName_importedFactory2() async {
- // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName
+ // SimpleIdentifier PrefixedIdentifier NamedType ConstructorName
// InstanceCreationExpression
addTestSource('''
main() {new String.fr^omCharCodes([]);}''');
@@ -395,7 +395,7 @@
}
Future<void> test_ConstructorName_localClass() async {
- // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName
+ // SimpleIdentifier PrefixedIdentifier NamedType ConstructorName
// InstanceCreationExpression
addTestSource('''
int T1;
@@ -422,7 +422,7 @@
}
Future<void> test_ConstructorName_localFactory() async {
- // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName
+ // SimpleIdentifier PrefixedIdentifier NamedType ConstructorName
// InstanceCreationExpression
addTestSource('''
int T1;
diff --git a/pkg/analysis_server/test/services/completion/dart/type_member_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/type_member_contributor_test.dart
index c7f9a18..fb04e96 100644
--- a/pkg/analysis_server/test/services/completion/dart/type_member_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/type_member_contributor_test.dart
@@ -338,7 +338,7 @@
}
Future<void> test_AsExpression() async {
- // SimpleIdentifier TypeName AsExpression
+ // SimpleIdentifier NamedType AsExpression
addTestSource('''
class A {var b; X _c; foo() {var a; (a as ^).foo();}''');
await computeSuggestions();
@@ -373,7 +373,7 @@
}
Future<void> test_AssignmentExpression_type() async {
- // SimpleIdentifier TypeName VariableDeclarationList
+ // SimpleIdentifier NamedType VariableDeclarationList
// VariableDeclarationStatement Block
addTestSource('''
class A {} void f() {
@@ -395,7 +395,7 @@
}
Future<void> test_AssignmentExpression_type_newline() async {
- // SimpleIdentifier TypeName VariableDeclarationList
+ // SimpleIdentifier NamedType VariableDeclarationList
// VariableDeclarationStatement Block
addTestSource('''
class A {} void f() {
@@ -416,7 +416,7 @@
}
Future<void> test_AssignmentExpression_type_partial() async {
- // SimpleIdentifier TypeName VariableDeclarationList
+ // SimpleIdentifier NamedType VariableDeclarationList
// VariableDeclarationStatement Block
addTestSource('''
class A {} void f() {
@@ -438,7 +438,7 @@
}
Future<void> test_AssignmentExpression_type_partial_newline() async {
- // SimpleIdentifier TypeName VariableDeclarationList
+ // SimpleIdentifier NamedType VariableDeclarationList
// VariableDeclarationStatement Block
addTestSource('''
class A {} void f() {
@@ -1203,7 +1203,7 @@
}
Future<void> test_CatchClause_onType() async {
- // TypeName CatchClause TryStatement
+ // NamedType CatchClause TryStatement
addTestSource('class A {a() {try{var x;} on ^ {}}}');
await computeSuggestions();
expect(replacementOffset, completionOffset);
@@ -1215,7 +1215,7 @@
}
Future<void> test_CatchClause_onType_noBrackets() async {
- // TypeName CatchClause TryStatement
+ // NamedType CatchClause TryStatement
addTestSource('class A {a() {try{var x;} on ^}}');
await computeSuggestions();
expect(replacementOffset, completionOffset);
@@ -1520,7 +1520,7 @@
}
Future<void> test_ConstructorName_importedClass() async {
- // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName
+ // SimpleIdentifier PrefixedIdentifier NamedType ConstructorName
// InstanceCreationExpression
addSource('/home/test/lib/b.dart', '''
lib B;
@@ -1544,7 +1544,7 @@
}
Future<void> test_ConstructorName_importedFactory() async {
- // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName
+ // SimpleIdentifier PrefixedIdentifier NamedType ConstructorName
// InstanceCreationExpression
addSource('/home/test/lib/b.dart', '''
lib B;
@@ -1568,7 +1568,7 @@
}
Future<void> test_ConstructorName_importedFactory2() async {
- // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName
+ // SimpleIdentifier PrefixedIdentifier NamedType ConstructorName
// InstanceCreationExpression
addTestSource('''
void f() {new String.fr^omCharCodes([]);}''');
@@ -1585,7 +1585,7 @@
}
Future<void> test_ConstructorName_localClass() async {
- // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName
+ // SimpleIdentifier PrefixedIdentifier NamedType ConstructorName
// InstanceCreationExpression
addTestSource('''
int T1;
@@ -1605,7 +1605,7 @@
}
Future<void> test_ConstructorName_localFactory() async {
- // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName
+ // SimpleIdentifier PrefixedIdentifier NamedType ConstructorName
// InstanceCreationExpression
addTestSource('''
int T1;
@@ -2217,7 +2217,7 @@
}
Future<void> test_InstanceCreationExpression_imported() async {
- // SimpleIdentifier TypeName ConstructorName InstanceCreationExpression
+ // SimpleIdentifier NamedType ConstructorName InstanceCreationExpression
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
@@ -2247,7 +2247,7 @@
}
Future<void> test_InstanceCreationExpression_unimported() async {
- // SimpleIdentifier TypeName ConstructorName InstanceCreationExpression
+ // SimpleIdentifier NamedType ConstructorName InstanceCreationExpression
addSource('/testAB.dart', 'class Foo { }');
addTestSource('class C {foo(){new F^}}');
await computeSuggestions();
@@ -2398,7 +2398,7 @@
}
Future<void> test_IsExpression() async {
- // SimpleIdentifier TypeName IsExpression IfStatement
+ // SimpleIdentifier NamedType IsExpression IfStatement
addSource('/home/test/lib/b.dart', '''
lib B;
foo() { }
@@ -2436,7 +2436,7 @@
}
Future<void> test_IsExpression_type() async {
- // SimpleIdentifier TypeName IsExpression IfStatement
+ // SimpleIdentifier NamedType IsExpression IfStatement
addTestSource('''
class A {int x; int y() => 0;}
void f(){var a; if (a is ^)}''');
@@ -2450,7 +2450,7 @@
}
Future<void> test_IsExpression_type_partial() async {
- // SimpleIdentifier TypeName IsExpression IfStatement
+ // SimpleIdentifier NamedType IsExpression IfStatement
addTestSource('''
class A {int x; int y() => 0;}
void f(){var a; if (a is Obj^)}''');
@@ -3267,7 +3267,7 @@
}
Future<void> test_partFile_TypeName() async {
- // SimpleIdentifier TypeName ConstructorName
+ // SimpleIdentifier NamedType ConstructorName
addSource('/home/test/lib/b.dart', '''
lib B;
int T1;
@@ -3299,7 +3299,7 @@
}
Future<void> test_partFile_TypeName2() async {
- // SimpleIdentifier TypeName ConstructorName
+ // SimpleIdentifier NamedType ConstructorName
addSource('/home/test/lib/b.dart', '''
lib B;
int T1;
@@ -3479,7 +3479,7 @@
}
Future<void> test_PrefixedIdentifier_library_typesOnly() async {
- // SimpleIdentifier PrefixedIdentifier TypeName
+ // SimpleIdentifier PrefixedIdentifier NamedType
addSource('/home/test/lib/b.dart', '''
lib B;
var T1;
@@ -3505,7 +3505,7 @@
}
Future<void> test_PrefixedIdentifier_library_typesOnly2() async {
- // SimpleIdentifier PrefixedIdentifier TypeName
+ // SimpleIdentifier PrefixedIdentifier NamedType
addSource('/home/test/lib/b.dart', '''
lib B;
var T1;
@@ -4173,7 +4173,7 @@
}
Future<void> test_TypeArgumentList2() async {
- // TypeName TypeArgumentList TypeName
+ // NamedType TypeArgumentList NamedType
addSource('/home/test/lib/a.dart', '''
class C1 {int x;}
F1() => 0;
diff --git a/pkg/analyzer/lib/src/dart/resolver/yield_statement_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/yield_statement_resolver.dart
index 02e043b..0016d66 100644
--- a/pkg/analyzer/lib/src/dart/resolver/yield_statement_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/yield_statement_resolver.dart
@@ -96,11 +96,13 @@
);
return;
}
- var imposedTypeAsInstanceOf = bodyContext.isSynchronous
- ? imposedReturnType.asInstanceOf(_typeProvider.iterableElement)
- : imposedReturnType.asInstanceOf(_typeProvider.streamElement);
- var imposedValueType = imposedTypeAsInstanceOf?.typeArguments[0];
- if (imposedValueType != null) {
+ var imposedSequenceType = imposedReturnType.asInstanceOf(
+ bodyContext.isSynchronous
+ ? _typeProvider.iterableElement
+ : _typeProvider.streamElement,
+ );
+ if (imposedSequenceType != null) {
+ var imposedValueType = imposedSequenceType.typeArguments[0];
_errorReporter.reportErrorForNode(
CompileTimeErrorCode.YIELD_OF_INVALID_TYPE,
expression,
diff --git a/pkg/analyzer/lib/src/generated/super_context.dart b/pkg/analyzer/lib/src/generated/super_context.dart
index 8902ebb..7068c16 100644
--- a/pkg/analyzer/lib/src/generated/super_context.dart
+++ b/pkg/analyzer/lib/src/generated/super_context.dart
@@ -37,7 +37,7 @@
return node.factoryKeyword == null
? SuperContext.valid
: SuperContext.static;
- } else if (node is ConstructorFieldInitializer) {
+ } else if (node is ConstructorInitializer) {
return SuperContext.static;
} else if (node is FieldDeclaration) {
return node.staticKeyword == null && node.fields.lateKeyword != null
diff --git a/pkg/analyzer/test/src/diagnostics/super_in_invalid_context_test.dart b/pkg/analyzer/test/src/diagnostics/super_in_invalid_context_test.dart
index 321b5e8..ca2e979 100644
--- a/pkg/analyzer/test/src/diagnostics/super_in_invalid_context_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/super_in_invalid_context_test.dart
@@ -77,7 +77,7 @@
]);
}
- test_constructorFieldInitializer() async {
+ test_constructorInitializer_field() async {
await assertErrorsInCode(r'''
class A {
m() {}
@@ -91,6 +91,37 @@
]);
}
+ test_constructorInitializer_super() async {
+ await assertErrorsInCode(r'''
+class S {
+ final int f;
+ S(this.f);
+}
+
+class C extends S {
+ C() : super(super.f);
+}
+''', [
+ error(CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT, 75, 5),
+ ]);
+ }
+
+ test_constructorInitializer_this() async {
+ await assertErrorsInCode(r'''
+class S {
+ final int f;
+ S(this.f);
+}
+
+class C extends S {
+ C() : this.other(super.f);
+ C.other(int a) : super(a);
+}
+''', [
+ error(CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT, 80, 5),
+ ]);
+ }
+
test_extension_field_static() async {
await assertErrorsInCode('''
class A {
diff --git a/pkg/compiler/lib/src/dart2js.dart b/pkg/compiler/lib/src/dart2js.dart
index bd60c69..4c33c5a 100644
--- a/pkg/compiler/lib/src/dart2js.dart
+++ b/pkg/compiler/lib/src/dart2js.dart
@@ -929,7 +929,7 @@
String summary;
switch (readStrategy) {
case ReadStrategy.fromDart:
- inputName = 'characters Dart';
+ inputName = inputDillUri != null ? 'kernel bytes' : 'characters Dart';
inputSize = inputProvider.dartCharactersRead;
summary = 'Dart file $input ';
break;
@@ -1378,7 +1378,7 @@
fail(message);
}
-void main(List<String> arguments) {
+Future<void> main(List<String> arguments) async {
// Expand `@path/to/file`
// When running from bazel, argument of the form `@path/to/file` might be
// provided. It needs to be replaced by reading all the contents of the
@@ -1396,7 +1396,7 @@
batchMain(arguments.sublist(0, arguments.length - 1));
return;
}
- internalMain(arguments);
+ await internalMain(arguments);
}
/// Return all non-empty lines in a file found at [path].
diff --git a/pkg/compiler/lib/src/kernel/loader.dart b/pkg/compiler/lib/src/kernel/loader.dart
index 79e95d4..57c32f2 100644
--- a/pkg/compiler/lib/src/kernel/loader.dart
+++ b/pkg/compiler/lib/src/kernel/loader.dart
@@ -54,13 +54,16 @@
@override
String get name => 'kernel loader';
-
- ir.Reference findMainMethod(Component component, Uri entryUri) {
+ Library findEntryLibrary(Component component, Uri entryUri) {
var entryLibrary = component.libraries
.firstWhere((l) => l.fileUri == entryUri, orElse: () => null);
if (entryLibrary == null) {
throw ArgumentError('Entry uri $entryUri not found in dill.');
}
+ return entryLibrary;
+ }
+
+ ir.Reference findMainMethod(Library entryLibrary) {
var mainMethod = entryLibrary.procedures
.firstWhere((p) => p.name.text == 'main', orElse: () => null);
@@ -76,11 +79,27 @@
mainMethodReference = mainMethod.reference;
}
if (mainMethodReference == null) {
- throw ArgumentError('Entry uri $entryUri has no main method.');
+ throw ArgumentError(
+ 'Entry uri ${entryLibrary.fileUri} has no main method.');
}
return mainMethodReference;
}
+ Set<Library> computeRequiredLibraries(Library entryLibrary) {
+ var toVisit = [entryLibrary];
+ var visited = <Library>{entryLibrary};
+ while (toVisit.isNotEmpty) {
+ var library = toVisit.removeLast();
+ for (var dependency in library.dependencies) {
+ var target = dependency.targetLibrary;
+ if (visited.add(target)) {
+ toVisit.add(target);
+ }
+ }
+ }
+ return visited;
+ }
+
/// Loads an entire Kernel [Component] from a file on disk.
Future<KernelResult> load() {
return measure(() async {
@@ -124,8 +143,10 @@
// If an entryUri is supplied, we use it to manually select the main
// method.
+ Library entryLibrary;
if (_options.entryUri != null) {
- var mainMethod = findMainMethod(component, _options.entryUri);
+ entryLibrary = findEntryLibrary(component, _options.entryUri);
+ var mainMethod = findMainMethod(entryLibrary);
component.setMainMethodAndMode(mainMethod, true, component.mode);
}
@@ -161,7 +182,8 @@
if (platformUri != resolvedUri) await read(platformUri);
}
- // Concatenate dills and then reset main method.
+ // Concatenate dills, trim the resulting monolithic dill, and then
+ // reset the main method.
var mainMethod = component.mainMethodName;
var mainMode = component.mode;
if (_options.dillDependencies != null) {
@@ -169,6 +191,18 @@
await read(dependency);
}
}
+ if (entryLibrary != null) {
+ var requiredLibraries = computeRequiredLibraries(entryLibrary);
+ for (var library in component.libraries) {
+ if (library.importUri.scheme == 'dart') {
+ requiredLibraries.add(library);
+ }
+ }
+ component = ir.Component(
+ libraries: requiredLibraries.toList(),
+ uriToSource: component.uriToSource,
+ nameRoot: component.root);
+ }
component.setMainMethodAndMode(mainMethod, true, mainMode);
// This is not expected to be null when creating a whole-program .dill
diff --git a/pkg/dartdev/lib/dartdev.dart b/pkg/dartdev/lib/dartdev.dart
index 9367cf6..a545f1a 100644
--- a/pkg/dartdev/lib/dartdev.dart
+++ b/pkg/dartdev/lib/dartdev.dart
@@ -213,7 +213,10 @@
final path = commandNames.join('/');
// Send the screen view to analytics
unawaited(
- analytics.sendScreenView(path),
+ analytics.sendScreenView(path, parameters:
+ // Starts a new analytics session.
+ // https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#sc
+ {'sc': 'start'}),
);
// The exit code for the dartdev process; null indicates that it has not been
diff --git a/pkg/dartdev/test/analytics_test.dart b/pkg/dartdev/test/analytics_test.dart
index 3ae1f16..8314399 100644
--- a/pkg/dartdev/test/analytics_test.dart
+++ b/pkg/dartdev/test/analytics_test.dart
@@ -75,7 +75,7 @@
expect(extractAnalytics(result), [
{
'hitType': 'screenView',
- 'message': {'viewName': 'help'}
+ 'message': {'viewName': 'help', 'sc': 'start'}
},
{
'hitType': 'event',
@@ -104,7 +104,7 @@
expect(extractAnalytics(result), [
{
'hitType': 'screenView',
- 'message': {'viewName': 'create'}
+ 'message': {'viewName': 'create', 'sc': 'start'}
},
{
'hitType': 'event',
@@ -139,7 +139,7 @@
expect(extractAnalytics(result), [
{
'hitType': 'screenView',
- 'message': {'viewName': 'pub/get'}
+ 'message': {'viewName': 'pub/get', 'sc': 'start'}
},
{
'hitType': 'event',
@@ -174,7 +174,7 @@
expect(extractAnalytics(result), [
{
'hitType': 'screenView',
- 'message': {'viewName': 'pub/get'}
+ 'message': {'viewName': 'pub/get', 'sc': 'start'},
},
{
'hitType': 'event',
@@ -224,7 +224,7 @@
expect(extractAnalytics(result), [
{
'hitType': 'screenView',
- 'message': {'viewName': 'format'}
+ 'message': {'viewName': 'format', 'sc': 'start'}
},
{
'hitType': 'event',
@@ -263,7 +263,7 @@
expect(extractAnalytics(result), [
{
'hitType': 'screenView',
- 'message': {'viewName': 'run'}
+ 'message': {'viewName': 'run', 'sc': 'start'},
},
{
'hitType': 'event',
@@ -301,7 +301,7 @@
expect(extractAnalytics(result), [
{
'hitType': 'screenView',
- 'message': {'viewName': 'run'}
+ 'message': {'viewName': 'run', 'sc': 'start'},
},
{
'hitType': 'event',
@@ -339,7 +339,7 @@
expect(extractAnalytics(result), [
{
'hitType': 'screenView',
- 'message': {'viewName': 'compile/kernel'}
+ 'message': {'viewName': 'compile/kernel', 'sc': 'start'},
},
{
'hitType': 'event',
diff --git a/tools/VERSION b/tools/VERSION
index 5fbe1c7..f0f449b 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 15
PATCH 0
-PRERELEASE 274
+PRERELEASE 275
PRERELEASE_PATCH 0
\ No newline at end of file