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

Unified Diff: pkg/front_end/lib/src/fasta/source/outline_builder.dart

Issue 2725093003: Recover correctly from empty optional parameters. (Closed)
Patch Set: Created 3 years, 10 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 | « pkg/front_end/lib/src/fasta/kernel/kernel_target.dart ('k') | tests/co19/co19-kernel.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2f9304c0b798e1312876328322e154cd43b8bf54..215d2eb04fc582f20332322e26b1b2ac5526bb38 100644
--- a/pkg/front_end/lib/src/fasta/source/outline_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/outline_builder.dart
@@ -425,7 +425,11 @@ class OutlineBuilder extends UnhandledListener {
FormalParameterType kind = optional("{", beginToken)
? FormalParameterType.NAMED
: FormalParameterType.POSITIONAL;
- List parameters = popList(count);
+ // When recovering from an empty list of optional arguments, count may be
+ // 0. It might be simpler if the parser didn't call this method in that
+ // case, however, then [beginOptionalFormalParameters] wouldn't always be
+ // matched by this method.
+ List parameters = popList(count) ?? [];
for (FormalParameterBuilder parameter in parameters) {
parameter.kind = kind;
}
« no previous file with comments | « pkg/front_end/lib/src/fasta/kernel/kernel_target.dart ('k') | tests/co19/co19-kernel.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698