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

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

Issue 2863683002: Specify types in generated closure args. (Closed)
Patch Set: Created 3 years, 7 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/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 b97eb588162eec04b90d514c421e32417720ea41..34630536a0f132e6bba8ea851e493c1a6ab68f0b 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/utilities.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/utilities.dart
@@ -189,7 +189,9 @@ String getDefaultStringParameterValue(ParameterElement param) {
}
}
if (type is FunctionType) {
- String params = type.parameters.map((p) => p.name).join(', ');
+ String params = type.parameters
+ .map((p) => '${getTypeString(p.type)}${p.name}')
+ .join(', ');
//TODO(pq): consider adding a `TODO:` message in generated stub
return '($params) {}';
}
@@ -198,6 +200,8 @@ String getDefaultStringParameterValue(ParameterElement param) {
return null;
}
+String getTypeString(DartType type) => type.isDynamic ? '' : '${type.name} ';
+
bool isDartList(DartType type) {
ClassElement element = type.element;
if (element != null) {
@@ -251,4 +255,5 @@ String nameForType(TypeAnnotation type) {
return DYNAMIC;
}
+//TODO(pq): fix to use getDefaultStringParameterValue()
String _getDefaultValue(ParameterElement param) => 'null';

Powered by Google App Engine
This is Rietveld 408576698