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

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

Issue 2862623002: Add default implementation when fixing missing required closures (flutter-intellij#975) (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/services/correction/fix_internal.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/services/completion/dart/utilities.dart
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/utilities.dart b/pkg/analysis_server/lib/src/services/completion/dart/utilities.dart
index bd4421d4a59342e33507e58304d00bd886ccb992..b97eb588162eec04b90d514c421e32417720ea41 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/utilities.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/utilities.dart
@@ -178,18 +178,22 @@ CompletionSuggestion createLocalSuggestion(SimpleIdentifier id,
}
String getDefaultStringParameterValue(ParameterElement param) {
- DartType type = param.type;
- if (type is InterfaceType && isDartList(type)) {
- List<DartType> typeArguments = type.typeArguments;
- StringBuffer sb = new StringBuffer();
- if (typeArguments.length == 1) {
- DartType typeArg = typeArguments.first;
- if (!typeArg.isDynamic) {
- sb.write('<${typeArg.name}>');
+ if (param != null) {
+ DartType type = param.type;
+ if (type is InterfaceType && isDartList(type)) {
+ List<DartType> typeArguments = type.typeArguments;
+ if (typeArguments.length == 1) {
+ DartType typeArg = typeArguments.first;
+ String typeInfo = !typeArg.isDynamic ? '<${typeArg.name}>' : '';
+ return '$typeInfo[]';
}
- sb.write('[]');
- return sb.toString();
}
+ if (type is FunctionType) {
+ String params = type.parameters.map((p) => p.name).join(', ');
+ //TODO(pq): consider adding a `TODO:` message in generated stub
+ return '($params) {}';
+ }
+ //TODO(pq): support map literals
}
return null;
}
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/services/correction/fix_internal.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698