| 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 List<String> namedArguments = arguments.named.map((e) => e.name).toList(); | 133 List<String> namedArguments = arguments.named.map((e) => e.name).toList(); |
| 134 return new CallStructure(argumentCount, namedArguments); | 134 return new CallStructure(argumentCount, namedArguments); |
| 135 } | 135 } |
| 136 | 136 |
| 137 @override | 137 @override |
| 138 Selector getSelector(ir.Expression node) { | 138 Selector getSelector(ir.Expression node) { |
| 139 if (node is ir.PropertyGet) return getGetterSelector(node); | 139 if (node is ir.PropertyGet) return getGetterSelector(node); |
| 140 if (node is ir.PropertySet) return getSetterSelector(node); | 140 if (node is ir.PropertySet) return getSetterSelector(node); |
| 141 if (node is ir.InvocationExpression) return getInvocationSelector(node); | 141 if (node is ir.InvocationExpression) return getInvocationSelector(node); |
| 142 throw new SpannableAssertionFailure(CURRENT_ELEMENT_SPANNABLE, | 142 throw new SpannableAssertionFailure(CURRENT_ELEMENT_SPANNABLE, |
| 143 "Can only get the selector for a property get or an invocation: ${node}"
); | 143 "Can only get the selector for a property get or an invocation: " |
| 144 "${node}"); |
| 144 } | 145 } |
| 145 | 146 |
| 146 Selector getInvocationSelector(ir.InvocationExpression invocation) { | 147 Selector getInvocationSelector(ir.InvocationExpression invocation) { |
| 147 Name name = getName(invocation.name); | 148 Name name = getName(invocation.name); |
| 148 SelectorKind kind; | 149 SelectorKind kind; |
| 149 if (Elements.isOperatorName(invocation.name.name)) { | 150 if (Elements.isOperatorName(invocation.name.name)) { |
| 150 if (name == Names.INDEX_NAME || name == Names.INDEX_SET_NAME) { | 151 if (name == Names.INDEX_NAME || name == Names.INDEX_SET_NAME) { |
| 151 kind = SelectorKind.INDEX; | 152 kind = SelectorKind.INDEX; |
| 152 } else { | 153 } else { |
| 153 kind = SelectorKind.OPERATOR; | 154 kind = SelectorKind.OPERATOR; |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 String visitStringConcatenation(ir.StringConcatenation node) { | 368 String visitStringConcatenation(ir.StringConcatenation node) { |
| 368 StringBuffer sb = new StringBuffer(); | 369 StringBuffer sb = new StringBuffer(); |
| 369 for (ir.Expression expression in node.expressions) { | 370 for (ir.Expression expression in node.expressions) { |
| 370 String value = expression.accept(this); | 371 String value = expression.accept(this); |
| 371 if (value == null) return null; | 372 if (value == null) return null; |
| 372 sb.write(value); | 373 sb.write(value); |
| 373 } | 374 } |
| 374 return sb.toString(); | 375 return sb.toString(); |
| 375 } | 376 } |
| 376 } | 377 } |
| OLD | NEW |