| 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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 Expression right = pop(); | 247 Expression right = pop(); |
| 248 Expression left = pop(); | 248 Expression left = pop(); |
| 249 push(ast.binaryExpression(left, toAnalyzerToken(token), right)); | 249 push(ast.binaryExpression(left, toAnalyzerToken(token), right)); |
| 250 } | 250 } |
| 251 } | 251 } |
| 252 | 252 |
| 253 void doDotExpression(Token token) { | 253 void doDotExpression(Token token) { |
| 254 Expression identifierOrInvoke = pop(); | 254 Expression identifierOrInvoke = pop(); |
| 255 Expression receiver = pop(); | 255 Expression receiver = pop(); |
| 256 if (identifierOrInvoke is SimpleIdentifier) { | 256 if (identifierOrInvoke is SimpleIdentifier) { |
| 257 push(ast.propertyAccess( | 257 if (receiver is SimpleIdentifier && identical('.', token.stringValue)) { |
| 258 receiver, toAnalyzerToken(token), identifierOrInvoke)); | 258 push(ast.prefixedIdentifier( |
| 259 receiver, toAnalyzerToken(token), identifierOrInvoke)); |
| 260 } else { |
| 261 push(ast.propertyAccess( |
| 262 receiver, toAnalyzerToken(token), identifierOrInvoke)); |
| 263 } |
| 259 } else if (identifierOrInvoke is MethodInvocation) { | 264 } else if (identifierOrInvoke is MethodInvocation) { |
| 260 assert(identifierOrInvoke.target == null); | 265 assert(identifierOrInvoke.target == null); |
| 261 identifierOrInvoke | 266 identifierOrInvoke |
| 262 ..target = receiver | 267 ..target = receiver |
| 263 ..operator = toAnalyzerToken(token); | 268 ..operator = toAnalyzerToken(token); |
| 264 push(identifierOrInvoke); | 269 push(identifierOrInvoke); |
| 265 } else { | 270 } else { |
| 266 internalError( | 271 internalError( |
| 267 "Unhandled property access: ${identifierOrInvoke.runtimeType}"); | 272 "Unhandled property access: ${identifierOrInvoke.runtimeType}"); |
| 268 } | 273 } |
| (...skipping 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1401 } | 1406 } |
| 1402 | 1407 |
| 1403 /// Data structure placed on the stack to represent the keyword "operator" | 1408 /// Data structure placed on the stack to represent the keyword "operator" |
| 1404 /// followed by a token. | 1409 /// followed by a token. |
| 1405 class _OperatorName { | 1410 class _OperatorName { |
| 1406 final Token operatorKeyword; | 1411 final Token operatorKeyword; |
| 1407 final SimpleIdentifier name; | 1412 final SimpleIdentifier name; |
| 1408 | 1413 |
| 1409 _OperatorName(this.operatorKeyword, this.name); | 1414 _OperatorName(this.operatorKeyword, this.name); |
| 1410 } | 1415 } |
| OLD | NEW |