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

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

Issue 10905305: Patch refactoring. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Replaced includeInjectedMembers by implementation Created 8 years, 2 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 Compiler compiler; 6 final Compiler compiler;
7 final Map<ClassElement, Set<ClassElement>> subtypes; 7 final Map<ClassElement, Set<ClassElement>> subtypes;
8 final Set<ClassElement> classesNeedingRti; 8 final Set<ClassElement> classesNeedingRti;
9 final Map<ClassElement, Set<ClassElement>> rtiDependencies; 9 final Map<ClassElement, Set<ClassElement>> rtiDependencies;
10 final FunctionSet userDefinedGetters; 10 final FunctionSet userDefinedGetters;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 * Returns a [MemberSet] that contains the possible targets of the given 105 * Returns a [MemberSet] that contains the possible targets of the given
106 * [selector] on a receiver with the given [type]. This includes all sub 106 * [selector] on a receiver with the given [type]. This includes all sub
107 * types. 107 * types.
108 */ 108 */
109 MemberSet _memberSetFor(DartType type, Selector selector) { 109 MemberSet _memberSetFor(DartType type, Selector selector) {
110 assert(compiler !== null); 110 assert(compiler !== null);
111 ClassElement cls = type.element; 111 ClassElement cls = type.element;
112 SourceString name = selector.name; 112 SourceString name = selector.name;
113 LibraryElement library = selector.library; 113 LibraryElement library = selector.library;
114 MemberSet result = new MemberSet(name); 114 MemberSet result = new MemberSet(name);
115 Element element = cls.lookupSelector(selector); 115 Element element = cls.implementation.lookupSelector(selector);
116 if (element !== null) result.add(element); 116 if (element !== null) result.add(element);
117 117
118 bool isPrivate = name.isPrivate(); 118 bool isPrivate = name.isPrivate();
119 Set<ClassElement> subtypesOfCls = subtypes[cls]; 119 Set<ClassElement> subtypesOfCls = subtypes[cls];
120 if (subtypesOfCls !== null) { 120 if (subtypesOfCls !== null) {
121 for (ClassElement sub in subtypesOfCls) { 121 for (ClassElement sub in subtypesOfCls) {
122 // Private members from a different library are not visible. 122 // Private members from a different library are not visible.
123 if (isPrivate && sub.getLibrary() != library) continue; 123 if (isPrivate && sub.getLibrary() != library) continue;
124 element = sub.lookupLocalMember(name); 124 element = sub.implementation.lookupLocalMember(name);
125 if (element !== null) result.add(element); 125 if (element !== null) result.add(element);
126 } 126 }
127 } 127 }
128 return result; 128 return result;
129 } 129 }
130 130
131 /** 131 /**
132 * Returns the field in [type] described by the given [selector]. 132 * Returns the field in [type] described by the given [selector].
133 * If no such field exists, or a subclass overrides the field 133 * If no such field exists, or a subclass overrides the field
134 * returns [:null:]. 134 * returns [:null:].
135 */ 135 */
136 VariableElement locateSingleField(DartType type, Selector selector) { 136 VariableElement locateSingleField(DartType type, Selector selector) {
137 MemberSet memberSet = _memberSetFor(type, selector); 137 MemberSet memberSet = _memberSetFor(type, selector);
138 ClassElement cls = type.element; 138 ClassElement cls = type.element;
139 Element result = cls.lookupSelector(selector); 139 Element result = cls.implementation.lookupSelector(selector);
140 if (result == null) return null; 140 if (result == null) return null;
141 if (!result.isField()) return null; 141 if (!result.isField()) return null;
142 142
143 // Verify that no subclass overrides the field. 143 // Verify that no subclass overrides the field.
144 if (memberSet.elements.length != 1) return null; 144 if (memberSet.elements.length != 1) return null;
145 assert(memberSet.elements.contains(result)); 145 assert(memberSet.elements.contains(result));
146 return result; 146 return result;
147 } 147 }
148 148
149 Set<ClassElement> findNoSuchMethodHolders(DartType type) { 149 Set<ClassElement> findNoSuchMethodHolders(DartType type) {
(...skipping 19 matching lines...) Expand all
169 final SourceString name; 169 final SourceString name;
170 170
171 MemberSet(SourceString this.name) : elements = new Set<Element>(); 171 MemberSet(SourceString this.name) : elements = new Set<Element>();
172 172
173 void add(Element element) { 173 void add(Element element) {
174 elements.add(element); 174 elements.add(element);
175 } 175 }
176 176
177 bool isEmpty() => elements.isEmpty(); 177 bool isEmpty() => elements.isEmpty();
178 } 178 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698