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 '../dart_types.dart'; | 10 import '../dart_types.dart'; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
43 * getter and only registers an invoked getter. | 43 * getter and only registers an invoked getter. |
44 */ | 44 */ |
45 final Set<Element> fieldGetters; | 45 final Set<Element> fieldGetters; |
46 | 46 |
47 /** | 47 /** |
48 * Fields set. See comment in [fieldGetters]. | 48 * Fields set. See comment in [fieldGetters]. |
49 */ | 49 */ |
50 final Set<Element> fieldSetters; | 50 final Set<Element> fieldSetters; |
51 final Set<DartType> isChecks; | 51 final Set<DartType> isChecks; |
52 | 52 |
53 /** | |
54 * Set of [:call:] methods in instantiated classes that use type variables | |
55 * in their signature. | |
56 */ | |
57 final Set<Element> genericCallMethods; | |
58 | |
59 /** | |
60 * Set of methods in instantiated classes that use type variables in their | |
61 * signature and have potentially been closurized. | |
62 */ | |
63 final Set<Element> closurizedGenericMembers; | |
64 | |
65 final Set<Element> closurizedMembers; | |
66 | |
53 bool usingFactoryWithTypeArguments = false; | 67 bool usingFactoryWithTypeArguments = false; |
54 | 68 |
55 Universe() : instantiatedClasses = new Set<ClassElement>(), | 69 Universe() : instantiatedClasses = new Set<ClassElement>(), |
56 instantiatedTypes = new Set<DartType>(), | 70 instantiatedTypes = new Set<DartType>(), |
57 staticFunctionsNeedingGetter = new Set<FunctionElement>(), | 71 staticFunctionsNeedingGetter = new Set<FunctionElement>(), |
58 invokedNames = new Map<SourceString, Set<Selector>>(), | 72 invokedNames = new Map<SourceString, Set<Selector>>(), |
59 invokedGetters = new Map<SourceString, Set<Selector>>(), | 73 invokedGetters = new Map<SourceString, Set<Selector>>(), |
60 invokedSetters = new Map<SourceString, Set<Selector>>(), | 74 invokedSetters = new Map<SourceString, Set<Selector>>(), |
61 fieldGetters = new Set<Element>(), | 75 fieldGetters = new Set<Element>(), |
62 fieldSetters = new Set<Element>(), | 76 fieldSetters = new Set<Element>(), |
63 isChecks = new Set<DartType>(); | 77 isChecks = new Set<DartType>(), |
78 genericCallMethods = new Set<Element>(), | |
79 closurizedGenericMembers = new Set<Element>(), | |
80 closurizedMembers = new Set<Element>(); | |
64 | 81 |
65 bool hasMatchingSelector(Set<Selector> selectors, | 82 bool hasMatchingSelector(Set<Selector> selectors, |
66 Element member, | 83 Element member, |
67 Compiler compiler) { | 84 Compiler compiler) { |
68 if (selectors == null) return false; | 85 if (selectors == null) return false; |
69 for (Selector selector in selectors) { | 86 for (Selector selector in selectors) { |
70 if (selector.appliesUnnamed(member, compiler)) return true; | 87 if (selector.appliesUnnamed(member, compiler)) return true; |
71 } | 88 } |
72 return false; | 89 return false; |
73 } | 90 } |
(...skipping 10 matching lines...) Expand all Loading... | |
84 return hasMatchingSelector(invokedSetters[member.name], member, compiler); | 101 return hasMatchingSelector(invokedSetters[member.name], member, compiler); |
85 } | 102 } |
86 | 103 |
87 bool hasFieldGetter(Element member, Compiler compiler) { | 104 bool hasFieldGetter(Element member, Compiler compiler) { |
88 return fieldGetters.contains(member); | 105 return fieldGetters.contains(member); |
89 } | 106 } |
90 | 107 |
91 bool hasFieldSetter(Element member, Compiler compiler) { | 108 bool hasFieldSetter(Element member, Compiler compiler) { |
92 return fieldSetters.contains(member); | 109 return fieldSetters.contains(member); |
93 } | 110 } |
111 | |
112 DartType registerIsCheck(DartType type, Compiler compiler) { | |
karlklose
2013/06/20 07:32:55
Which method is this replacing?
Johnni Winther
2013/06/21 12:19:15
It new. Used from the enqueuer to register checks
| |
113 type = type.unalias(compiler); | |
114 // Even in checked mode, type annotations for return type and argument | |
115 // types do not imply type checks, so there should never be a check | |
116 // against the type variable of a typedef. | |
117 isChecks.add(type); | |
118 return type; | |
119 } | |
94 } | 120 } |
95 | 121 |
96 class SelectorKind { | 122 class SelectorKind { |
97 final String name; | 123 final String name; |
98 final int hashCode; | 124 final int hashCode; |
99 const SelectorKind(this.name, this.hashCode); | 125 const SelectorKind(this.name, this.hashCode); |
100 | 126 |
101 static const SelectorKind GETTER = const SelectorKind('getter', 0); | 127 static const SelectorKind GETTER = const SelectorKind('getter', 0); |
102 static const SelectorKind SETTER = const SelectorKind('setter', 1); | 128 static const SelectorKind SETTER = const SelectorKind('setter', 1); |
103 static const SelectorKind CALL = const SelectorKind('call', 2); | 129 static const SelectorKind CALL = const SelectorKind('call', 2); |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
507 // bar() => foo(); // The call to 'foo' is a typed selector. | 533 // bar() => foo(); // The call to 'foo' is a typed selector. |
508 // } | 534 // } |
509 if (element.getEnclosingClass().isClosure()) { | 535 if (element.getEnclosingClass().isClosure()) { |
510 return appliesUntyped(element, compiler); | 536 return appliesUntyped(element, compiler); |
511 } | 537 } |
512 | 538 |
513 if (!mask.canHit(element, this, compiler)) return false; | 539 if (!mask.canHit(element, this, compiler)) return false; |
514 return appliesUntyped(element, compiler); | 540 return appliesUntyped(element, compiler); |
515 } | 541 } |
516 } | 542 } |
OLD | NEW |