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

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

Issue 10661029: Ensure interfaces are loaded. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased Created 8 years, 4 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
« no previous file with comments | « dart/lib/compiler/implementation/typechecker.dart ('k') | dart/tests/co19/co19-leg.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 World { 5 class World {
6 Compiler compiler; // Set in populate(). 6 Compiler compiler; // Set in populate().
7 final Map<ClassElement, Set<ClassElement>> subtypes; 7 final Map<ClassElement, Set<ClassElement>> subtypes;
8 8
9 World() : subtypes = new Map<ClassElement, Set<ClassElement>>(); 9 World() : subtypes = new Map<ClassElement, Set<ClassElement>>();
10 10
11 void populate(Compiler compiler, Collection<LibraryElement> libraries) { 11 void populate(Compiler compiler, Collection<LibraryElement> libraries) {
12 void addSubtypes(ClassElement cls) { 12 void addSubtypes(ClassElement cls) {
13 for (Type type in cls.allSupertypes) { 13 for (Type type in cls.allSupertypes) {
14 Set<Element> subtypesOfCls = subtypes.putIfAbsent( 14 Set<Element> subtypesOfCls = subtypes.putIfAbsent(
15 type.element, 15 type.element,
16 () => new Set<ClassElement>()); 16 () => new Set<ClassElement>());
17 subtypesOfCls.add(cls); 17 subtypesOfCls.add(cls);
18 } 18 }
19 } 19 }
20 20
21 libraries.forEach((LibraryElement library) { 21 libraries.forEach((LibraryElement library) {
22 for (Link<Element> link = library.topLevelElements; 22 for (Link<Element> link = library.topLevelElements;
23 !link.isEmpty(); 23 !link.isEmpty();
24 link = link.tail) { 24 link = link.tail) {
25 Element element = link.head; 25 Element element = link.head;
26 if (!element.isClass()) continue; 26 if (!element.isClass()) continue;
27 ClassElement cls = element; 27 ClassElement cls = element;
28 compiler.resolveClass(cls); 28 cls.ensureResolved(compiler);
29 addSubtypes(cls); 29 addSubtypes(cls);
30 } 30 }
31 }); 31 });
32 32
33 // Mark the world as populated. 33 // Mark the world as populated.
34 assert(compiler !== null); 34 assert(compiler !== null);
35 this.compiler = compiler; 35 this.compiler = compiler;
36 } 36 }
37 37
38 /** 38 /**
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 final SourceString name; 98 final SourceString name;
99 99
100 MemberSet(SourceString this.name) : elements = new Set<Element>(); 100 MemberSet(SourceString this.name) : elements = new Set<Element>();
101 101
102 void add(Element element) { 102 void add(Element element) {
103 elements.add(element); 103 elements.add(element);
104 } 104 }
105 105
106 bool isEmpty() => elements.isEmpty(); 106 bool isEmpty() => elements.isEmpty();
107 } 107 }
OLDNEW
« no previous file with comments | « dart/lib/compiler/implementation/typechecker.dart ('k') | dart/tests/co19/co19-leg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698