| 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 universe; | 5 part of universe; |
| 6 | 6 |
| 7 // TODO(kasperl): This actually holds getters and setters just fine | 7 // TODO(kasperl): This actually holds getters and setters just fine |
| 8 // too and stricly they aren't functions. Maybe this needs a better | 8 // too and stricly they aren't functions. Maybe this needs a better |
| 9 // name -- something like ElementSet seems a bit too generic. | 9 // name -- something like ElementSet seems a bit too generic. |
| 10 class FunctionSet { | 10 class FunctionSet { |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 const FunctionSetQuery(this.functions); | 236 const FunctionSetQuery(this.functions); |
| 237 } | 237 } |
| 238 | 238 |
| 239 class FullFunctionSetQuery extends FunctionSetQuery { | 239 class FullFunctionSetQuery extends FunctionSetQuery { |
| 240 TypeMask _mask; | 240 TypeMask _mask; |
| 241 | 241 |
| 242 /** | 242 /** |
| 243 * Compute the type of all potential receivers of this function set. | 243 * Compute the type of all potential receivers of this function set. |
| 244 */ | 244 */ |
| 245 TypeMask computeMask(ClassWorld classWorld) { | 245 TypeMask computeMask(ClassWorld classWorld) { |
| 246 assert(classWorld.hasAnySubclass(classWorld.objectClass)); | 246 assert(classWorld.hasAnyStrictSubclass(classWorld.objectClass)); |
| 247 if (_mask != null) return _mask; | 247 if (_mask != null) return _mask; |
| 248 return _mask = new TypeMask.unionOf(functions | 248 return _mask = new TypeMask.unionOf(functions |
| 249 .expand((element) { | 249 .expand((element) { |
| 250 ClassElement cls = element.enclosingClass; | 250 ClassElement cls = element.enclosingClass; |
| 251 return [cls]..addAll(classWorld.mixinUsesOf(cls)); | 251 return [cls]..addAll(classWorld.mixinUsesOf(cls)); |
| 252 }) | 252 }) |
| 253 .map((cls) { | 253 .map((cls) { |
| 254 if (classWorld.backend.isNullImplementation(cls)) { | 254 if (classWorld.backend.isNullImplementation(cls)) { |
| 255 return const TypeMask.empty(); | 255 return const TypeMask.empty(); |
| 256 } else { | 256 } else { |
| 257 return new TypeMask.nonNullSubclass(cls.declaration, classWorld); | 257 return new TypeMask.nonNullSubclass(cls.declaration, classWorld); |
| 258 } | 258 } |
| 259 }), | 259 }), |
| 260 classWorld); | 260 classWorld); |
| 261 } | 261 } |
| 262 | 262 |
| 263 FullFunctionSetQuery(functions) : super(functions); | 263 FullFunctionSetQuery(functions) : super(functions); |
| 264 } | 264 } |
| OLD | NEW |