| 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 part of dart2js; | 5 part of dart2js; |
| 6 | 6 |
| 7 class World { | 7 class World { |
| 8 final Compiler compiler; | 8 final Compiler compiler; |
| 9 final Map<ClassElement, Set<ClassElement>> subtypes; | 9 final Map<ClassElement, Set<ClassElement>> subtypes; |
| 10 final Map<ClassElement, Set<MixinApplicationElement>> mixinUses; | 10 final Map<ClassElement, Set<MixinApplicationElement>> mixinUses; |
| 11 final Map<ClassElement, Set<ClassElement>> typesImplementedBySubclasses; | 11 final Map<ClassElement, Set<ClassElement>> typesImplementedBySubclasses; |
| 12 final Set<ClassElement> classesNeedingRti; | 12 final Set<ClassElement> classesNeedingRti; |
| 13 final Map<ClassElement, Set<ClassElement>> rtiDependencies; | 13 final Map<ClassElement, Set<ClassElement>> rtiDependencies; |
| 14 final FunctionSet userDefinedGetters; | 14 final FunctionSet userDefinedGetters; |
| 15 final FunctionSet userDefinedSetters; | 15 final FunctionSet userDefinedSetters; |
| 16 | 16 |
| 17 World(Compiler compiler) | 17 World(Compiler compiler) |
| 18 : subtypes = new Map<ClassElement, Set<ClassElement>>(), | 18 : subtypes = new Map<ClassElement, Set<ClassElement>>(), |
| 19 mixinUses = new Map<ClassElement, Set<MixinApplicationElement>>(), | 19 mixinUses = new Map<ClassElement, Set<MixinApplicationElement>>(), |
| 20 typesImplementedBySubclasses = | 20 typesImplementedBySubclasses = |
| 21 new Map<ClassElement, Set<ClassElement>>(), | 21 new Map<ClassElement, Set<ClassElement>>(), |
| 22 userDefinedGetters = new FunctionSet(compiler), | 22 userDefinedGetters = new FunctionSet(compiler), |
| 23 userDefinedSetters = new FunctionSet(compiler), | 23 userDefinedSetters = new FunctionSet(compiler), |
| 24 classesNeedingRti = new Set<ClassElement>(), | 24 classesNeedingRti = new Set<ClassElement>(), |
| 25 rtiDependencies = new Map<ClassElement, Set<ClassElement>>(), | 25 rtiDependencies = new Map<ClassElement, Set<ClassElement>>(), |
| 26 this.compiler = compiler; | 26 this.compiler = compiler; |
| 27 | 27 |
| 28 bool isUsedAsMixin(ClassElement cls) { |
| 29 Set<MixinApplicationElement> uses = mixinUses[cls]; |
| 30 return uses != null && !uses.isEmpty; |
| 31 } |
| 32 |
| 28 void populate() { | 33 void populate() { |
| 29 void addSubtypes(ClassElement cls) { | 34 void addSubtypes(ClassElement cls) { |
| 30 if (cls.resolutionState != STATE_DONE) { | 35 if (cls.resolutionState != STATE_DONE) { |
| 31 compiler.internalErrorOnElement( | 36 compiler.internalErrorOnElement( |
| 32 cls, 'Class "${cls.name.slowToString()}" is not resolved.'); | 37 cls, 'Class "${cls.name.slowToString()}" is not resolved.'); |
| 33 } | 38 } |
| 34 | 39 |
| 35 for (DartType type in cls.allSupertypes) { | 40 for (DartType type in cls.allSupertypes) { |
| 36 Set<Element> subtypesOfCls = | 41 Set<Element> subtypesOfCls = |
| 37 subtypes.putIfAbsent(type.element, () => new Set<ClassElement>()); | 42 subtypes.putIfAbsent(type.element, () => new Set<ClassElement>()); |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 final SourceString name; | 228 final SourceString name; |
| 224 | 229 |
| 225 MemberSet(SourceString this.name) : elements = new Set<Element>(); | 230 MemberSet(SourceString this.name) : elements = new Set<Element>(); |
| 226 | 231 |
| 227 void add(Element element) { | 232 void add(Element element) { |
| 228 elements.add(element); | 233 elements.add(element); |
| 229 } | 234 } |
| 230 | 235 |
| 231 bool get isEmpty => elements.isEmpty; | 236 bool get isEmpty => elements.isEmpty; |
| 232 } | 237 } |
| OLD | NEW |