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

Side by Side Diff: lib/compiler/implementation/world.dart

Issue 10537025: Prototype re-compiling methods in dart2js (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 class World { 5 class World {
6 final Map<ClassElement, Set<ClassElement>> subtypes; 6 final Map<ClassElement, Set<ClassElement>> subtypes;
7 final Map<ClassElement, Set<SourceString>> setters;
7 8
8 World() : subtypes = new Map<ClassElement, Set<ClassElement>>(); 9 World() : subtypes = new Map<ClassElement, Set<ClassElement>>(),
10 setters = new Map<ClassElement, Set<SourceString>>();
9 11
10 void populate(Compiler compiler, Collection<LibraryElement> libraries) { 12 void populate(Compiler compiler, Collection<LibraryElement> libraries) {
11 void addSubtypes(ClassElement cls) { 13 void addSubtypes(ClassElement cls) {
12 for (Type type in cls.allSupertypes) { 14 for (Type type in cls.allSupertypes) {
13 Set<Element> subtypesOfCls = subtypes.putIfAbsent( 15 Set<Element> subtypesOfCls = subtypes.putIfAbsent(
14 type.element, 16 type.element,
15 () => new Set<ClassElement>()); 17 () => new Set<ClassElement>());
16 subtypesOfCls.add(cls); 18 subtypesOfCls.add(cls);
17 } 19 }
18 } 20 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 memberSet.elements.forEach((Element element) { 64 memberSet.elements.forEach((Element element) {
63 if (element.isField()) { 65 if (element.isField()) {
64 field = element; 66 field = element;
65 fieldCount++; 67 fieldCount++;
66 } else { 68 } else {
67 nonFieldCount++; 69 nonFieldCount++;
68 } 70 }
69 }); 71 });
70 return (fieldCount == 1 && nonFieldCount == 0) ? field : null; 72 return (fieldCount == 1 && nonFieldCount == 0) ? field : null;
71 } 73 }
74
75 void setterUsed(Type type, SourceString member) {
76 Set<SourceString> setters =
Mads Ager (google) 2012/06/07 07:56:21 I find the name clash cofusing here. Call this set
Søren Gjesse 2012/06/07 08:06:12 Done.
77 setters.putIfAbsent(type.element, () => new Set<SourceString>());
78 setters.add(member);
79 }
80
81 bool isSetterUsed(Type type, SourceString member) {
82 Set<SourceString> setters = setters[type.element];
Mads Ager (google) 2012/06/07 07:56:21 Ditto.
Søren Gjesse 2012/06/07 08:06:12 Done.
83 if (setters === null) return false;
84 return setters.contains(member);
85 }
72 } 86 }
73 87
74 /** 88 /**
75 * A [MemberSet] contains all the possible targets for a selector. 89 * A [MemberSet] contains all the possible targets for a selector.
76 */ 90 */
77 class MemberSet { 91 class MemberSet {
78 final Set<Element> elements; 92 final Set<Element> elements;
79 final SourceString name; 93 final SourceString name;
80 94
81 MemberSet(SourceString this.name) : elements = new Set<Element>(); 95 MemberSet(SourceString this.name) : elements = new Set<Element>();
82 96
83 void add(Element element) { 97 void add(Element element) {
84 elements.add(element); 98 elements.add(element);
85 } 99 }
86 100
87 bool isEmpty() => elements.isEmpty(); 101 bool isEmpty() => elements.isEmpty();
102
103 String toString() {
104 StringBuffer sb = new StringBuffer();
105 sb.add("MemberSet: {");
106 elements.every((Element element) => sb.add("${element.name}, "));
107 sb.add("}");
108 return sb.toString();
109 }
88 } 110 }
OLDNEW
« lib/compiler/implementation/enqueue.dart ('K') | « lib/compiler/implementation/universe.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698