Index: pkg/front_end/lib/src/fasta/source/outline_builder.dart |
diff --git a/pkg/front_end/lib/src/fasta/source/outline_builder.dart b/pkg/front_end/lib/src/fasta/source/outline_builder.dart |
index 4549589d4596b52b14b563dabd06e9a3170f4987..b1dc83ae6763d9e9a55c35b4dee83e2e7a5ba46c 100644 |
--- a/pkg/front_end/lib/src/fasta/source/outline_builder.dart |
+++ b/pkg/front_end/lib/src/fasta/source/outline_builder.dart |
@@ -370,7 +370,20 @@ class OutlineBuilder extends UnhandledListener { |
if (formals != null && formals.isNotEmpty) { |
var last = formals.last; |
if (last is List) { |
- var newList = |
+ // TODO(sigmund): change `List newList` back to `var`. |
+ // |
+ // Note: in strong-mode the two `setRange` statements below fail |
+ // dynamically because `formals` and `last` are not |
+ // Iterable<FormalParameterBuilder>. |
+ // A way to fix this without coping or iterating over |
+ // the list of formals would be to split the optional arguments as a |
+ // separate value on the parsing stack, then simply concatenate them: |
+ // |
+ // List<FormalParameterBuilder> optionalFormals = pop(); |
+ // List<FormalParameterBuilder> requiredFormals = popList(count); |
+ // |
+ // The resulting code might also be easier to follow. |
+ List newList = |
ahe
2017/02/07 11:03:08
You don't need to add this comment, just do this:
Siggi Cherem (dart-lang)
2017/02/07 21:59:26
Here too: `var` is inferred as `List<FormalParamet
|
new List<FormalParameterBuilder>(formals.length - 1 + last.length); |
newList.setRange(0, formals.length - 1, formals); |
newList.setRange(formals.length - 1, newList.length, last); |