OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 library universe; | 5 library universe; |
6 | 6 |
7 import '../closure.dart'; | 7 import '../closure.dart'; |
8 import '../elements/elements.dart'; | 8 import '../elements/elements.dart'; |
9 import '../dart2jslib.dart'; | 9 import '../dart2jslib.dart'; |
10 import '../tree/tree.dart'; | 10 import '../tree/tree.dart'; |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 int get namedArgumentCount => namedArguments.length; | 216 int get namedArgumentCount => namedArguments.length; |
217 int get positionalArgumentCount => argumentCount - namedArgumentCount; | 217 int get positionalArgumentCount => argumentCount - namedArgumentCount; |
218 DartType get receiverType => null; | 218 DartType get receiverType => null; |
219 | 219 |
220 /** | 220 /** |
221 * The member name for invocation mirrors created from this selector. | 221 * The member name for invocation mirrors created from this selector. |
222 */ | 222 */ |
223 String get invocationMirrorMemberName => | 223 String get invocationMirrorMemberName => |
224 isSetter() ? '${name.slowToString()}=' : name.slowToString(); | 224 isSetter() ? '${name.slowToString()}=' : name.slowToString(); |
225 | 225 |
| 226 int get invocationMirrorKind { |
| 227 const int METHOD = 0; |
| 228 const int GETTER = 1; |
| 229 const int SETTER = 2; |
| 230 int kind = METHOD; |
| 231 if (isGetter()) { |
| 232 kind = GETTER; |
| 233 } else if (isSetter()) { |
| 234 kind = SETTER; |
| 235 } |
| 236 return kind; |
| 237 } |
| 238 |
226 bool applies(Element element, Compiler compiler) | 239 bool applies(Element element, Compiler compiler) |
227 => appliesUntyped(element, compiler); | 240 => appliesUntyped(element, compiler); |
228 | 241 |
229 bool appliesUntyped(Element element, Compiler compiler) { | 242 bool appliesUntyped(Element element, Compiler compiler) { |
230 if (Elements.isUnresolved(element)) return false; | 243 if (Elements.isUnresolved(element)) return false; |
231 if (element.isForeign(compiler)) return true; | 244 if (element.isForeign(compiler)) return true; |
232 | 245 |
233 if (element.isSetter()) return isSetter(); | 246 if (element.isSetter()) return isSetter(); |
234 if (element.isGetter()) return isGetter() || isCall(); | 247 if (element.isGetter()) return isGetter() || isCall(); |
235 if (element.isField()) return isGetter() || isSetter() || isCall(); | 248 if (element.isField()) return isGetter() || isSetter() || isCall(); |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 ClassElement cls = self; | 461 ClassElement cls = self; |
449 if (cls.isSubclassOf(other)) { | 462 if (cls.isSubclassOf(other)) { |
450 // Resolve an invocation of [element.name] on [self]. If it | 463 // Resolve an invocation of [element.name] on [self]. If it |
451 // is found, this selector is a candidate. | 464 // is found, this selector is a candidate. |
452 return hasElementIn(self, element) && appliesUntyped(element, compiler); | 465 return hasElementIn(self, element) && appliesUntyped(element, compiler); |
453 } | 466 } |
454 | 467 |
455 return false; | 468 return false; |
456 } | 469 } |
457 } | 470 } |
OLD | NEW |