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 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 } | 523 } |
524 push(variable); | 524 push(variable); |
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 pop(); // TODO(paulberry): Modifiers. | 533 _Modifiers modifiers = pop(); |
| 534 Token keyword = modifiers?.finalConstOrVarKeyword; |
534 push(ast.variableDeclarationStatement( | 535 push(ast.variableDeclarationStatement( |
535 ast.variableDeclarationList(null, null, null, type, variables), | 536 ast.variableDeclarationList( |
| 537 null, null, toAnalyzerToken(keyword), type, variables), |
536 toAnalyzerToken(endToken))); | 538 toAnalyzerToken(endToken))); |
537 } | 539 } |
538 | 540 |
539 void handleAssignmentExpression(Token token) { | 541 void handleAssignmentExpression(Token token) { |
540 debugEvent("AssignmentExpression"); | 542 debugEvent("AssignmentExpression"); |
541 Expression rhs = pop(); | 543 Expression rhs = pop(); |
542 Expression lhs = pop(); | 544 Expression lhs = pop(); |
543 push(ast.assignmentExpression(lhs, toAnalyzerToken(token), rhs)); | 545 push(ast.assignmentExpression(lhs, toAnalyzerToken(token), rhs)); |
544 } | 546 } |
545 | 547 |
(...skipping 1401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1947 } else if (identical('static', s)) { | 1949 } else if (identical('static', s)) { |
1948 staticKeyword = token; | 1950 staticKeyword = token; |
1949 } else if (identical('var', s)) { | 1951 } else if (identical('var', s)) { |
1950 finalConstOrVarKeyword = token; | 1952 finalConstOrVarKeyword = token; |
1951 } else { | 1953 } else { |
1952 internalError('Unhandled modifier: $s'); | 1954 internalError('Unhandled modifier: $s'); |
1953 } | 1955 } |
1954 } | 1956 } |
1955 } | 1957 } |
1956 } | 1958 } |
OLD | NEW |