OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 type_graph_inferrer; | 5 library type_graph_inferrer; |
6 | 6 |
7 import 'dart:collection' show Queue; | 7 import 'dart:collection' show Queue; |
8 | 8 |
9 import '../compiler.dart' show Compiler; | 9 import '../compiler.dart' show Compiler; |
10 import '../elements/elements.dart'; | 10 import '../elements/elements.dart'; |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 TypeMask result = const TypeMask.nonNullEmpty(); | 129 TypeMask result = const TypeMask.nonNullEmpty(); |
130 Iterable<MemberEntity> elements = | 130 Iterable<MemberEntity> elements = |
131 inferrer.closedWorld.locateMembers(selector, mask); | 131 inferrer.closedWorld.locateMembers(selector, mask); |
132 for (MemberElement element in elements) { | 132 for (MemberElement element in elements) { |
133 TypeMask type = inferrer.typeOfMemberWithSelector(element, selector).type; | 133 TypeMask type = inferrer.typeOfMemberWithSelector(element, selector).type; |
134 result = result.union(type, inferrer.closedWorld); | 134 result = result.union(type, inferrer.closedWorld); |
135 } | 135 } |
136 return result; | 136 return result; |
137 } | 137 } |
138 | 138 |
139 Iterable<Element> getCallersOf(MemberElement element) { | 139 Iterable<MemberEntity> getCallersOf(MemberElement element) { |
140 if (compiler.disableTypeInference) { | 140 if (compiler.disableTypeInference) { |
141 throw new UnsupportedError( | 141 throw new UnsupportedError( |
142 "Cannot query the type inferrer when type inference is disabled."); | 142 "Cannot query the type inferrer when type inference is disabled."); |
143 } | 143 } |
144 return inferrer.getCallersOf(element); | 144 return inferrer.getCallersOf(element); |
145 } | 145 } |
146 | 146 |
147 bool isMemberCalledOnce(MemberElement element) { | 147 bool isMemberCalledOnce(MemberElement element) { |
148 if (compiler.disableTypeInference) return false; | 148 if (compiler.disableTypeInference) return false; |
149 MemberTypeInformation info = | 149 MemberTypeInformation info = |
150 inferrer.types.getInferredTypeOfMember(element); | 150 inferrer.types.getInferredTypeOfMember(element); |
151 return info.isCalledOnce(); | 151 return info.isCalledOnce(); |
152 } | 152 } |
153 | 153 |
154 void clear() { | 154 void clear() { |
155 inferrer.clear(); | 155 inferrer.clear(); |
156 } | 156 } |
157 } | 157 } |
OLD | NEW |