Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(437)

Side by Side Diff: lib/compiler/implementation/enqueue.dart

Issue 10905305: Patch refactoring. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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.forEachMember(processInstantiatedClassMember,
192 includeInjectedMembers: true);
192 } 193 }
193 194
194 /** 195 /**
195 * Documentation wanted -- johnniwinther 196 * Documentation wanted -- johnniwinther
196 */ 197 */
197 void processInstantiatedClassMember(Element member) { 198 void processInstantiatedClassMember(ClassElement cls, Element member) {
198 assert(invariant(member, member.isDeclaration)); 199 assert(invariant(member, member.isDeclaration));
199 if (universe.generatedCode.containsKey(member)) return; 200 if (universe.generatedCode.containsKey(member)) return;
200 if (resolvedElements[member] !== null) return; 201 if (resolvedElements[member] !== null) return;
201 if (!member.isInstanceMember()) return; 202 if (!member.isInstanceMember()) return;
202 if (member.isField()) return; 203 if (member.isField()) return;
203 204
204 String memberName = member.name.slowToString(); 205 String memberName = member.name.slowToString();
205 Link<Element> members = instanceMembersByName.putIfAbsent( 206 Link<Element> members = instanceMembersByName.putIfAbsent(
206 memberName, () => const EmptyLink<Element>()); 207 memberName, () => const EmptyLink<Element>());
207 instanceMembersByName[memberName] = members.prepend(member); 208 instanceMembersByName[memberName] = members.prepend(member);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 // supertypes. 245 // supertypes.
245 cls.ensureResolved(compiler); 246 cls.ensureResolved(compiler);
246 247
247 for (Link<DartType> supertypes = cls.allSupertypesAndSelf; 248 for (Link<DartType> supertypes = cls.allSupertypesAndSelf;
248 !supertypes.isEmpty(); supertypes = supertypes.tail) { 249 !supertypes.isEmpty(); supertypes = supertypes.tail) {
249 cls = supertypes.head.element; 250 cls = supertypes.head.element;
250 if (seenClasses.contains(cls)) continue; 251 if (seenClasses.contains(cls)) continue;
251 seenClasses.add(cls); 252 seenClasses.add(cls);
252 cls.ensureResolved(compiler); 253 cls.ensureResolved(compiler);
253 if (!cls.isInterface()) { 254 if (!cls.isInterface()) {
254 cls.localMembers.forEach(processInstantiatedClassMember); 255 cls.forEachMember(processInstantiatedClassMember,
256 includeInjectedMembers: true);
255 } 257 }
256 if (isResolutionQueue) { 258 if (isResolutionQueue) {
257 compiler.resolver.checkMembers(cls); 259 compiler.resolver.checkMembers(cls);
258 } 260 }
259 261
260 if (compiler.enableTypeAssertions) { 262 if (compiler.enableTypeAssertions) {
261 // We need to register is checks and helpers for checking 263 // We need to register is checks and helpers for checking
262 // assignments to fields. 264 // assignments to fields.
263 // TODO(ngeoffray): This should really move to the backend. 265 // TODO(ngeoffray): This should really move to the backend.
264 cls.localMembers.forEach((Element member) { 266 cls.localMembers.forEach((Element member) {
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 } 393 }
392 394
393 void forEach(f(WorkItem work)) { 395 void forEach(f(WorkItem work)) {
394 while (!queue.isEmpty()) { 396 while (!queue.isEmpty()) {
395 f(queue.removeLast()); // TODO(kasperl): Why isn't this removeFirst? 397 f(queue.removeLast()); // TODO(kasperl): Why isn't this removeFirst?
396 } 398 }
397 } 399 }
398 400
399 String toString() => 'Enqueuer($name)'; 401 String toString() => 'Enqueuer($name)';
400 } 402 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698