| 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 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import '../common/names.dart' show | 9 import '../common/names.dart' show |
| 10 Identifiers, | 10 Identifiers, |
| (...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 bool get isSetter => kind == SelectorKind.SETTER; | 818 bool get isSetter => kind == SelectorKind.SETTER; |
| 819 bool get isCall => kind == SelectorKind.CALL; | 819 bool get isCall => kind == SelectorKind.CALL; |
| 820 bool get isClosureCall => isCall && memberName == CALL_NAME; | 820 bool get isClosureCall => isCall && memberName == CALL_NAME; |
| 821 | 821 |
| 822 bool get isIndex => kind == SelectorKind.INDEX && argumentCount == 1; | 822 bool get isIndex => kind == SelectorKind.INDEX && argumentCount == 1; |
| 823 bool get isIndexSet => kind == SelectorKind.INDEX && argumentCount == 2; | 823 bool get isIndexSet => kind == SelectorKind.INDEX && argumentCount == 2; |
| 824 | 824 |
| 825 bool get isOperator => kind == SelectorKind.OPERATOR; | 825 bool get isOperator => kind == SelectorKind.OPERATOR; |
| 826 bool get isUnaryOperator => isOperator && argumentCount == 0; | 826 bool get isUnaryOperator => isOperator && argumentCount == 0; |
| 827 | 827 |
| 828 /** Check whether this is a call to 'assert'. */ | |
| 829 bool get isAssert => isCall && identical(name, "assert"); | |
| 830 | |
| 831 /** | 828 /** |
| 832 * The member name for invocation mirrors created from this selector. | 829 * The member name for invocation mirrors created from this selector. |
| 833 */ | 830 */ |
| 834 String get invocationMirrorMemberName => | 831 String get invocationMirrorMemberName => |
| 835 isSetter ? '$name=' : name; | 832 isSetter ? '$name=' : name; |
| 836 | 833 |
| 837 int get invocationMirrorKind { | 834 int get invocationMirrorKind { |
| 838 const int METHOD = 0; | 835 const int METHOD = 0; |
| 839 const int GETTER = 1; | 836 const int GETTER = 1; |
| 840 const int SETTER = 2; | 837 const int SETTER = 2; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 874 } | 871 } |
| 875 | 872 |
| 876 bool signatureApplies(FunctionElement function) { | 873 bool signatureApplies(FunctionElement function) { |
| 877 if (Elements.isUnresolved(function)) return false; | 874 if (Elements.isUnresolved(function)) return false; |
| 878 return callStructure.signatureApplies(function.functionSignature); | 875 return callStructure.signatureApplies(function.functionSignature); |
| 879 } | 876 } |
| 880 | 877 |
| 881 bool sameNameHack(Element element, World world) { | 878 bool sameNameHack(Element element, World world) { |
| 882 // TODO(ngeoffray): Remove workaround checks. | 879 // TODO(ngeoffray): Remove workaround checks. |
| 883 return element.isConstructor || | 880 return element.isConstructor || |
| 884 name == element.name || | 881 name == element.name; |
| 885 name == 'assert' && world.isAssertMethod(element); | |
| 886 } | 882 } |
| 887 | 883 |
| 888 bool applies(Element element, World world) { | 884 bool applies(Element element, World world) { |
| 889 if (!sameNameHack(element, world)) return false; | 885 if (!sameNameHack(element, world)) return false; |
| 890 return appliesUnnamed(element, world); | 886 return appliesUnnamed(element, world); |
| 891 } | 887 } |
| 892 | 888 |
| 893 bool match(SelectorKind kind, | 889 bool match(SelectorKind kind, |
| 894 Name memberName, | 890 Name memberName, |
| 895 CallStructure callStructure) { | 891 CallStructure callStructure) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 906 // Add bits from the call structure. | 902 // Add bits from the call structure. |
| 907 return Hashing.mixHashCodeBits(hash, callStructure.hashCode); | 903 return Hashing.mixHashCodeBits(hash, callStructure.hashCode); |
| 908 } | 904 } |
| 909 | 905 |
| 910 String toString() { | 906 String toString() { |
| 911 return 'Selector($kind, $name, ${callStructure.structureToString()})'; | 907 return 'Selector($kind, $name, ${callStructure.structureToString()})'; |
| 912 } | 908 } |
| 913 | 909 |
| 914 Selector toCallSelector() => new Selector.callClosureFrom(this); | 910 Selector toCallSelector() => new Selector.callClosureFrom(this); |
| 915 } | 911 } |
| OLD | NEW |