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

Side by Side Diff: pkg/compiler/lib/src/parser/node_listener.dart

Issue 2985673002: Parse type variables of local functions before return type. (Closed)
Patch Set: Created 3 years, 5 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
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 dart2js.parser.node_listener; 5 library dart2js.parser.node_listener;
6 6
7 import 'package:front_end/src/fasta/parser.dart' 7 import 'package:front_end/src/fasta/parser.dart'
8 show FormalParameterKind, IdentifierContext, MemberKind; 8 show FormalParameterKind, IdentifierContext, MemberKind;
9 import 'package:front_end/src/fasta/scanner.dart' show Token; 9 import 'package:front_end/src/fasta/scanner.dart' show Token;
10 import 'package:front_end/src/scanner/token.dart' show TokenType; 10 import 'package:front_end/src/scanner/token.dart' show TokenType;
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 pushNode(new FunctionExpression(name, typeVariables, formals, body, type, 504 pushNode(new FunctionExpression(name, typeVariables, formals, body, type,
505 modifiers, initializers, null, asyncModifier)); 505 modifiers, initializers, null, asyncModifier));
506 } 506 }
507 507
508 @override 508 @override
509 void endLocalFunctionDeclaration(Token endToken) { 509 void endLocalFunctionDeclaration(Token endToken) {
510 Statement body = popNode(); 510 Statement body = popNode();
511 AsyncModifier asyncModifier = popNode(); 511 AsyncModifier asyncModifier = popNode();
512 NodeList initializers = popNode(); 512 NodeList initializers = popNode();
513 NodeList formals = popNode(); 513 NodeList formals = popNode();
514 NodeList typeVariables = popNode();
515 // The name can be an identifier or a send in case of named constructors. 514 // The name can be an identifier or a send in case of named constructors.
516 Expression name = popNode(); 515 Expression name = popNode();
517 TypeAnnotation type = popNode(); 516 TypeAnnotation type = popNode();
518 Modifiers modifiers = popNode(); 517 Modifiers modifiers = popNode();
518 NodeList typeVariables = popNode();
519 pushNode(new FunctionDeclaration(new FunctionExpression(name, typeVariables, 519 pushNode(new FunctionDeclaration(new FunctionExpression(name, typeVariables,
520 formals, body, type, modifiers, initializers, null, asyncModifier))); 520 formals, body, type, modifiers, initializers, null, asyncModifier)));
521 } 521 }
522 522
523 @override 523 @override
524 void endVariablesDeclaration(int count, Token endToken) { 524 void endVariablesDeclaration(int count, Token endToken) {
525 // TODO(ahe): Pick one name for this concept, either 525 // TODO(ahe): Pick one name for this concept, either
526 // VariablesDeclaration or VariableDefinitions. 526 // VariablesDeclaration or VariableDefinitions.
527 NodeList variables = makeNodeList(count, null, endToken, ","); 527 NodeList variables = makeNodeList(count, null, endToken, ",");
528 TypeAnnotation type = popNode(); 528 TypeAnnotation type = popNode();
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
1066 } 1066 }
1067 lastErrorWasNativeFunctionBody = false; 1067 lastErrorWasNativeFunctionBody = false;
1068 } 1068 }
1069 1069
1070 void internalError({Token token, Node node}) { 1070 void internalError({Token token, Node node}) {
1071 // TODO(ahe): This should call reporter.internalError. 1071 // TODO(ahe): This should call reporter.internalError.
1072 Spannable spannable = (token == null) ? node : token; 1072 Spannable spannable = (token == null) ? node : token;
1073 failedAt(spannable, 'Internal error in parser.'); 1073 failedAt(spannable, 'Internal error in parser.');
1074 } 1074 }
1075 } 1075 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698