| 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 assert(element != null); | 193 assert(element != null); |
| 194 identifier.staticElement = element; | 194 identifier.staticElement = element; |
| 195 } | 195 } |
| 196 } else if (context == IdentifierContext.classDeclaration) { | 196 } else if (context == IdentifierContext.classDeclaration) { |
| 197 className = identifier.name; | 197 className = identifier.name; |
| 198 } | 198 } |
| 199 push(identifier); | 199 push(identifier); |
| 200 } | 200 } |
| 201 } | 201 } |
| 202 | 202 |
| 203 void endSend(Token token) { | 203 void endSend(Token beginToken, Token endToken) { |
| 204 debugEvent("Send"); | 204 debugEvent("Send"); |
| 205 MethodInvocation arguments = pop(); | 205 MethodInvocation arguments = pop(); |
| 206 TypeArgumentList typeArguments = pop(); | 206 TypeArgumentList typeArguments = pop(); |
| 207 if (arguments != null) { | 207 if (arguments != null) { |
| 208 doInvocation(token, typeArguments, arguments); | 208 doInvocation(endToken, typeArguments, arguments); |
| 209 } else { | 209 } else { |
| 210 doPropertyGet(token); | 210 doPropertyGet(endToken); |
| 211 } | 211 } |
| 212 } | 212 } |
| 213 | 213 |
| 214 void doInvocation( | 214 void doInvocation( |
| 215 Token token, TypeArgumentList typeArguments, MethodInvocation arguments) { | 215 Token token, TypeArgumentList typeArguments, MethodInvocation arguments) { |
| 216 Expression receiver = pop(); | 216 Expression receiver = pop(); |
| 217 if (receiver is SimpleIdentifier) { | 217 if (receiver is SimpleIdentifier) { |
| 218 arguments.methodName = receiver; | 218 arguments.methodName = receiver; |
| 219 if (typeArguments != null) { | 219 if (typeArguments != null) { |
| 220 arguments.typeArguments = typeArguments; | 220 arguments.typeArguments = typeArguments; |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 // TODO(ahe): Don't push initializers, instead install them. | 389 // TODO(ahe): Don't push initializers, instead install them. |
| 390 push(ast.variableDeclaration( | 390 push(ast.variableDeclaration( |
| 391 identifier, toAnalyzerToken(assignmentOperator), initializer)); | 391 identifier, toAnalyzerToken(assignmentOperator), initializer)); |
| 392 } | 392 } |
| 393 | 393 |
| 394 @override | 394 @override |
| 395 void handleNoVariableInitializer(Token token) { | 395 void handleNoVariableInitializer(Token token) { |
| 396 debugEvent("NoVariableInitializer"); | 396 debugEvent("NoVariableInitializer"); |
| 397 } | 397 } |
| 398 | 398 |
| 399 void endInitializedIdentifier() { | 399 void endInitializedIdentifier(Token nameToken) { |
| 400 debugEvent("InitializedIdentifier"); | 400 debugEvent("InitializedIdentifier"); |
| 401 AstNode node = pop(); | 401 AstNode node = pop(); |
| 402 VariableDeclaration variable; | 402 VariableDeclaration variable; |
| 403 // TODO(paulberry): This seems kludgy. It would be preferable if we | 403 // TODO(paulberry): This seems kludgy. It would be preferable if we |
| 404 // could respond to a "handleNoVariableInitializer" event by converting a | 404 // could respond to a "handleNoVariableInitializer" event by converting a |
| 405 // SimpleIdentifier into a VariableDeclaration, and then when this code was | 405 // SimpleIdentifier into a VariableDeclaration, and then when this code was |
| 406 // reached, node would always be a VariableDeclaration. | 406 // reached, node would always be a VariableDeclaration. |
| 407 if (node is VariableDeclaration) { | 407 if (node is VariableDeclaration) { |
| 408 variable = node; | 408 variable = node; |
| 409 } else if (node is SimpleIdentifier) { | 409 } else if (node is SimpleIdentifier) { |
| (...skipping 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1514 } else if (identical('static', s)) { | 1514 } else if (identical('static', s)) { |
| 1515 staticKeyword = token; | 1515 staticKeyword = token; |
| 1516 } else if (identical('var', s)) { | 1516 } else if (identical('var', s)) { |
| 1517 finalConstOrVarKeyword = token; | 1517 finalConstOrVarKeyword = token; |
| 1518 } else { | 1518 } else { |
| 1519 internalError('Unhandled modifier: $s'); | 1519 internalError('Unhandled modifier: $s'); |
| 1520 } | 1520 } |
| 1521 } | 1521 } |
| 1522 } | 1522 } |
| 1523 } | 1523 } |
| OLD | NEW |