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

Side by Side Diff: pkg/front_end/lib/src/fasta/kernel/body_builder.dart

Issue 2725093003: Recover correctly from empty optional parameters. (Closed)
Patch Set: Created 3 years, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/kernel/kernel_target.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library fasta.body_builder; 5 library fasta.body_builder;
6 6
7 import '../parser/parser.dart' show FormalParameterType, optional; 7 import '../parser/parser.dart' show FormalParameterType, optional;
8 8
9 import '../parser/error_kind.dart' show ErrorKind; 9 import '../parser/error_kind.dart' show ErrorKind;
10 10
(...skipping 1303 matching lines...) Expand 10 before | Expand all | Expand 10 after
1314 push(variable); 1314 push(variable);
1315 } 1315 }
1316 1316
1317 @override 1317 @override
1318 void endOptionalFormalParameters( 1318 void endOptionalFormalParameters(
1319 int count, Token beginToken, Token endToken) { 1319 int count, Token beginToken, Token endToken) {
1320 debugEvent("OptionalFormalParameters"); 1320 debugEvent("OptionalFormalParameters");
1321 FormalParameterType kind = optional("{", beginToken) 1321 FormalParameterType kind = optional("{", beginToken)
1322 ? FormalParameterType.NAMED 1322 ? FormalParameterType.NAMED
1323 : FormalParameterType.POSITIONAL; 1323 : FormalParameterType.POSITIONAL;
1324 push(new OptionalFormals(kind, popList(count))); 1324 push(new OptionalFormals(kind, popList(count) ?? []));
1325 } 1325 }
1326 1326
1327 @override 1327 @override
1328 void beginFunctionTypedFormalParameter(Token token) { 1328 void beginFunctionTypedFormalParameter(Token token) {
1329 debugEvent("beginFunctionTypedFormalParameter"); 1329 debugEvent("beginFunctionTypedFormalParameter");
1330 functionNestingLevel++; 1330 functionNestingLevel++;
1331 } 1331 }
1332 1332
1333 @override 1333 @override
1334 void endFunctionTypedFormalParameter( 1334 void endFunctionTypedFormalParameter(
(...skipping 1342 matching lines...) Expand 10 before | Expand all | Expand 10 after
2677 } else if (node is TypeDeclarationBuilder) { 2677 } else if (node is TypeDeclarationBuilder) {
2678 return node.name; 2678 return node.name;
2679 } else if (node is PrefixBuilder) { 2679 } else if (node is PrefixBuilder) {
2680 return node.name; 2680 return node.name;
2681 } else if (node is ThisPropertyAccessor) { 2681 } else if (node is ThisPropertyAccessor) {
2682 return node.name.name; 2682 return node.name.name;
2683 } else { 2683 } else {
2684 return internalError("Unhandled: ${node.runtimeType}"); 2684 return internalError("Unhandled: ${node.runtimeType}");
2685 } 2685 }
2686 } 2686 }
OLDNEW
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/kernel/kernel_target.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698