OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 part of resolution; | 5 part of resolution; |
6 | 6 |
7 /// [ResolutionRegistry] collects all resolution information. It stores node | 7 /// [ResolutionRegistry] collects all resolution information. It stores node |
8 /// related information in a [TreeElements] mapping and registers calls with | 8 /// related information in a [TreeElements] mapping and registers calls with |
9 /// [Backend], [World] and [Enqueuer]. | 9 /// [Backend], [World] and [Enqueuer]. |
10 // TODO(johnniwinther): Split this into an interface and implementation class. | 10 // TODO(johnniwinther): Split this into an interface and implementation class. |
11 class ResolutionRegistry extends Registry { | 11 class ResolutionRegistry extends Registry { |
12 final Compiler compiler; | 12 final Compiler compiler; |
13 final TreeElementMapping mapping; | 13 final TreeElementMapping mapping; |
14 | 14 |
15 ResolutionRegistry(Compiler compiler, Element element) | 15 ResolutionRegistry(Compiler compiler, Element element) |
16 : this.internal(compiler, _ensureTreeElements(element)); | 16 : this.internal(compiler, _ensureTreeElements(element)); |
17 | 17 |
18 ResolutionRegistry.internal(this.compiler, this.mapping); | 18 ResolutionRegistry.internal(this.compiler, this.mapping); |
19 | 19 |
20 bool get isForResolution => true; | 20 bool get isForResolution => true; |
21 | 21 |
22 Element get currentElement => mapping.currentElement; | |
23 | |
24 ResolutionEnqueuer get world => compiler.enqueuer.resolution; | 22 ResolutionEnqueuer get world => compiler.enqueuer.resolution; |
25 | 23 |
26 World get universe => compiler.world; | 24 World get universe => compiler.world; |
27 | 25 |
28 Backend get backend => compiler.backend; | 26 Backend get backend => compiler.backend; |
29 | 27 |
30 ////////////////////////////////////////////////////////////////////////////// | 28 ////////////////////////////////////////////////////////////////////////////// |
31 // Node-to-Element mapping functionality. | 29 // Node-to-Element mapping functionality. |
32 ////////////////////////////////////////////////////////////////////////////// | 30 ////////////////////////////////////////////////////////////////////////////// |
33 | 31 |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 | 214 |
217 void registerClosure(LocalFunctionElement element) { | 215 void registerClosure(LocalFunctionElement element) { |
218 world.registerClosure(element, this); | 216 world.registerClosure(element, this); |
219 } | 217 } |
220 | 218 |
221 void registerSuperUse(Node node) { | 219 void registerSuperUse(Node node) { |
222 mapping.superUses.add(node); | 220 mapping.superUses.add(node); |
223 } | 221 } |
224 | 222 |
225 void registerDynamicInvocation(Selector selector) { | 223 void registerDynamicInvocation(Selector selector) { |
226 world.registerDynamicInvocation(currentElement, selector); | 224 world.registerDynamicInvocation(selector); |
227 } | 225 } |
228 | 226 |
229 void registerSuperNoSuchMethod() { | 227 void registerSuperNoSuchMethod() { |
230 backend.resolutionCallbacks.onSuperNoSuchMethod(this); | 228 backend.resolutionCallbacks.onSuperNoSuchMethod(this); |
231 } | 229 } |
232 | 230 |
233 void registerClassUsingVariableExpression(ClassElement element) { | 231 void registerClassUsingVariableExpression(ClassElement element) { |
234 backend.registerClassUsingVariableExpression(element); | 232 backend.registerClassUsingVariableExpression(element); |
235 } | 233 } |
236 | 234 |
(...skipping 11 matching lines...) Expand all Loading... |
248 // needed to lookup types in the current scope. | 246 // needed to lookup types in the current scope. |
249 void registerJsCall(Node node, ResolverVisitor visitor) { | 247 void registerJsCall(Node node, ResolverVisitor visitor) { |
250 world.registerJsCall(node, visitor); | 248 world.registerJsCall(node, visitor); |
251 } | 249 } |
252 | 250 |
253 void registerGetOfStaticFunction(FunctionElement element) { | 251 void registerGetOfStaticFunction(FunctionElement element) { |
254 world.registerGetOfStaticFunction(element); | 252 world.registerGetOfStaticFunction(element); |
255 } | 253 } |
256 | 254 |
257 void registerDynamicGetter(Selector selector) { | 255 void registerDynamicGetter(Selector selector) { |
258 world.registerDynamicGetter(currentElement, selector); | 256 world.registerDynamicGetter(selector); |
259 } | 257 } |
260 | 258 |
261 void registerDynamicSetter(Selector selector) { | 259 void registerDynamicSetter(Selector selector) { |
262 world.registerDynamicSetter(currentElement, selector); | 260 world.registerDynamicSetter(selector); |
263 } | 261 } |
264 | 262 |
265 void registerConstSymbol(String name) { | 263 void registerConstSymbol(String name) { |
266 backend.registerConstSymbol(name, this); | 264 backend.registerConstSymbol(name, this); |
267 } | 265 } |
268 | 266 |
269 void registerSymbolConstructor() { | 267 void registerSymbolConstructor() { |
270 backend.resolutionCallbacks.onSymbolConstructor(this); | 268 backend.resolutionCallbacks.onSymbolConstructor(this); |
271 } | 269 } |
272 | 270 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 | 340 |
343 void registerAssert(Send node) { | 341 void registerAssert(Send node) { |
344 mapping.setAssert(node); | 342 mapping.setAssert(node); |
345 backend.resolutionCallbacks.onAssert(node, this); | 343 backend.resolutionCallbacks.onAssert(node, this); |
346 } | 344 } |
347 | 345 |
348 bool isAssert(Send node) { | 346 bool isAssert(Send node) { |
349 return mapping.isAssert(node); | 347 return mapping.isAssert(node); |
350 } | 348 } |
351 } | 349 } |
OLD | NEW |