| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 currentClass !== null; | 143 currentClass !== null; |
| 144 currentClass = currentClass.superclass) { | 144 currentClass = currentClass.superclass) { |
| 145 processInstantiatedClass(currentClass); | 145 processInstantiatedClass(currentClass); |
| 146 } | 146 } |
| 147 } | 147 } |
| 148 }); | 148 }); |
| 149 return true; | 149 return true; |
| 150 } | 150 } |
| 151 | 151 |
| 152 void processInstantiatedClass(ClassElement cls) { | 152 void processInstantiatedClass(ClassElement cls) { |
| 153 cls.localMembers.forEach(processInstantiatedClassMember); | 153 cls.implementation.forEachMember(processInstantiatedClassMember); |
| 154 } | 154 } |
| 155 | 155 |
| 156 /** | 156 /** |
| 157 * Documentation wanted -- johnniwinther | 157 * Documentation wanted -- johnniwinther |
| 158 */ | 158 */ |
| 159 void processInstantiatedClassMember(Element member) { | 159 void processInstantiatedClassMember(ClassElement cls, Element member) { |
| 160 assert(invariant(member, member.isDeclaration)); | 160 assert(invariant(member, member.isDeclaration)); |
| 161 if (universe.generatedCode.containsKey(member)) return; | 161 if (universe.generatedCode.containsKey(member)) return; |
| 162 if (resolvedElements[member] !== null) return; | 162 if (resolvedElements[member] !== null) return; |
| 163 if (!member.isInstanceMember()) return; | 163 if (!member.isInstanceMember()) return; |
| 164 if (member.isField()) return; | 164 if (member.isField()) return; |
| 165 | 165 |
| 166 String memberName = member.name.slowToString(); | 166 String memberName = member.name.slowToString(); |
| 167 Link<Element> members = instanceMembersByName.putIfAbsent( | 167 Link<Element> members = instanceMembersByName.putIfAbsent( |
| 168 memberName, () => const EmptyLink<Element>()); | 168 memberName, () => const EmptyLink<Element>()); |
| 169 instanceMembersByName[memberName] = members.prepend(member); | 169 instanceMembersByName[memberName] = members.prepend(member); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 // supertypes. | 206 // supertypes. |
| 207 cls.ensureResolved(compiler); | 207 cls.ensureResolved(compiler); |
| 208 | 208 |
| 209 for (Link<DartType> supertypes = cls.allSupertypesAndSelf; | 209 for (Link<DartType> supertypes = cls.allSupertypesAndSelf; |
| 210 !supertypes.isEmpty(); supertypes = supertypes.tail) { | 210 !supertypes.isEmpty(); supertypes = supertypes.tail) { |
| 211 cls = supertypes.head.element; | 211 cls = supertypes.head.element; |
| 212 if (seenClasses.contains(cls)) continue; | 212 if (seenClasses.contains(cls)) continue; |
| 213 seenClasses.add(cls); | 213 seenClasses.add(cls); |
| 214 cls.ensureResolved(compiler); | 214 cls.ensureResolved(compiler); |
| 215 if (!cls.isInterface()) { | 215 if (!cls.isInterface()) { |
| 216 cls.localMembers.forEach(processInstantiatedClassMember); | 216 cls.implementation.forEachMember(processInstantiatedClassMember); |
| 217 } | 217 } |
| 218 if (isResolutionQueue) { | 218 if (isResolutionQueue) { |
| 219 compiler.resolver.checkMembers(cls); | 219 compiler.resolver.checkMembers(cls); |
| 220 } | 220 } |
| 221 | 221 |
| 222 if (compiler.enableTypeAssertions) { | 222 if (compiler.enableTypeAssertions) { |
| 223 // We need to register is checks and helpers for checking | 223 // We need to register is checks and helpers for checking |
| 224 // assignments to fields. | 224 // assignments to fields. |
| 225 // TODO(ngeoffray): This should really move to the backend. | 225 // TODO(ngeoffray): This should really move to the backend. |
| 226 cls.localMembers.forEach((Element member) { | 226 cls.localMembers.forEach((Element member) { |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 } | 353 } |
| 354 | 354 |
| 355 void forEach(f(WorkItem work)) { | 355 void forEach(f(WorkItem work)) { |
| 356 while (!queue.isEmpty()) { | 356 while (!queue.isEmpty()) { |
| 357 f(queue.removeLast()); // TODO(kasperl): Why isn't this removeFirst? | 357 f(queue.removeLast()); // TODO(kasperl): Why isn't this removeFirst? |
| 358 } | 358 } |
| 359 } | 359 } |
| 360 | 360 |
| 361 String toString() => 'Enqueuer($name)'; | 361 String toString() => 'Enqueuer($name)'; |
| 362 } | 362 } |
| OLD | NEW |