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

Commit 54e96f6

Browse files
jwrencommit-bot@chromium.org
authored andcommitted
Add the dynamic keyword into additional missing portions of the AST (in method and constructor parameters) in the keyword_contributor.dart
Change-Id: Idd394dc19992fa6406783a53ad50ebf58cf8f60f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138785 Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Jaime Wren <[email protected]>
1 parent 8329bd7 commit 54e96f6

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

pkg/analysis_server/lib/src/services/completion/dart/keyword_contributor.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,13 +361,15 @@ class _KeywordVisitor extends GeneralizingAstVisitor<void> {
361361
}
362362
if (entity is Token && (entity as Token).type == TokenType.CLOSE_PAREN) {
363363
_addSuggestion(Keyword.COVARIANT);
364+
_addSuggestion(Keyword.DYNAMIC);
364365
if (request.featureSet.isEnabled(Feature.non_nullable)) {
365366
_addSuggestion(Keyword.REQUIRED);
366367
}
367368
} else if (entity is FormalParameter) {
368369
Token beginToken = (entity as FormalParameter).beginToken;
369370
if (beginToken != null && request.target.offset == beginToken.end) {
370371
_addSuggestion(Keyword.COVARIANT);
372+
_addSuggestion(Keyword.DYNAMIC);
371373
if (request.featureSet.isEnabled(Feature.non_nullable)) {
372374
_addSuggestion(Keyword.REQUIRED);
373375
}

pkg/analysis_server/test/services/completion/dart/keyword_contributor_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class KeywordContributorTest extends DartCompletionContributorTest {
7171
}
7272

7373
List<Keyword> get constructorParameter {
74-
List<Keyword> keywords = [Keyword.COVARIANT, Keyword.THIS];
74+
List<Keyword> keywords = [Keyword.COVARIANT, Keyword.DYNAMIC, Keyword.THIS];
7575
if (isEnabled(ExperimentalFeatures.non_nullable)) {
7676
keywords.add(Keyword.REQUIRED);
7777
}
@@ -156,7 +156,7 @@ class KeywordContributorTest extends DartCompletionContributorTest {
156156
}
157157

158158
List<Keyword> get methodParameter {
159-
List<Keyword> keywords = [Keyword.COVARIANT];
159+
List<Keyword> keywords = [Keyword.COVARIANT, Keyword.DYNAMIC];
160160
if (isEnabled(ExperimentalFeatures.non_nullable)) {
161161
keywords.add(Keyword.REQUIRED);
162162
}

0 commit comments

Comments
 (0)