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 '../cache_strategy.dart'; | 9 import '../cache_strategy.dart'; |
10 import '../common.dart'; | 10 import '../common.dart'; |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 /// constructor that has been called directly and not only through a | 118 /// constructor that has been called directly and not only through a |
119 /// super-call. | 119 /// super-call. |
120 // TODO(johnniwinther): Improve semantic precision. | 120 // TODO(johnniwinther): Improve semantic precision. |
121 Iterable<ClassElement> get directlyInstantiatedClasses; | 121 Iterable<ClassElement> get directlyInstantiatedClasses; |
122 | 122 |
123 /// All types that are checked either through is, as or checked mode checks. | 123 /// All types that are checked either through is, as or checked mode checks. |
124 Iterable<DartType> get isChecks; | 124 Iterable<DartType> get isChecks; |
125 | 125 |
126 /// Registers that [type] is checked in this universe. The unaliased type is | 126 /// Registers that [type] is checked in this universe. The unaliased type is |
127 /// returned. | 127 /// returned. |
128 DartType registerIsCheck(DartType type, Resolution resolution); | 128 DartType registerIsCheck(DartType type); |
129 | 129 |
130 /// All directly instantiated types, that is, the types of the directly | 130 /// All directly instantiated types, that is, the types of the directly |
131 /// instantiated classes. | 131 /// instantiated classes. |
132 // TODO(johnniwinther): Improve semantic precision. | 132 // TODO(johnniwinther): Improve semantic precision. |
133 Iterable<DartType> get instantiatedTypes; | 133 Iterable<DartType> get instantiatedTypes; |
134 } | 134 } |
135 | 135 |
136 abstract class ResolutionWorldBuilder implements WorldBuilder { | 136 abstract class ResolutionWorldBuilder implements WorldBuilder { |
137 /// Set of (live) local functions (closures) whose signatures reference type | 137 /// Set of (live) local functions (closures) whose signatures reference type |
138 /// variables. | 138 /// variables. |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 ReceiverConstraint mask = dynamicUse.mask; | 670 ReceiverConstraint mask = dynamicUse.mask; |
671 Map<Selector, SelectorConstraints> selectors = selectorMap.putIfAbsent( | 671 Map<Selector, SelectorConstraints> selectors = selectorMap.putIfAbsent( |
672 name, () => new Maplet<Selector, SelectorConstraints>()); | 672 name, () => new Maplet<Selector, SelectorConstraints>()); |
673 UniverseSelectorConstraints constraints = | 673 UniverseSelectorConstraints constraints = |
674 selectors.putIfAbsent(selector, () { | 674 selectors.putIfAbsent(selector, () { |
675 return selectorConstraintsStrategy.createSelectorConstraints(selector); | 675 return selectorConstraintsStrategy.createSelectorConstraints(selector); |
676 }); | 676 }); |
677 return constraints.addReceiverConstraint(mask); | 677 return constraints.addReceiverConstraint(mask); |
678 } | 678 } |
679 | 679 |
680 DartType registerIsCheck(DartType type, Resolution resolution) { | 680 DartType registerIsCheck(DartType type) { |
681 type.computeUnaliased(resolution); | 681 type.computeUnaliased(_resolution); |
682 type = type.unaliased; | 682 type = type.unaliased; |
683 // Even in checked mode, type annotations for return type and argument | 683 // Even in checked mode, type annotations for return type and argument |
684 // types do not imply type checks, so there should never be a check | 684 // types do not imply type checks, so there should never be a check |
685 // against the type variable of a typedef. | 685 // against the type variable of a typedef. |
686 isChecks.add(type); | 686 isChecks.add(type); |
687 return type; | 687 return type; |
688 } | 688 } |
689 | 689 |
690 void registerStaticUse(StaticUse staticUse, MemberUsedCallback memberUsed) { | 690 void registerStaticUse(StaticUse staticUse, MemberUsedCallback memberUsed) { |
691 Element element = staticUse.element; | 691 Element element = staticUse.element; |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1111 void forEachInvokedGetter( | 1111 void forEachInvokedGetter( |
1112 f(String name, Map<Selector, SelectorConstraints> selectors)) { | 1112 f(String name, Map<Selector, SelectorConstraints> selectors)) { |
1113 _invokedGetters.forEach(f); | 1113 _invokedGetters.forEach(f); |
1114 } | 1114 } |
1115 | 1115 |
1116 void forEachInvokedSetter( | 1116 void forEachInvokedSetter( |
1117 f(String name, Map<Selector, SelectorConstraints> selectors)) { | 1117 f(String name, Map<Selector, SelectorConstraints> selectors)) { |
1118 _invokedSetters.forEach(f); | 1118 _invokedSetters.forEach(f); |
1119 } | 1119 } |
1120 | 1120 |
1121 DartType registerIsCheck(DartType type, Resolution resolution) { | 1121 DartType registerIsCheck(DartType type) { |
1122 type = type.unaliased; | 1122 type = type.unaliased; |
1123 // Even in checked mode, type annotations for return type and argument | 1123 // Even in checked mode, type annotations for return type and argument |
1124 // types do not imply type checks, so there should never be a check | 1124 // types do not imply type checks, so there should never be a check |
1125 // against the type variable of a typedef. | 1125 // against the type variable of a typedef. |
1126 isChecks.add(type); | 1126 isChecks.add(type); |
1127 return type; | 1127 return type; |
1128 } | 1128 } |
1129 | 1129 |
1130 void registerStaticUse(StaticUse staticUse) { | 1130 void registerStaticUse(StaticUse staticUse) { |
1131 Element element = staticUse.element; | 1131 Element element = staticUse.element; |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1528 if (hasClosurization) { | 1528 if (hasClosurization) { |
1529 return MemberUses.NONE; | 1529 return MemberUses.NONE; |
1530 } | 1530 } |
1531 hasNormalUse = hasClosurization = true; | 1531 hasNormalUse = hasClosurization = true; |
1532 return _pendingUse.removeAll(MemberUses.ALL_STATIC); | 1532 return _pendingUse.removeAll(MemberUses.ALL_STATIC); |
1533 } | 1533 } |
1534 | 1534 |
1535 @override | 1535 @override |
1536 EnumSet<MemberUse> get _originalUse => MemberUses.ALL_STATIC; | 1536 EnumSet<MemberUse> get _originalUse => MemberUses.ALL_STATIC; |
1537 } | 1537 } |
OLD | NEW |