| 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 library universe.function_set; | 5 library universe.function_set; |
| 6 | 6 |
| 7 import '../common/names.dart' show Identifiers, Selectors; | 7 import '../common/names.dart' show Identifiers, Selectors; |
| 8 import '../compiler.dart' show Compiler; | 8 import '../compiler.dart' show Compiler; |
| 9 import '../elements/elements.dart'; | 9 import '../elements/elements.dart'; |
| 10 import '../types/types.dart'; | 10 import '../types/types.dart'; |
| 11 import '../util/util.dart' show Hashing, Setlet; | 11 import '../util/util.dart' show Hashing, Setlet; |
| 12 import '../world.dart' show ClosedWorld; | 12 import '../world.dart' show ClosedWorld; |
| 13 import 'selector.dart' show Selector; | 13 import 'selector.dart' show Selector; |
| 14 import 'world_builder.dart' show ReceiverConstraint; | 14 import 'world_builder.dart' show ReceiverConstraint; |
| 15 | 15 |
| 16 // TODO(kasperl): This actually holds getters and setters just fine | 16 // TODO(kasperl): This actually holds getters and setters just fine |
| 17 // too and stricly they aren't functions. Maybe this needs a better | 17 // too and stricly they aren't functions. Maybe this needs a better |
| 18 // name -- something like ElementSet seems a bit too generic. | 18 // name -- something like ElementSet seems a bit too generic. |
| 19 class FunctionSet { | 19 class FunctionSet { |
| 20 final Compiler compiler; | 20 final ClosedWorld closedWorld; |
| 21 final Map<String, FunctionSetNode> nodes = new Map<String, FunctionSetNode>(); | 21 final Map<String, FunctionSetNode> nodes = new Map<String, FunctionSetNode>(); |
| 22 FunctionSet(this.compiler); | 22 FunctionSet(this.closedWorld); |
| 23 | |
| 24 ClosedWorld get closedWorld => compiler.closedWorld; | |
| 25 | 23 |
| 26 FunctionSetNode newNode(String name) => new FunctionSetNode(name); | 24 FunctionSetNode newNode(String name) => new FunctionSetNode(name); |
| 27 | 25 |
| 28 void add(Element element) { | 26 void add(Element element) { |
| 29 assert(element.isInstanceMember); | 27 assert(element.isInstanceMember); |
| 30 assert(!element.isAbstract); | 28 assert(!element.isAbstract); |
| 31 String name = element.name; | 29 String name = element.name; |
| 32 FunctionSetNode node = nodes.putIfAbsent(name, () => newNode(name)); | 30 FunctionSetNode node = nodes.putIfAbsent(name, () => newNode(name)); |
| 33 node.add(element); | 31 node.add(element); |
| 34 } | 32 } |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 } else if (closedWorld.isInstantiated(cls.declaration)) { | 292 } else if (closedWorld.isInstantiated(cls.declaration)) { |
| 295 return new TypeMask.nonNullSubclass(cls.declaration, closedWorld); | 293 return new TypeMask.nonNullSubclass(cls.declaration, closedWorld); |
| 296 } else { | 294 } else { |
| 297 // TODO(johnniwinther): Avoid the need for this case. | 295 // TODO(johnniwinther): Avoid the need for this case. |
| 298 return const TypeMask.empty(); | 296 return const TypeMask.empty(); |
| 299 } | 297 } |
| 300 }), | 298 }), |
| 301 closedWorld); | 299 closedWorld); |
| 302 } | 300 } |
| 303 } | 301 } |
| OLD | NEW |