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

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

Issue 2797303003: Fix for parsing annotations before variables in for-loop with Fasta. (Closed)
Patch Set: Created 3 years, 8 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 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 scope[variable.name.name] = variable.name.staticElement = 525 scope[variable.name.name] = variable.name.staticElement =
526 new AnalyzerLocalVariableElemment(variable); 526 new AnalyzerLocalVariableElemment(variable);
527 } 527 }
528 528
529 void endVariablesDeclaration(int count, Token endToken) { 529 void endVariablesDeclaration(int count, Token endToken) {
530 debugEvent("VariablesDeclaration"); 530 debugEvent("VariablesDeclaration");
531 List<VariableDeclaration> variables = popList(count); 531 List<VariableDeclaration> variables = popList(count);
532 TypeAnnotation type = pop(); 532 TypeAnnotation type = pop();
533 _Modifiers modifiers = pop(); 533 _Modifiers modifiers = pop();
534 Token keyword = modifiers?.finalConstOrVarKeyword; 534 Token keyword = modifiers?.finalConstOrVarKeyword;
535 pop(); // Metadata. 535 List<Annotation> metadata = pop();
536 pop(); // Comment. 536 Comment comment = pop();
537 push(ast.variableDeclarationStatement( 537 push(ast.variableDeclarationStatement(
538 ast.variableDeclarationList( 538 ast.variableDeclarationList(
539 null, null, toAnalyzerToken(keyword), type, variables), 539 comment, metadata, toAnalyzerToken(keyword), type, variables),
540 toAnalyzerToken(endToken))); 540 toAnalyzerToken(endToken)));
541 } 541 }
542 542
543 void handleAssignmentExpression(Token token) { 543 void handleAssignmentExpression(Token token) {
544 debugEvent("AssignmentExpression"); 544 debugEvent("AssignmentExpression");
545 Expression rhs = pop(); 545 Expression rhs = pop();
546 Expression lhs = pop(); 546 Expression lhs = pop();
547 push(ast.assignmentExpression(lhs, toAnalyzerToken(token), rhs)); 547 push(ast.assignmentExpression(lhs, toAnalyzerToken(token), rhs));
548 } 548 }
549 549
(...skipping 1406 matching lines...) Expand 10 before | Expand all | Expand 10 after
1956 } else if (identical('static', s)) { 1956 } else if (identical('static', s)) {
1957 staticKeyword = token; 1957 staticKeyword = token;
1958 } else if (identical('var', s)) { 1958 } else if (identical('var', s)) {
1959 finalConstOrVarKeyword = token; 1959 finalConstOrVarKeyword = token;
1960 } else { 1960 } else {
1961 internalError('Unhandled modifier: $s'); 1961 internalError('Unhandled modifier: $s');
1962 } 1962 }
1963 } 1963 }
1964 } 1964 }
1965 } 1965 }
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