| 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 '../core_types.dart'; | 9 import '../core_types.dart'; |
| 10 import '../elements/elements.dart'; | 10 import '../elements/elements.dart'; |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 // PropertyGet and SuperPropertyGet (and same for *Get). Talk to kernel | 140 // PropertyGet and SuperPropertyGet (and same for *Get). Talk to kernel |
| 141 // folks. | 141 // folks. |
| 142 if (node is ir.PropertyGet) { | 142 if (node is ir.PropertyGet) { |
| 143 return getGetterSelector((node as ir.PropertyGet).name); | 143 return getGetterSelector((node as ir.PropertyGet).name); |
| 144 } | 144 } |
| 145 if (node is ir.SuperPropertyGet) { | 145 if (node is ir.SuperPropertyGet) { |
| 146 return getGetterSelector((node as ir.SuperPropertyGet).name); | 146 return getGetterSelector((node as ir.SuperPropertyGet).name); |
| 147 } | 147 } |
| 148 if (node is ir.PropertySet) return getSetterSelector(node.name); | 148 if (node is ir.PropertySet) return getSetterSelector(node.name); |
| 149 if (node is ir.InvocationExpression) return getInvocationSelector(node); | 149 if (node is ir.InvocationExpression) return getInvocationSelector(node); |
| 150 throw new SpannableAssertionFailure(CURRENT_ELEMENT_SPANNABLE, | 150 throw new SpannableAssertionFailure( |
| 151 CURRENT_ELEMENT_SPANNABLE, |
| 151 "Can only get the selector for a property get or an invocation: " | 152 "Can only get the selector for a property get or an invocation: " |
| 152 "${node}"); | 153 "${node}"); |
| 153 } | 154 } |
| 154 | 155 |
| 155 Selector getInvocationSelector(ir.InvocationExpression invocation) { | 156 Selector getInvocationSelector(ir.InvocationExpression invocation) { |
| 156 Name name = getName(invocation.name); | 157 Name name = getName(invocation.name); |
| 157 SelectorKind kind; | 158 SelectorKind kind; |
| 158 if (Elements.isOperatorName(invocation.name.name)) { | 159 if (Elements.isOperatorName(invocation.name.name)) { |
| 159 if (name == Names.INDEX_NAME || name == Names.INDEX_SET_NAME) { | 160 if (name == Names.INDEX_NAME || name == Names.INDEX_SET_NAME) { |
| 160 kind = SelectorKind.INDEX; | 161 kind = SelectorKind.INDEX; |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 String visitStringConcatenation(ir.StringConcatenation node) { | 375 String visitStringConcatenation(ir.StringConcatenation node) { |
| 375 StringBuffer sb = new StringBuffer(); | 376 StringBuffer sb = new StringBuffer(); |
| 376 for (ir.Expression expression in node.expressions) { | 377 for (ir.Expression expression in node.expressions) { |
| 377 String value = expression.accept(this); | 378 String value = expression.accept(this); |
| 378 if (value == null) return null; | 379 if (value == null) return null; |
| 379 sb.write(value); | 380 sb.write(value); |
| 380 } | 381 } |
| 381 return sb.toString(); | 382 return sb.toString(); |
| 382 } | 383 } |
| 383 } | 384 } |
| OLD | NEW |