Index: pkg/compiler/lib/src/universe/function_set.dart |
diff --git a/pkg/compiler/lib/src/universe/function_set.dart b/pkg/compiler/lib/src/universe/function_set.dart |
index 6b8a2d11913a7bbfb3f97442ee29c44c214be3d9..c34ae918f289ad8331bd192595344836b82592a5 100644 |
--- a/pkg/compiler/lib/src/universe/function_set.dart |
+++ b/pkg/compiler/lib/src/universe/function_set.dart |
@@ -9,7 +9,7 @@ import '../compiler.dart' show Compiler; |
import '../elements/elements.dart'; |
import '../types/types.dart'; |
import '../util/util.dart' show Hashing, Setlet; |
-import '../world.dart' show ClassWorld; |
+import '../world.dart' show ClosedWorld; |
import 'selector.dart' show Selector; |
import 'universe.dart' show ReceiverConstraint; |
@@ -21,7 +21,7 @@ class FunctionSet { |
final Map<String, FunctionSetNode> nodes = new Map<String, FunctionSetNode>(); |
FunctionSet(this.compiler); |
- ClassWorld get classWorld => compiler.closedWorld; |
+ ClosedWorld get closedWorld => compiler.closedWorld; |
FunctionSetNode newNode(String name) => new FunctionSetNode(name); |
@@ -64,17 +64,17 @@ class FunctionSet { |
/// set of classes that actually implement the selected member or implement |
/// the handling 'noSuchMethod' where the selected member is unimplemented. |
TypeMask receiverType(Selector selector, ReceiverConstraint constraint) { |
- return query(selector, constraint).computeMask(classWorld); |
+ return query(selector, constraint).computeMask(closedWorld); |
} |
- SelectorMask _createSelectorMask( |
- Selector selector, ReceiverConstraint constraint, ClassWorld classWorld) { |
+ SelectorMask _createSelectorMask(Selector selector, |
+ ReceiverConstraint constraint, ClosedWorld closedWorld) { |
return constraint != null |
? new SelectorMask(selector, constraint) |
: new SelectorMask( |
selector, |
new TypeMask.subclass( |
- classWorld.coreClasses.objectClass, classWorld)); |
+ closedWorld.coreClasses.objectClass, closedWorld)); |
} |
/// Returns the set of functions that can be the target of a call to |
@@ -83,21 +83,21 @@ class FunctionSet { |
FunctionSetQuery query(Selector selector, ReceiverConstraint constraint) { |
String name = selector.name; |
SelectorMask selectorMask = |
- _createSelectorMask(selector, constraint, classWorld); |
+ _createSelectorMask(selector, constraint, closedWorld); |
SelectorMask noSuchMethodMask = |
new SelectorMask(Selectors.noSuchMethod_, selectorMask.constraint); |
FunctionSetNode node = nodes[name]; |
FunctionSetNode noSuchMethods = nodes[Identifiers.noSuchMethod_]; |
if (node != null) { |
return node.query( |
- selectorMask, classWorld, noSuchMethods, noSuchMethodMask); |
+ selectorMask, closedWorld, noSuchMethods, noSuchMethodMask); |
} |
// If there is no method that matches [selector] we know we can |
// only hit [:noSuchMethod:]. |
if (noSuchMethods == null) { |
return const EmptyFunctionSetQuery(); |
} |
- return noSuchMethods.query(noSuchMethodMask, classWorld); |
+ return noSuchMethods.query(noSuchMethodMask, closedWorld); |
} |
void forEach(Function action) { |
@@ -124,13 +124,13 @@ class SelectorMask { |
String get name => selector.name; |
- bool applies(Element element, ClassWorld classWorld) { |
- if (!selector.appliesUnnamed(element, classWorld.backend)) return false; |
- return constraint.canHit(element, selector, classWorld); |
+ bool applies(Element element, ClosedWorld closedWorld) { |
+ if (!selector.appliesUnnamed(element, closedWorld.backend)) return false; |
+ return constraint.canHit(element, selector, closedWorld); |
} |
- bool needsNoSuchMethodHandling(ClassWorld classWorld) { |
- return constraint.needsNoSuchMethodHandling(selector, classWorld); |
+ bool needsNoSuchMethodHandling(ClosedWorld closedWorld) { |
+ return constraint.needsNoSuchMethodHandling(selector, closedWorld); |
} |
bool operator ==(other) { |
@@ -205,7 +205,7 @@ class FunctionSetNode { |
/// Returns the set of functions that can be the target of [selectorMask] |
/// including no such method handling where applicable. |
- FunctionSetQuery query(SelectorMask selectorMask, ClassWorld classWorld, |
+ FunctionSetQuery query(SelectorMask selectorMask, ClosedWorld closedWorld, |
[FunctionSetNode noSuchMethods, SelectorMask noSuchMethodMask]) { |
assert(selectorMask.name == name); |
FunctionSetQuery result = cache[selectorMask]; |
@@ -213,7 +213,7 @@ class FunctionSetNode { |
Setlet<Element> functions; |
for (Element element in elements) { |
- if (selectorMask.applies(element, classWorld)) { |
+ if (selectorMask.applies(element, closedWorld)) { |
if (functions == null) { |
// Defer the allocation of the functions set until we are |
// sure we need it. This allows us to return immutable empty |
@@ -228,9 +228,9 @@ class FunctionSetNode { |
// add [noSuchMethod] implementations that apply to [mask] as |
// potential targets. |
if (noSuchMethods != null && |
- selectorMask.needsNoSuchMethodHandling(classWorld)) { |
+ selectorMask.needsNoSuchMethodHandling(closedWorld)) { |
FunctionSetQuery noSuchMethodQuery = |
- noSuchMethods.query(noSuchMethodMask, classWorld); |
+ noSuchMethods.query(noSuchMethodMask, closedWorld); |
if (!noSuchMethodQuery.functions.isEmpty) { |
if (functions == null) { |
functions = new Setlet<Element>.from(noSuchMethodQuery.functions); |
@@ -252,7 +252,7 @@ abstract class FunctionSetQuery { |
const FunctionSetQuery(); |
/// Compute the type of all potential receivers of this function set. |
- TypeMask computeMask(ClassWorld classWorld); |
+ TypeMask computeMask(ClosedWorld closedWorld); |
/// Returns all potential targets of this function set. |
Iterable<Element> get functions; |
@@ -262,7 +262,8 @@ class EmptyFunctionSetQuery implements FunctionSetQuery { |
const EmptyFunctionSetQuery(); |
@override |
- TypeMask computeMask(ClassWorld classWorld) => const TypeMask.nonNullEmpty(); |
+ TypeMask computeMask(ClosedWorld closedWorld) => |
+ const TypeMask.nonNullEmpty(); |
@override |
Iterable<Element> get functions => const <Element>[]; |
@@ -277,23 +278,24 @@ class FullFunctionSetQuery implements FunctionSetQuery { |
FullFunctionSetQuery(this.functions); |
@override |
- TypeMask computeMask(ClassWorld classWorld) { |
- assert(classWorld.hasAnyStrictSubclass(classWorld.coreClasses.objectClass)); |
+ TypeMask computeMask(ClosedWorld closedWorld) { |
+ assert( |
+ closedWorld.hasAnyStrictSubclass(closedWorld.coreClasses.objectClass)); |
if (_mask != null) return _mask; |
return _mask = new TypeMask.unionOf( |
functions.expand((element) { |
ClassElement cls = element.enclosingClass; |
- return [cls]..addAll(classWorld.mixinUsesOf(cls)); |
+ return [cls]..addAll(closedWorld.mixinUsesOf(cls)); |
}).map((cls) { |
- if (classWorld.backend.isNullImplementation(cls)) { |
+ if (closedWorld.backend.isNullImplementation(cls)) { |
return const TypeMask.empty(); |
- } else if (classWorld.isInstantiated(cls.declaration)) { |
- return new TypeMask.nonNullSubclass(cls.declaration, classWorld); |
+ } else if (closedWorld.isInstantiated(cls.declaration)) { |
+ return new TypeMask.nonNullSubclass(cls.declaration, closedWorld); |
} else { |
// TODO(johnniwinther): Avoid the need for this case. |
return const TypeMask.empty(); |
} |
}), |
- classWorld); |
+ closedWorld); |
} |
} |