Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Unified Diff: pkg/compiler/lib/src/universe/function_set.dart

Issue 2969993002: Handle instance/super methods in js_model/model_test (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 2260ed88e391809d7fbb836a9e2b7d074992234d..b36729d9cd7eb08bd2800229e51fce9e59e1176f 100644
--- a/pkg/compiler/lib/src/universe/function_set.dart
+++ b/pkg/compiler/lib/src/universe/function_set.dart
@@ -12,41 +12,22 @@ import '../world.dart' show ClosedWorld;
import 'selector.dart' show Selector;
import 'world_builder.dart' show ReceiverConstraint;
-class FunctionSetBuilder {
- final Map<String, FunctionSetNode> nodes = new Map<String, FunctionSetNode>();
-
- FunctionSetNode newNode(String name) => new FunctionSetNode(name);
-
- void add(MemberEntity element) {
- assert(element.isInstanceMember);
- assert(!element.isAbstract);
- String name = element.name;
- FunctionSetNode node = nodes.putIfAbsent(name, () => newNode(name));
- node.add(element);
- }
-
- void remove(MemberEntity element) {
- assert(element.isInstanceMember);
- assert(!element.isAbstract);
- String name = element.name;
- FunctionSetNode node = nodes[name];
- if (node != null) {
- node.remove(element);
- }
- }
-
- FunctionSet close() {
- return new FunctionSet(nodes);
- }
-}
-
// TODO(kasperl): This actually holds getters and setters just fine
// too and stricly they aren't functions. Maybe this needs a better
// name -- something like ElementSet seems a bit too generic.
class FunctionSet {
final Map<String, FunctionSetNode> _nodes;
- FunctionSet(this._nodes);
+ factory FunctionSet(Iterable<MemberEntity> liveInstanceMembers) {
+ Map<String, FunctionSetNode> nodes = new Map<String, FunctionSetNode>();
+ for (MemberEntity member in liveInstanceMembers) {
+ String name = member.name;
+ nodes.putIfAbsent(name, () => new FunctionSetNode(name)).add(member);
+ }
+ return new FunctionSet.internal(nodes);
+ }
+
+ FunctionSet.internal(this._nodes);
bool contains(MemberEntity element) {
assert(element.isInstanceMember);

Powered by Google App Engine
This is Rietveld 408576698