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 class EnqueueTask extends CompilerTask { | 5 class EnqueueTask extends CompilerTask { |
6 final Enqueuer codegen; | 6 final Enqueuer codegen; |
7 final Enqueuer resolution; | 7 final Enqueuer resolution; |
8 | 8 |
9 String get name => 'Enqueue'; | 9 String get name => 'Enqueue'; |
10 | 10 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 seenClasses = new Set<ClassElement>(), | 68 seenClasses = new Set<ClassElement>(), |
69 universe = new Universe(), | 69 universe = new Universe(), |
70 queue = new Queue<WorkItem>(), | 70 queue = new Queue<WorkItem>(), |
71 resolvedElements = new Map<Element, TreeElements>(), | 71 resolvedElements = new Map<Element, TreeElements>(), |
72 recompilationCandidates = | 72 recompilationCandidates = |
73 new RecompilationQueue(itemCompilationContextCreator); | 73 new RecompilationQueue(itemCompilationContextCreator); |
74 | 74 |
75 bool get isResolutionQueue => compiler.enqueuer.resolution === this; | 75 bool get isResolutionQueue => compiler.enqueuer.resolution === this; |
76 | 76 |
77 TreeElements getCachedElements(Element element) { | 77 TreeElements getCachedElements(Element element) { |
| 78 if (element.enclosingElement.isClosure()) { |
| 79 ClosureClassElement cls = element.enclosingElement; |
| 80 element = cls.methodElement; |
| 81 } |
78 Element owner = element.getOutermostEnclosingMemberOrTopLevel(); | 82 Element owner = element.getOutermostEnclosingMemberOrTopLevel(); |
79 return compiler.enqueuer.resolution.resolvedElements[owner]; | 83 return compiler.enqueuer.resolution.resolvedElements[owner]; |
80 } | 84 } |
81 | 85 |
82 String lookupCode(Element element) => | 86 String lookupCode(Element element) => |
83 universe.generatedCode[element].toString(); | 87 universe.generatedCode[element].toString(); |
84 | 88 |
85 void addToWorkList(Element element, [TreeElements elements]) { | 89 void addToWorkList(Element element, [TreeElements elements]) { |
86 if (element.isForeign()) return; | 90 if (element.isForeign()) return; |
87 if (compiler.phase == Compiler.PHASE_RECOMPILING) return; | 91 if (compiler.phase == Compiler.PHASE_RECOMPILING) return; |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 void registerIsCheck(Element element) { | 351 void registerIsCheck(Element element) { |
348 universe.isChecks.add(element); | 352 universe.isChecks.add(element); |
349 } | 353 } |
350 | 354 |
351 void forEach(f(WorkItem work)) { | 355 void forEach(f(WorkItem work)) { |
352 while (!queue.isEmpty()) { | 356 while (!queue.isEmpty()) { |
353 f(queue.removeLast()); // TODO(kasperl): Why isn't this removeFirst? | 357 f(queue.removeLast()); // TODO(kasperl): Why isn't this removeFirst? |
354 } | 358 } |
355 } | 359 } |
356 } | 360 } |
OLD | NEW |