| 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' as analyzer show Token; | 10 import 'package:analyzer/dart/ast/token.dart' as analyzer show Token; |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 | 236 |
| 237 @override | 237 @override |
| 238 void handleEmptyFunctionBody(Token semicolon) { | 238 void handleEmptyFunctionBody(Token semicolon) { |
| 239 debugEvent("EmptyFunctionBody"); | 239 debugEvent("EmptyFunctionBody"); |
| 240 // TODO(scheglov) Change the parser to not produce these modifiers. | 240 // TODO(scheglov) Change the parser to not produce these modifiers. |
| 241 pop(); // star | 241 pop(); // star |
| 242 pop(); // async | 242 pop(); // async |
| 243 push(ast.emptyFunctionBody(toAnalyzerToken(semicolon))); | 243 push(ast.emptyFunctionBody(toAnalyzerToken(semicolon))); |
| 244 } | 244 } |
| 245 | 245 |
| 246 @override |
| 247 void handleEmptyStatement(Token token) { |
| 248 debugEvent("EmptyStatement"); |
| 249 push(ast.emptyStatement(toAnalyzerToken(token))); |
| 250 } |
| 251 |
| 246 void endBlockFunctionBody(int count, Token beginToken, Token endToken) { | 252 void endBlockFunctionBody(int count, Token beginToken, Token endToken) { |
| 247 debugEvent("BlockFunctionBody"); | 253 debugEvent("BlockFunctionBody"); |
| 248 List statements = popList(count); | 254 List statements = popList(count); |
| 249 if (beginToken != null) { | 255 if (beginToken != null) { |
| 250 exitLocalScope(); | 256 exitLocalScope(); |
| 251 } | 257 } |
| 252 Block block = ast.block( | 258 Block block = ast.block( |
| 253 toAnalyzerToken(beginToken), statements, toAnalyzerToken(endToken)); | 259 toAnalyzerToken(beginToken), statements, toAnalyzerToken(endToken)); |
| 254 analyzer.Token star = pop(); | 260 analyzer.Token star = pop(); |
| 255 analyzer.Token asyncKeyword = pop(); | 261 analyzer.Token asyncKeyword = pop(); |
| (...skipping 1348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1604 } else if (identical('static', s)) { | 1610 } else if (identical('static', s)) { |
| 1605 staticKeyword = token; | 1611 staticKeyword = token; |
| 1606 } else if (identical('var', s)) { | 1612 } else if (identical('var', s)) { |
| 1607 finalConstOrVarKeyword = token; | 1613 finalConstOrVarKeyword = token; |
| 1608 } else { | 1614 } else { |
| 1609 internalError('Unhandled modifier: $s'); | 1615 internalError('Unhandled modifier: $s'); |
| 1610 } | 1616 } |
| 1611 } | 1617 } |
| 1612 } | 1618 } |
| 1613 } | 1619 } |
| OLD | NEW |