| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 import 'package:kernel/ast.dart' as ir; | 5 import 'package:kernel/ast.dart' as ir; |
| 6 | 6 |
| 7 import '../common.dart'; | 7 import '../common.dart'; |
| 8 import '../common/names.dart'; | 8 import '../common/names.dart'; |
| 9 import '../constants/expressions.dart'; | 9 import '../constants/expressions.dart'; |
| 10 import '../core_types.dart'; | 10 import '../core_types.dart'; |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 Selector getSelector(ir.Expression node) { | 140 Selector getSelector(ir.Expression node) { |
| 141 // TODO(efortuna): This is screaming for a common interface between | 141 // TODO(efortuna): This is screaming for a common interface between |
| 142 // PropertyGet and SuperPropertyGet (and same for *Get). Talk to kernel | 142 // PropertyGet and SuperPropertyGet (and same for *Get). Talk to kernel |
| 143 // folks. | 143 // folks. |
| 144 if (node is ir.PropertyGet) { | 144 if (node is ir.PropertyGet) { |
| 145 return getGetterSelector((node as ir.PropertyGet).name); | 145 return getGetterSelector((node as ir.PropertyGet).name); |
| 146 } | 146 } |
| 147 if (node is ir.SuperPropertyGet) { | 147 if (node is ir.SuperPropertyGet) { |
| 148 return getGetterSelector((node as ir.SuperPropertyGet).name); | 148 return getGetterSelector((node as ir.SuperPropertyGet).name); |
| 149 } | 149 } |
| 150 if (node is ir.PropertySet) return getSetterSelector(node.name); | 150 if (node is ir.PropertySet) { |
| 151 return getSetterSelector((node as ir.PropertySet).name); |
| 152 } |
| 153 if (node is ir.SuperPropertySet) { |
| 154 return getSetterSelector((node as ir.SuperPropertySet).name); |
| 155 } |
| 151 if (node is ir.InvocationExpression) return getInvocationSelector(node); | 156 if (node is ir.InvocationExpression) return getInvocationSelector(node); |
| 152 throw new SpannableAssertionFailure( | 157 throw new SpannableAssertionFailure( |
| 153 CURRENT_ELEMENT_SPANNABLE, | 158 CURRENT_ELEMENT_SPANNABLE, |
| 154 "Can only get the selector for a property get or an invocation: " | 159 "Can only get the selector for a property get or an invocation: " |
| 155 "${node}"); | 160 "${node}"); |
| 156 } | 161 } |
| 157 | 162 |
| 158 Selector getInvocationSelector(ir.InvocationExpression invocation) { | 163 Selector getInvocationSelector(ir.InvocationExpression invocation) { |
| 159 Name name = getName(invocation.name); | 164 Name name = getName(invocation.name); |
| 160 SelectorKind kind; | 165 SelectorKind kind; |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 @override | 439 @override |
| 435 ConstantExpression visitStaticGet(ir.StaticGet node) { | 440 ConstantExpression visitStaticGet(ir.StaticGet node) { |
| 436 return new FieldConstantExpression(elementAdapter.getField(node.target)); | 441 return new FieldConstantExpression(elementAdapter.getField(node.target)); |
| 437 } | 442 } |
| 438 | 443 |
| 439 @override | 444 @override |
| 440 ConstantExpression visitStringLiteral(ir.StringLiteral node) { | 445 ConstantExpression visitStringLiteral(ir.StringLiteral node) { |
| 441 return new StringConstantExpression(node.value); | 446 return new StringConstantExpression(node.value); |
| 442 } | 447 } |
| 443 } | 448 } |
| OLD | NEW |