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 int get invocationMirrorKind { |
| 221 const int METHOD = 0; |
| 222 const int GETTER = 1; |
| 223 const int SETTER = 2; |
| 224 int kind = METHOD; |
| 225 if (isGetter()) { |
| 226 kind = GETTER; |
| 227 } else if (isSetter()) { |
| 228 kind = SETTER; |
| 229 } |
| 230 return kind; |
| 231 } |
| 232 |
| 233 |
220 bool applies(Element element, Compiler compiler) | 234 bool applies(Element element, Compiler compiler) |
221 => appliesUntyped(element, compiler); | 235 => appliesUntyped(element, compiler); |
222 | 236 |
223 bool appliesUntyped(Element element, Compiler compiler) { | 237 bool appliesUntyped(Element element, Compiler compiler) { |
224 if (Elements.isUnresolved(element)) return false; | 238 if (Elements.isUnresolved(element)) return false; |
225 if (element.isForeign()) return true; | 239 if (element.isForeign()) return true; |
226 | 240 |
227 if (element.isSetter()) return isSetter(); | 241 if (element.isSetter()) return isSetter(); |
228 if (element.isGetter()) return isGetter() || isCall(); | 242 if (element.isGetter()) return isGetter() || isCall(); |
229 if (element.isField()) return isGetter() || isSetter() || isCall(); | 243 if (element.isField()) return isGetter() || isSetter() || isCall(); |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 ClassElement cls = self; | 456 ClassElement cls = self; |
443 if (cls.isSubclassOf(other)) { | 457 if (cls.isSubclassOf(other)) { |
444 // Resolve an invocation of [element.name] on [self]. If it | 458 // Resolve an invocation of [element.name] on [self]. If it |
445 // is found, this selector is a candidate. | 459 // is found, this selector is a candidate. |
446 return hasElementIn(self, element) && appliesUntyped(element, compiler); | 460 return hasElementIn(self, element) && appliesUntyped(element, compiler); |
447 } | 461 } |
448 | 462 |
449 return false; | 463 return false; |
450 } | 464 } |
451 } | 465 } |
OLD | NEW |