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 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) { | 11 void populate(Compiler compiler) { |
12 void addSubtypes(ClassElement cls) { | 12 void addSubtypes(ClassElement cls) { |
13 if (!cls.isResolved) { | 13 if (cls.resolutionState != ClassElement.STATE_DONE) { |
14 compiler.internalErrorOnElement( | 14 compiler.internalErrorOnElement( |
15 cls, 'Class "${cls.name.slowToString()}" is not resolved.'); | 15 cls, 'Class "${cls.name.slowToString()}" is not resolved.'); |
16 } | 16 } |
17 for (Type type in cls.allSupertypes) { | 17 for (Type type in cls.allSupertypes) { |
18 Set<Element> subtypesOfCls = | 18 Set<Element> subtypesOfCls = |
19 subtypes.putIfAbsent(type.element, () => new Set<ClassElement>()); | 19 subtypes.putIfAbsent(type.element, () => new Set<ClassElement>()); |
20 subtypesOfCls.add(cls); | 20 subtypesOfCls.add(cls); |
21 } | 21 } |
22 } | 22 } |
23 | 23 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 final SourceString name; | 91 final SourceString name; |
92 | 92 |
93 MemberSet(SourceString this.name) : elements = new Set<Element>(); | 93 MemberSet(SourceString this.name) : elements = new Set<Element>(); |
94 | 94 |
95 void add(Element element) { | 95 void add(Element element) { |
96 elements.add(element); | 96 elements.add(element); |
97 } | 97 } |
98 | 98 |
99 bool isEmpty() => elements.isEmpty(); | 99 bool isEmpty() => elements.isEmpty(); |
100 } | 100 } |
OLD | NEW |