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

Side by Side Diff: pkg/compiler/lib/src/resolution/resolution.dart

Issue 2653203002: Use entities in CommonElements interface. (Closed)
Patch Set: Created 3 years, 10 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
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 library dart2js.resolution; 5 library dart2js.resolution;
6 6
7 import 'dart:collection' show Queue; 7 import 'dart:collection' show Queue;
8 8
9 import '../common.dart'; 9 import '../common.dart';
10 import '../common/names.dart' show Identifiers; 10 import '../common/names.dart' show Identifiers;
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 {'modifier': element.asyncMarker}); 177 {'modifier': element.asyncMarker});
178 } 178 }
179 if (functionExpression.body.asReturn() != null && 179 if (functionExpression.body.asReturn() != null &&
180 element.asyncMarker.isYielding) { 180 element.asyncMarker.isYielding) {
181 reporter.reportErrorMessage( 181 reporter.reportErrorMessage(
182 asyncModifier, 182 asyncModifier,
183 MessageKind.YIELDING_MODIFIER_ON_ARROW_BODY, 183 MessageKind.YIELDING_MODIFIER_ON_ARROW_BODY,
184 {'modifier': element.asyncMarker}); 184 {'modifier': element.asyncMarker});
185 } 185 }
186 } 186 }
187 ClassElement cls;
187 switch (element.asyncMarker) { 188 switch (element.asyncMarker) {
188 case AsyncMarker.ASYNC: 189 case AsyncMarker.ASYNC:
189 registry.registerFeature(Feature.ASYNC); 190 registry.registerFeature(Feature.ASYNC);
190 commonElements.futureClass.ensureResolved(resolution); 191 cls = commonElements.futureClass;
191 break; 192 break;
192 case AsyncMarker.ASYNC_STAR: 193 case AsyncMarker.ASYNC_STAR:
193 registry.registerFeature(Feature.ASYNC_STAR); 194 registry.registerFeature(Feature.ASYNC_STAR);
194 commonElements.streamClass.ensureResolved(resolution); 195 cls = commonElements.streamClass;
195 break; 196 break;
196 case AsyncMarker.SYNC_STAR: 197 case AsyncMarker.SYNC_STAR:
197 registry.registerFeature(Feature.SYNC_STAR); 198 registry.registerFeature(Feature.SYNC_STAR);
198 commonElements.iterableClass.ensureResolved(resolution); 199 cls = commonElements.iterableClass;
199 break; 200 break;
200 } 201 }
202 cls?.ensureResolved(resolution);
201 } 203 }
202 } 204 }
203 } 205 }
204 206
205 bool _isNativeClassOrExtendsNativeClass(ClassElement classElement) { 207 bool _isNativeClassOrExtendsNativeClass(ClassElement classElement) {
206 assert(classElement != null); 208 assert(classElement != null);
207 while (classElement != null) { 209 while (classElement != null) {
208 if (target.isNative(classElement)) return true; 210 if (target.isNative(classElement)) return true;
209 classElement = classElement.superclass; 211 classElement = classElement.superclass;
210 } 212 }
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 * called by [resolveClass] and [ClassSupertypeResolver]. 536 * called by [resolveClass] and [ClassSupertypeResolver].
535 */ 537 */
536 void loadSupertypes(BaseClassElementX cls, Spannable from) { 538 void loadSupertypes(BaseClassElementX cls, Spannable from) {
537 measure(() { 539 measure(() {
538 if (cls.supertypeLoadState == STATE_DONE) return; 540 if (cls.supertypeLoadState == STATE_DONE) return;
539 if (cls.supertypeLoadState == STATE_STARTED) { 541 if (cls.supertypeLoadState == STATE_STARTED) {
540 reporter.reportErrorMessage( 542 reporter.reportErrorMessage(
541 from, MessageKind.CYCLIC_CLASS_HIERARCHY, {'className': cls.name}); 543 from, MessageKind.CYCLIC_CLASS_HIERARCHY, {'className': cls.name});
542 cls.supertypeLoadState = STATE_DONE; 544 cls.supertypeLoadState = STATE_DONE;
543 cls.hasIncompleteHierarchy = true; 545 cls.hasIncompleteHierarchy = true;
544 cls.allSupertypesAndSelf = commonElements 546 ClassElement objectClass = commonElements.objectClass;
545 .objectClass.allSupertypesAndSelf 547 cls.allSupertypesAndSelf = objectClass.allSupertypesAndSelf
546 .extendClass(cls.computeType(resolution)); 548 .extendClass(cls.computeType(resolution));
547 cls.supertype = cls.allSupertypes.head; 549 cls.supertype = cls.allSupertypes.head;
548 assert(invariant(from, cls.supertype != null, 550 assert(invariant(from, cls.supertype != null,
549 message: 'Missing supertype on cyclic class $cls.')); 551 message: 'Missing supertype on cyclic class $cls.'));
550 cls.interfaces = const Link<ResolutionDartType>(); 552 cls.interfaces = const Link<ResolutionDartType>();
551 return; 553 return;
552 } 554 }
553 cls.supertypeLoadState = STATE_STARTED; 555 cls.supertypeLoadState = STATE_STARTED;
554 reporter.withCurrentElement(cls, () { 556 reporter.withCurrentElement(cls, () {
555 // TODO(ahe): Cache the node in cls. 557 // TODO(ahe): Cache the node in cls.
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 TreeElements get treeElements { 1140 TreeElements get treeElements {
1139 assert(invariant(this, _treeElements != null, 1141 assert(invariant(this, _treeElements != null,
1140 message: "TreeElements have not been computed for $this.")); 1142 message: "TreeElements have not been computed for $this."));
1141 return _treeElements; 1143 return _treeElements;
1142 } 1144 }
1143 1145
1144 void reuseElement() { 1146 void reuseElement() {
1145 _treeElements = null; 1147 _treeElements = null;
1146 } 1148 }
1147 } 1149 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/resolution/members.dart ('k') | pkg/compiler/lib/src/resolution/signatures.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698