OLD | NEW |
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.analyzer.ast_builder; | 5 library fasta.analyzer.ast_builder; |
6 | 6 |
7 import 'package:analyzer/analyzer.dart'; | 7 import 'package:analyzer/analyzer.dart'; |
8 import 'package:analyzer/dart/ast/ast_factory.dart' show AstFactory; | 8 import 'package:analyzer/dart/ast/ast_factory.dart' show AstFactory; |
9 import 'package:analyzer/dart/ast/standard_ast_factory.dart' as standard; | 9 import 'package:analyzer/dart/ast/standard_ast_factory.dart' as standard; |
10 import 'package:analyzer/dart/ast/token.dart' show Token, TokenType; | 10 import 'package:analyzer/dart/ast/token.dart' show Token, TokenType; |
(...skipping 1515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1526 logEvent("NamedFunctionExpression"); | 1526 logEvent("NamedFunctionExpression"); |
1527 } | 1527 } |
1528 | 1528 |
1529 @override | 1529 @override |
1530 void endLocalFunctionDeclaration(Token token) { | 1530 void endLocalFunctionDeclaration(Token token) { |
1531 debugEvent("LocalFunctionDeclaration"); | 1531 debugEvent("LocalFunctionDeclaration"); |
1532 FunctionBody body = pop(); | 1532 FunctionBody body = pop(); |
1533 pop(); // constructor initializers | 1533 pop(); // constructor initializers |
1534 pop(); // separator before constructor initializers | 1534 pop(); // separator before constructor initializers |
1535 FormalParameterList parameters = pop(); | 1535 FormalParameterList parameters = pop(); |
| 1536 SimpleIdentifier name = pop(); |
| 1537 TypeAnnotation returnType = pop(); |
| 1538 pop(); // modifiers |
1536 TypeParameterList typeParameters = pop(); | 1539 TypeParameterList typeParameters = pop(); |
1537 FunctionExpression functionExpression = | 1540 FunctionExpression functionExpression = |
1538 ast.functionExpression(typeParameters, parameters, body); | 1541 ast.functionExpression(typeParameters, parameters, body); |
1539 SimpleIdentifier name = pop(); | |
1540 TypeAnnotation returnType = pop(); | |
1541 pop(); // modifiers | |
1542 push(ast.functionDeclarationStatement(ast.functionDeclaration( | 1542 push(ast.functionDeclarationStatement(ast.functionDeclaration( |
1543 null, null, null, returnType, null, name, functionExpression))); | 1543 null, null, null, returnType, null, name, functionExpression))); |
1544 } | 1544 } |
1545 | 1545 |
1546 @override | 1546 @override |
1547 void endFunctionName(Token beginToken, Token token) { | 1547 void endFunctionName(Token beginToken, Token token) { |
1548 debugEvent("FunctionName"); | 1548 debugEvent("FunctionName"); |
1549 } | 1549 } |
1550 | 1550 |
1551 void endTopLevelFields(int count, Token beginToken, Token endToken) { | 1551 void endTopLevelFields(int count, Token beginToken, Token endToken) { |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1996 } else if (identical('var', s)) { | 1996 } else if (identical('var', s)) { |
1997 finalConstOrVarKeyword = token; | 1997 finalConstOrVarKeyword = token; |
1998 } else if (identical('covariant', s)) { | 1998 } else if (identical('covariant', s)) { |
1999 covariantKeyword = token; | 1999 covariantKeyword = token; |
2000 } else { | 2000 } else { |
2001 unhandled("$s", "modifier", token.charOffset, null); | 2001 unhandled("$s", "modifier", token.charOffset, null); |
2002 } | 2002 } |
2003 } | 2003 } |
2004 } | 2004 } |
2005 } | 2005 } |
OLD | NEW |