| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 backend_ast_emitter; | 5 library backend_ast_emitter; |
| 6 | 6 |
| 7 import '../tree_ir/tree_ir_nodes.dart' as tree; | 7 import '../tree_ir/tree_ir_nodes.dart' as tree; |
| 8 import 'backend_ast_nodes.dart'; | 8 import 'backend_ast_nodes.dart'; |
| 9 import '../constants/expressions.dart'; | 9 import '../constants/expressions.dart'; |
| 10 import '../constants/values.dart'; | 10 import '../constants/values.dart'; |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 bool isSameVariable(Receiver e1, Receiver e2) { | 427 bool isSameVariable(Receiver e1, Receiver e2) { |
| 428 return e1 is Identifier && | 428 return e1 is Identifier && |
| 429 e2 is Identifier && | 429 e2 is Identifier && |
| 430 e1.element is VariableElement && | 430 e1.element is VariableElement && |
| 431 e1.element == e2.element; | 431 e1.element == e2.element; |
| 432 } | 432 } |
| 433 | 433 |
| 434 Expression makeAssignment(Expression target, Expression value) { | 434 Expression makeAssignment(Expression target, Expression value) { |
| 435 // Try to print as compound assignment or increment | 435 // Try to print as compound assignment or increment |
| 436 if (value is BinaryOperator && isCompoundableOperator(value.operator)) { | 436 if (value is BinaryOperator && isCompoundableOperator(value.operator)) { |
| 437 Expression leftOperand = value.left; | 437 Receiver leftOperand = value.left; |
| 438 Expression rightOperand = value.right; | 438 Expression rightOperand = value.right; |
| 439 bool valid = false; | 439 bool valid = false; |
| 440 if (isSameVariable(target, leftOperand)) { | 440 if (isSameVariable(target, leftOperand)) { |
| 441 valid = true; | 441 valid = true; |
| 442 } else if (target is FieldExpression && | 442 } else if (target is FieldExpression && |
| 443 leftOperand is FieldExpression && | 443 leftOperand is FieldExpression && |
| 444 isSameVariable(target.object, leftOperand.object) && | 444 isSameVariable(target.object, leftOperand.object) && |
| 445 target.fieldName == leftOperand.fieldName) { | 445 target.fieldName == leftOperand.fieldName) { |
| 446 valid = true; | 446 valid = true; |
| 447 } else if (target is IndexExpression && | 447 } else if (target is IndexExpression && |
| (...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1258 : super(name, ElementKind.VARIABLE, enclosingElement, variables, null); | 1258 : super(name, ElementKind.VARIABLE, enclosingElement, variables, null); |
| 1259 | 1259 |
| 1260 ExecutableElement get executableContext => enclosingElement; | 1260 ExecutableElement get executableContext => enclosingElement; |
| 1261 | 1261 |
| 1262 ExecutableElement get memberContext => executableContext.memberContext; | 1262 ExecutableElement get memberContext => executableContext.memberContext; |
| 1263 | 1263 |
| 1264 bool get isLocal => true; | 1264 bool get isLocal => true; |
| 1265 | 1265 |
| 1266 LibraryElement get implementationLibrary => enclosingElement.library; | 1266 LibraryElement get implementationLibrary => enclosingElement.library; |
| 1267 } | 1267 } |
| OLD | NEW |