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 a3ec936bb7299bb792ede1bfdfbab7e16b93425f..f64f5d07c1c15dd79c2daecf5dad510f760aab9c 100644 |
--- a/pkg/analysis_server/lib/src/services/completion/dart/utilities.dart |
+++ b/pkg/analysis_server/lib/src/services/completion/dart/utilities.dart |
@@ -13,6 +13,7 @@ import 'package:analysis_server/src/provisional/completion/dart/completion_dart. |
import 'package:analyzer/dart/ast/ast.dart'; |
import 'package:analyzer/dart/ast/standard_ast_factory.dart'; |
import 'package:analyzer/dart/ast/token.dart'; |
+import 'package:analyzer/dart/element/element.dart'; |
import 'package:analyzer/src/dart/ast/token.dart'; |
import 'package:analyzer/src/generated/source.dart'; |
@@ -29,6 +30,21 @@ final TypeName NO_RETURN_TYPE = astFactory.typeName( |
null); |
/** |
+ * Build a default argument list based on the given [requiredParams] and |
+ * [namedParams]. |
+ */ |
+String buildDefaultArgList(Iterable<ParameterElement> requiredParams, |
+ Iterable<ParameterElement> namedParams) { |
+ List<String> args = requiredParams.map((p) => p.name).toList(); |
+ List<String> requiredArgs = namedParams |
+ .where((p) => p.isRequired) |
+ .map((p) => '${p.name}: null') |
+ .toList(); |
+ args.addAll(requiredArgs); |
+ return args.isEmpty ? null : args.join(', '); |
+} |
+ |
+/** |
* Create a new protocol Element for inclusion in a completion suggestion. |
*/ |
protocol.Element createLocalElement( |