Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(826)

Unified Diff: pkg/analysis_server/lib/src/services/completion/dart/optype.dart

Issue 2034713004: improve completions in closures and switch statements (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: merge Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analysis_server/lib/src/services/completion/dart/optype.dart
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/optype.dart b/pkg/analysis_server/lib/src/services/completion/dart/optype.dart
index ea97679577cae9f42325d362da95c296d5143088..995ec2756827c7dd8c11bf8d13dc315097fb652a 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/optype.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/optype.dart
@@ -772,6 +772,10 @@ class _OpTypeAstVisitor extends GeneralizingAstVisitor {
if (identical(entity, node.expression)) {
optype.includeReturnValueSuggestions = true;
optype.includeTypeNameSuggestions = true;
+ } else if (node.statements.contains(entity)) {
+ optype.includeReturnValueSuggestions = true;
+ optype.includeTypeNameSuggestions = true;
+ optype.includeVoidReturnSuggestions = true;
}
}
@@ -877,14 +881,6 @@ class _OpTypeAstVisitor extends GeneralizingAstVisitor {
}
}
- bool _isEntityPrevToken(TokenType expectedType) {
- Object entity = this.entity;
- if (entity is SimpleIdentifier && entity.token.isSynthetic) {
- return entity.token.previous.type == expectedType;
- }
- return false;
- }
-
bool _isEntityPrevTokenSynthetic() {
Object entity = this.entity;
if (entity is AstNode && entity.beginToken.previous?.isSynthetic ?? false) {

Powered by Google App Engine
This is Rietveld 408576698