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

Side by Side Diff: pkg/analyzer/lib/src/fasta/ast_builder.dart

Issue 2769133004: Parse YieldStatement with Fasta. (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/analyzer/test/generated/parser_fasta_test.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.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 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 exitBreakTarget(); 432 exitBreakTarget();
433 push(ast.whileStatement( 433 push(ast.whileStatement(
434 toAnalyzerToken(whileKeyword), 434 toAnalyzerToken(whileKeyword),
435 condition.leftParenthesis, 435 condition.leftParenthesis,
436 condition.expression, 436 condition.expression,
437 condition.rightParenthesis, 437 condition.rightParenthesis,
438 body)); 438 body));
439 } 439 }
440 440
441 @override 441 @override
442 void endYieldStatement(Token yieldToken, Token starToken, Token endToken) {
443 debugEvent("YieldStatement");
444 assert(endToken.lexeme == ';');
445 Expression expression = pop();
446 push(ast.yieldStatement(toAnalyzerToken(yieldToken),
447 toAnalyzerToken(starToken), expression, toAnalyzerToken(endToken)));
448 }
449
450 @override
442 void handleNoVariableInitializer(Token token) { 451 void handleNoVariableInitializer(Token token) {
443 debugEvent("NoVariableInitializer"); 452 debugEvent("NoVariableInitializer");
444 } 453 }
445 454
446 void endInitializedIdentifier(Token nameToken) { 455 void endInitializedIdentifier(Token nameToken) {
447 debugEvent("InitializedIdentifier"); 456 debugEvent("InitializedIdentifier");
448 AstNode node = pop(); 457 AstNode node = pop();
449 VariableDeclaration variable; 458 VariableDeclaration variable;
450 // TODO(paulberry): This seems kludgy. It would be preferable if we 459 // TODO(paulberry): This seems kludgy. It would be preferable if we
451 // could respond to a "handleNoVariableInitializer" event by converting a 460 // could respond to a "handleNoVariableInitializer" event by converting a
(...skipping 1390 matching lines...) Expand 10 before | Expand all | Expand 10 after
1842 } else if (identical('static', s)) { 1851 } else if (identical('static', s)) {
1843 staticKeyword = token; 1852 staticKeyword = token;
1844 } else if (identical('var', s)) { 1853 } else if (identical('var', s)) {
1845 finalConstOrVarKeyword = token; 1854 finalConstOrVarKeyword = token;
1846 } else { 1855 } else {
1847 internalError('Unhandled modifier: $s'); 1856 internalError('Unhandled modifier: $s');
1848 } 1857 }
1849 } 1858 }
1850 } 1859 }
1851 } 1860 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/parser_fasta_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698