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

Side by Side Diff: pkg/compiler/lib/src/universe/use.dart

Issue 1441853005: Revert "Register super field set explicitly in the universe." (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « pkg/compiler/lib/src/universe/universe.dart ('k') | pkg/compiler/lib/src/world.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 /// This library defined `uses`. A `use` is a single impact of the world, for 5 /// This library defined `uses`. A `use` is a single impact of the world, for
6 /// instance an invocation of a top level function or a call to the `foo()` 6 /// instance an invocation of a top level function or a call to the `foo()`
7 /// method on an unknown class. 7 /// method on an unknown class.
8 library dart2js.universe.use; 8 library dart2js.universe.use;
9 9
10 import '../closure.dart' show 10 import '../closure.dart' show
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 return selector == other.selector && mask == other.mask; 63 return selector == other.selector && mask == other.mask;
64 } 64 }
65 65
66 String toString() => '$selector,$mask'; 66 String toString() => '$selector,$mask';
67 } 67 }
68 68
69 enum StaticUseKind { 69 enum StaticUseKind {
70 GENERAL, 70 GENERAL,
71 STATIC_TEAR_OFF, 71 STATIC_TEAR_OFF,
72 SUPER_TEAR_OFF, 72 SUPER_TEAR_OFF,
73 SUPER_FIELD_SET,
74 FIELD_GET, 73 FIELD_GET,
75 FIELD_SET, 74 FIELD_SET,
76 CLOSURE, 75 CLOSURE,
77 } 76 }
78 77
79 /// Statically known use of an [Element]. 78 /// Statically known use of an [Element].
80 // TODO(johnniwinther): Create backend-specific implementations with better 79 // TODO(johnniwinther): Create backend-specific implementations with better
81 // invariants. 80 // invariants.
82 class StaticUse { 81 class StaticUse {
83 final Element element; 82 final Element element;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 153
155 /// Read access of a super field or getter [element]. 154 /// Read access of a super field or getter [element].
156 factory StaticUse.superGet(MemberElement element) { 155 factory StaticUse.superGet(MemberElement element) {
157 assert(invariant(element, element.isInstanceMember, 156 assert(invariant(element, element.isInstanceMember,
158 message: "Super get element $element must be an instance method.")); 157 message: "Super get element $element must be an instance method."));
159 assert(invariant(element, element.isField || element.isGetter, 158 assert(invariant(element, element.isField || element.isGetter,
160 message: "Super get element $element must be a field or a getter.")); 159 message: "Super get element $element must be a field or a getter."));
161 return new StaticUse._(element, StaticUseKind.GENERAL); 160 return new StaticUse._(element, StaticUseKind.GENERAL);
162 } 161 }
163 162
164 /// Write access of a super field [element]. 163 /// Write access of a super field or setter [element].
165 factory StaticUse.superFieldSet(FieldElement element) { 164 factory StaticUse.superSet(Element element) {
166 assert(invariant(element, element.isInstanceMember, 165 assert(invariant(element, element.isInstanceMember,
167 message: "Super set element $element must be an instance method.")); 166 message: "Super set element $element must be an instance method."));
168 assert(invariant(element, element.isField, 167 assert(invariant(element, element.isField || element.isSetter,
169 message: "Super set element $element must be a field.")); 168 message: "Super set element $element must be a field or a setter."));
170 return new StaticUse._(element, StaticUseKind.SUPER_FIELD_SET);
171 }
172
173 /// Write access of a super setter [element].
174 factory StaticUse.superSetterSet(SetterElement element) {
175 assert(invariant(element, element.isInstanceMember,
176 message: "Super set element $element must be an instance method."));
177 assert(invariant(element, element.isSetter,
178 message: "Super set element $element must be a setter."));
179 return new StaticUse._(element, StaticUseKind.GENERAL); 169 return new StaticUse._(element, StaticUseKind.GENERAL);
180 } 170 }
181 171
182 /// Closurization of a super method [element]. 172 /// Closurization of a super method [element].
183 factory StaticUse.superTearOff(MethodElement element) { 173 factory StaticUse.superTearOff(MethodElement element) {
184 assert(invariant(element, element.isInstanceMember && element.isFunction, 174 assert(invariant(element, element.isInstanceMember && element.isFunction,
185 message: "Super invoke element $element must be an instance method.")); 175 message: "Super invoke element $element must be an instance method."));
186 return new StaticUse._(element, StaticUseKind.SUPER_TEAR_OFF); 176 return new StaticUse._(element, StaticUseKind.SUPER_TEAR_OFF);
187 } 177 }
188 178
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 306
317 bool operator ==(other) { 307 bool operator ==(other) {
318 if (identical(this, other)) return true; 308 if (identical(this, other)) return true;
319 if (other is! TypeUse) return false; 309 if (other is! TypeUse) return false;
320 return type == other.type && 310 return type == other.type &&
321 kind == other.kind; 311 kind == other.kind;
322 } 312 }
323 313
324 String toString() => 'TypeUse($type,$kind)'; 314 String toString() => 'TypeUse($type,$kind)';
325 } 315 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/universe/universe.dart ('k') | pkg/compiler/lib/src/world.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698