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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/elements/modelx.dart

Issue 141753002: Reapply "Implement new model for class members." and "Implement new model for interface members." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix dart2dart bug. Created 6 years, 11 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 elements.modelx; 5 library elements.modelx;
6 6
7 import 'elements.dart'; 7 import 'elements.dart';
8 import '../../compiler.dart' as api; 8 import '../../compiler.dart' as api;
9 import '../tree/tree.dart'; 9 import '../tree/tree.dart';
10 import '../util/util.dart'; 10 import '../util/util.dart';
(...skipping 1749 matching lines...) Expand 10 before | Expand all | Expand 10 after
1760 * This type is computed together with [thisType] in [computeType]. 1760 * This type is computed together with [thisType] in [computeType].
1761 */ 1761 */
1762 InterfaceType rawTypeCache; 1762 InterfaceType rawTypeCache;
1763 DartType supertype; 1763 DartType supertype;
1764 Link<DartType> interfaces; 1764 Link<DartType> interfaces;
1765 String nativeTagInfo; 1765 String nativeTagInfo;
1766 int supertypeLoadState; 1766 int supertypeLoadState;
1767 int resolutionState; 1767 int resolutionState;
1768 bool get isResolved => resolutionState == STATE_DONE; 1768 bool get isResolved => resolutionState == STATE_DONE;
1769 bool isProxy = false; 1769 bool isProxy = false;
1770 bool hasIncompleteHierarchy = false;
1770 1771
1771 // backendMembers are members that have been added by the backend to simplify 1772 // backendMembers are members that have been added by the backend to simplify
1772 // compilation. They don't have any user-side counter-part. 1773 // compilation. They don't have any user-side counter-part.
1773 Link<Element> backendMembers = const Link<Element>(); 1774 Link<Element> backendMembers = const Link<Element>();
1774 1775
1775 OrderedTypeSet allSupertypesAndSelf; 1776 OrderedTypeSet allSupertypesAndSelf;
1776 1777
1777 Link<DartType> get allSupertypes => allSupertypesAndSelf.supertypes; 1778 Link<DartType> get allSupertypes => allSupertypesAndSelf.supertypes;
1778 1779
1779 int get hierarchyDepth => allSupertypesAndSelf.maxDepth; 1780 int get hierarchyDepth => allSupertypesAndSelf.maxDepth;
1780 1781
1782 Map<Name, Member> classMembers;
1783 Map<Name, MemberSignature> interfaceMembers;
1784
1781 BaseClassElementX(String name, 1785 BaseClassElementX(String name,
1782 Element enclosing, 1786 Element enclosing,
1783 this.id, 1787 this.id,
1784 int initialState) 1788 int initialState)
1785 : supertypeLoadState = initialState, 1789 : supertypeLoadState = initialState,
1786 resolutionState = initialState, 1790 resolutionState = initialState,
1787 super(name, ElementKind.CLASS, enclosing); 1791 super(name, ElementKind.CLASS, enclosing);
1788 1792
1789 int get hashCode => id; 1793 int get hashCode => id;
1790 ClassElement get patch => super.patch; 1794 ClassElement get patch => super.patch;
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
2144 for (ClassElement s = declaration; s != null; s = s.superclass) { 2148 for (ClassElement s = declaration; s != null; s = s.superclass) {
2145 if (identical(s, cls)) return true; 2149 if (identical(s, cls)) return true;
2146 } 2150 }
2147 return false; 2151 return false;
2148 } 2152 }
2149 2153
2150 bool isNative() => nativeTagInfo != null; 2154 bool isNative() => nativeTagInfo != null;
2151 void setNative(String name) { 2155 void setNative(String name) {
2152 nativeTagInfo = name; 2156 nativeTagInfo = name;
2153 } 2157 }
2158
2159 Member lookupClassMember(Name name) => classMembers[name];
2160
2161 void forEachClassMember(f(Member member)) {
2162 classMembers.forEach((_, member) => f(member));
2163 }
2164
2165 MemberSignature lookupInterfaceMember(Name name) => interfaceMembers[name];
2166
2167 void forEachInterfaceMember(f(MemberSignature member)) {
2168 interfaceMembers.forEach((_, member) => f(member));
2169 }
2154 } 2170 }
2155 2171
2156 abstract class ClassElementX extends BaseClassElementX { 2172 abstract class ClassElementX extends BaseClassElementX {
2157 // Lazily applied patch of class members. 2173 // Lazily applied patch of class members.
2158 ClassElement patch = null; 2174 ClassElement patch = null;
2159 ClassElement origin = null; 2175 ClassElement origin = null;
2160 2176
2161 Link<Element> localMembers = const Link<Element>(); 2177 Link<Element> localMembers = const Link<Element>();
2162 final ScopeX localScope = new ScopeX(); 2178 final ScopeX localScope = new ScopeX();
2163 2179
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
2448 2464
2449 MetadataAnnotation ensureResolved(Compiler compiler) { 2465 MetadataAnnotation ensureResolved(Compiler compiler) {
2450 if (resolutionState == STATE_NOT_STARTED) { 2466 if (resolutionState == STATE_NOT_STARTED) {
2451 compiler.resolver.resolveMetadataAnnotation(this); 2467 compiler.resolver.resolveMetadataAnnotation(this);
2452 } 2468 }
2453 return this; 2469 return this;
2454 } 2470 }
2455 2471
2456 String toString() => 'MetadataAnnotation($value, $resolutionState)'; 2472 String toString() => 'MetadataAnnotation($value, $resolutionState)';
2457 } 2473 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698