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/constructors.dart'; | 9 import '../constants/constructors.dart'; |
10 import '../constants/expressions.dart'; | 10 import '../constants/expressions.dart'; |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 } | 163 } |
164 throw new SpannableAssertionFailure( | 164 throw new SpannableAssertionFailure( |
165 CURRENT_ELEMENT_SPANNABLE, | 165 CURRENT_ELEMENT_SPANNABLE, |
166 "Can only get the selector for a property get or an invocation: " | 166 "Can only get the selector for a property get or an invocation: " |
167 "${node}"); | 167 "${node}"); |
168 } | 168 } |
169 | 169 |
170 Selector getInvocationSelector(ir.InvocationExpression invocation) { | 170 Selector getInvocationSelector(ir.InvocationExpression invocation) { |
171 Name name = getName(invocation.name); | 171 Name name = getName(invocation.name); |
172 SelectorKind kind; | 172 SelectorKind kind; |
173 if (Elements.isOperatorName(invocation.name.name)) { | 173 if (Selector.isOperatorName(name.text)) { |
174 if (name == Names.INDEX_NAME || name == Names.INDEX_SET_NAME) { | 174 if (name == Names.INDEX_NAME || name == Names.INDEX_SET_NAME) { |
175 kind = SelectorKind.INDEX; | 175 kind = SelectorKind.INDEX; |
176 } else { | 176 } else { |
177 kind = SelectorKind.OPERATOR; | 177 kind = SelectorKind.OPERATOR; |
178 } | 178 } |
179 } else { | 179 } else { |
180 kind = SelectorKind.CALL; | 180 kind = SelectorKind.CALL; |
181 } | 181 } |
182 | |
183 CallStructure callStructure = getCallStructure(invocation.arguments); | 182 CallStructure callStructure = getCallStructure(invocation.arguments); |
184 return new Selector(kind, name, callStructure); | 183 return new Selector(kind, name, callStructure); |
185 } | 184 } |
186 | 185 |
187 Selector getGetterSelector(ir.Name irName) { | 186 Selector getGetterSelector(ir.Name irName) { |
188 Name name = new Name( | 187 Name name = new Name( |
189 irName.name, irName.isPrivate ? getLibrary(irName.library) : null); | 188 irName.name, irName.isPrivate ? getLibrary(irName.library) : null); |
190 return new Selector.getter(name); | 189 return new Selector.getter(name); |
191 } | 190 } |
192 | 191 |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 } | 614 } |
616 if (isRedirecting) { | 615 if (isRedirecting) { |
617 return new RedirectingGenerativeConstantConstructor( | 616 return new RedirectingGenerativeConstantConstructor( |
618 defaultValues, superConstructorInvocation); | 617 defaultValues, superConstructorInvocation); |
619 } else { | 618 } else { |
620 return new GenerativeConstantConstructor( | 619 return new GenerativeConstantConstructor( |
621 type, defaultValues, fieldMap, superConstructorInvocation); | 620 type, defaultValues, fieldMap, superConstructorInvocation); |
622 } | 621 } |
623 } | 622 } |
624 } | 623 } |
OLD | NEW |