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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 bool isBinaryOperator() => isOperator() && argumentCount == 1; | 210 bool isBinaryOperator() => isOperator() && argumentCount == 1; |
211 | 211 |
212 /** Check whether this is a call to 'assert'. */ | 212 /** Check whether this is a call to 'assert'. */ |
213 bool isAssert() => isCall() && identical(name.stringValue, "assert"); | 213 bool isAssert() => isCall() && identical(name.stringValue, "assert"); |
214 | 214 |
215 int get hashCode => argumentCount + 1000 * namedArguments.length; | 215 int get hashCode => argumentCount + 1000 * namedArguments.length; |
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 /** |
| 221 * The member name for invocation mirrors created from this selector. |
| 222 */ |
| 223 String get invocationMirrorMemberName => |
| 224 isSetter() ? '${name.slowToString()}=' : name.slowToString(); |
| 225 |
220 bool applies(Element element, Compiler compiler) | 226 bool applies(Element element, Compiler compiler) |
221 => appliesUntyped(element, compiler); | 227 => appliesUntyped(element, compiler); |
222 | 228 |
223 bool appliesUntyped(Element element, Compiler compiler) { | 229 bool appliesUntyped(Element element, Compiler compiler) { |
224 if (Elements.isUnresolved(element)) return false; | 230 if (Elements.isUnresolved(element)) return false; |
225 if (element.isForeign()) return true; | 231 if (element.isForeign()) return true; |
226 | 232 |
227 if (element.isSetter()) return isSetter(); | 233 if (element.isSetter()) return isSetter(); |
228 if (element.isGetter()) return isGetter() || isCall(); | 234 if (element.isGetter()) return isGetter() || isCall(); |
229 if (element.isField()) return isGetter() || isSetter() || isCall(); | 235 if (element.isField()) return isGetter() || isSetter() || isCall(); |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 ClassElement cls = self; | 448 ClassElement cls = self; |
443 if (cls.isSubclassOf(other)) { | 449 if (cls.isSubclassOf(other)) { |
444 // Resolve an invocation of [element.name] on [self]. If it | 450 // Resolve an invocation of [element.name] on [self]. If it |
445 // is found, this selector is a candidate. | 451 // is found, this selector is a candidate. |
446 return hasElementIn(self, element) && appliesUntyped(element, compiler); | 452 return hasElementIn(self, element) && appliesUntyped(element, compiler); |
447 } | 453 } |
448 | 454 |
449 return false; | 455 return false; |
450 } | 456 } |
451 } | 457 } |
OLD | NEW |