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 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Loading... |
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 } |
OLD | NEW |