| 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 10 matching lines...) Expand all Loading... |
| 21 final Queue<WorkItem> queue; | 21 final Queue<WorkItem> queue; |
| 22 final Set<Element> queueElements; | 22 final Set<Element> queueElements; |
| 23 int processed = 0; | 23 int processed = 0; |
| 24 | 24 |
| 25 RecompilationQueue() | 25 RecompilationQueue() |
| 26 : queue = new Queue<WorkItem>(), | 26 : queue = new Queue<WorkItem>(), |
| 27 queueElements = new Set<Element>(); | 27 queueElements = new Set<Element>(); |
| 28 | 28 |
| 29 void add(Element element, TreeElements elements) { | 29 void add(Element element, TreeElements elements) { |
| 30 if (queueElements.contains(element)) return; | 30 if (queueElements.contains(element)) return; |
| 31 // TODO(sgjesse): Make this handle constructor bodies as well. | 31 queueElements.add(element); |
| 32 if (element.kind !== ElementKind.GENERATIVE_CONSTRUCTOR_BODY) { | 32 queue.add(new WorkItem(element, elements)); |
| 33 queueElements.add(element); | |
| 34 queue.add(new WorkItem(element, elements)); | |
| 35 } | |
| 36 } | 33 } |
| 37 | 34 |
| 38 int get length() => queue.length; | 35 int get length() => queue.length; |
| 39 | 36 |
| 40 bool isEmpty() => queue.isEmpty(); | 37 bool isEmpty() => queue.isEmpty(); |
| 41 | 38 |
| 42 WorkItem next() { | 39 WorkItem next() { |
| 43 WorkItem item = queue.removeLast(); | 40 WorkItem item = queue.removeLast(); |
| 44 queueElements.remove(item.element); | 41 queueElements.remove(item.element); |
| 45 processed++; | 42 processed++; |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 void registerIsCheck(Element element) { | 315 void registerIsCheck(Element element) { |
| 319 universe.isChecks.add(element); | 316 universe.isChecks.add(element); |
| 320 } | 317 } |
| 321 | 318 |
| 322 void forEach(f(WorkItem work)) { | 319 void forEach(f(WorkItem work)) { |
| 323 while (!queue.isEmpty()) { | 320 while (!queue.isEmpty()) { |
| 324 f(queue.removeLast()); | 321 f(queue.removeLast()); |
| 325 } | 322 } |
| 326 } | 323 } |
| 327 } | 324 } |
| OLD | NEW |