| 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 int argumentCount = arguments.positional.length + arguments.named.length; | 132 int argumentCount = arguments.positional.length + arguments.named.length; |
| 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( |
| 143 CURRENT_ELEMENT_SPANNABLE, |
| 143 "Can only get the selector for a property get or an invocation: " | 144 "Can only get the selector for a property get or an invocation: " |
| 144 "${node}"); | 145 "${node}"); |
| 145 } | 146 } |
| 146 | 147 |
| 147 Selector getInvocationSelector(ir.InvocationExpression invocation) { | 148 Selector getInvocationSelector(ir.InvocationExpression invocation) { |
| 148 Name name = getName(invocation.name); | 149 Name name = getName(invocation.name); |
| 149 SelectorKind kind; | 150 SelectorKind kind; |
| 150 if (Elements.isOperatorName(invocation.name.name)) { | 151 if (Elements.isOperatorName(invocation.name.name)) { |
| 151 if (name == Names.INDEX_NAME || name == Names.INDEX_SET_NAME) { | 152 if (name == Names.INDEX_NAME || name == Names.INDEX_SET_NAME) { |
| 152 kind = SelectorKind.INDEX; | 153 kind = SelectorKind.INDEX; |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 String visitStringConcatenation(ir.StringConcatenation node) { | 369 String visitStringConcatenation(ir.StringConcatenation node) { |
| 369 StringBuffer sb = new StringBuffer(); | 370 StringBuffer sb = new StringBuffer(); |
| 370 for (ir.Expression expression in node.expressions) { | 371 for (ir.Expression expression in node.expressions) { |
| 371 String value = expression.accept(this); | 372 String value = expression.accept(this); |
| 372 if (value == null) return null; | 373 if (value == null) return null; |
| 373 sb.write(value); | 374 sb.write(value); |
| 374 } | 375 } |
| 375 return sb.toString(); | 376 return sb.toString(); |
| 376 } | 377 } |
| 377 } | 378 } |
| OLD | NEW |