| 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 currentClass !== null; | 181 currentClass !== null; |
| 182 currentClass = currentClass.superclass) { | 182 currentClass = currentClass.superclass) { |
| 183 processInstantiatedClass(currentClass); | 183 processInstantiatedClass(currentClass); |
| 184 } | 184 } |
| 185 } | 185 } |
| 186 }); | 186 }); |
| 187 return true; | 187 return true; |
| 188 } | 188 } |
| 189 | 189 |
| 190 void processInstantiatedClass(ClassElement cls) { | 190 void processInstantiatedClass(ClassElement cls) { |
| 191 cls.localMembers.forEach(processInstantiatedClassMember); | 191 cls.implementation.forEachMember(processInstantiatedClassMember); |
| 192 } | 192 } |
| 193 | 193 |
| 194 /** | 194 /** |
| 195 * Documentation wanted -- johnniwinther | 195 * Documentation wanted -- johnniwinther |
| 196 */ | 196 */ |
| 197 void processInstantiatedClassMember(Element member) { | 197 void processInstantiatedClassMember(ClassElement cls, Element member) { |
| 198 assert(invariant(member, member.isDeclaration)); | 198 assert(invariant(member, member.isDeclaration)); |
| 199 if (universe.generatedCode.containsKey(member)) return; | 199 if (universe.generatedCode.containsKey(member)) return; |
| 200 if (resolvedElements[member] !== null) return; | 200 if (resolvedElements[member] !== null) return; |
| 201 if (!member.isInstanceMember()) return; | 201 if (!member.isInstanceMember()) return; |
| 202 if (member.isField()) return; | 202 if (member.isField()) return; |
| 203 | 203 |
| 204 String memberName = member.name.slowToString(); | 204 String memberName = member.name.slowToString(); |
| 205 Link<Element> members = instanceMembersByName.putIfAbsent( | 205 Link<Element> members = instanceMembersByName.putIfAbsent( |
| 206 memberName, () => const EmptyLink<Element>()); | 206 memberName, () => const EmptyLink<Element>()); |
| 207 instanceMembersByName[memberName] = members.prepend(member); | 207 instanceMembersByName[memberName] = members.prepend(member); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 // supertypes. | 244 // supertypes. |
| 245 cls.ensureResolved(compiler); | 245 cls.ensureResolved(compiler); |
| 246 | 246 |
| 247 for (Link<DartType> supertypes = cls.allSupertypesAndSelf; | 247 for (Link<DartType> supertypes = cls.allSupertypesAndSelf; |
| 248 !supertypes.isEmpty(); supertypes = supertypes.tail) { | 248 !supertypes.isEmpty(); supertypes = supertypes.tail) { |
| 249 cls = supertypes.head.element; | 249 cls = supertypes.head.element; |
| 250 if (seenClasses.contains(cls)) continue; | 250 if (seenClasses.contains(cls)) continue; |
| 251 seenClasses.add(cls); | 251 seenClasses.add(cls); |
| 252 cls.ensureResolved(compiler); | 252 cls.ensureResolved(compiler); |
| 253 if (!cls.isInterface()) { | 253 if (!cls.isInterface()) { |
| 254 cls.localMembers.forEach(processInstantiatedClassMember); | 254 cls.implementation.forEachMember(processInstantiatedClassMember); |
| 255 } | 255 } |
| 256 if (isResolutionQueue) { | 256 if (isResolutionQueue) { |
| 257 compiler.resolver.checkMembers(cls); | 257 compiler.resolver.checkMembers(cls); |
| 258 } | 258 } |
| 259 | 259 |
| 260 if (compiler.enableTypeAssertions) { | 260 if (compiler.enableTypeAssertions) { |
| 261 // We need to register is checks and helpers for checking | 261 // We need to register is checks and helpers for checking |
| 262 // assignments to fields. | 262 // assignments to fields. |
| 263 // TODO(ngeoffray): This should really move to the backend. | 263 // TODO(ngeoffray): This should really move to the backend. |
| 264 cls.localMembers.forEach((Element member) { | 264 cls.localMembers.forEach((Element member) { |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 } | 391 } |
| 392 | 392 |
| 393 void forEach(f(WorkItem work)) { | 393 void forEach(f(WorkItem work)) { |
| 394 while (!queue.isEmpty()) { | 394 while (!queue.isEmpty()) { |
| 395 f(queue.removeLast()); // TODO(kasperl): Why isn't this removeFirst? | 395 f(queue.removeLast()); // TODO(kasperl): Why isn't this removeFirst? |
| 396 } | 396 } |
| 397 } | 397 } |
| 398 | 398 |
| 399 String toString() => 'Enqueuer($name)'; | 399 String toString() => 'Enqueuer($name)'; |
| 400 } | 400 } |
| OLD | NEW |