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

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

Issue 1172693003: Move computeType to TypedElement and TypeDeclarationElement. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | pkg/compiler/lib/src/elements/modelx.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 library elements; 5 library elements;
6 6
7 7
8 import '../constants/expressions.dart'; 8 import '../constants/expressions.dart';
9 import '../tree/tree.dart'; 9 import '../tree/tree.dart';
10 import '../util/util.dart'; 10 import '../util/util.dart';
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 * reuse elements between compilations. So to keep things simple, it 182 * reuse elements between compilations. So to keep things simple, it
183 * is best if the backends avoid setting state directly in elements. 183 * is best if the backends avoid setting state directly in elements.
184 * It is better to keep such state in a table on the side. 184 * It is better to keep such state in a table on the side.
185 */ 185 */
186 abstract class Element implements Entity { 186 abstract class Element implements Entity {
187 String get name; 187 String get name;
188 ElementKind get kind; 188 ElementKind get kind;
189 Element get enclosingElement; 189 Element get enclosingElement;
190 Link<MetadataAnnotation> get metadata; 190 Link<MetadataAnnotation> get metadata;
191 191
192 /// Do not use [computeType] outside of the resolver; instead retrieve the
193 /// type from the corresponding field:
194 /// - `type` for fields, variables, type variable, and function elements.
195 /// - `thisType` or `rawType` for [TypeDeclarationElement]s (classes and
196 /// typedefs), depending on the use case.
197 /// Trying to access a type that has not been computed in resolution is an
198 /// error and calling [computeType] covers that error.
199 /// This method will go away!
200 @deprecated DartType computeType(Compiler compiler);
201
202 /// `true` if this element is a library. 192 /// `true` if this element is a library.
203 bool get isLibrary; 193 bool get isLibrary;
204 194
205 /// `true` if this element is a compilation unit. 195 /// `true` if this element is a compilation unit.
206 bool get isCompilationUnit; 196 bool get isCompilationUnit;
207 197
208 /// `true` if this element is defines the scope of prefix used by one or 198 /// `true` if this element is defines the scope of prefix used by one or
209 /// more import declarations. 199 /// more import declarations.
210 bool get isPrefix; 200 bool get isPrefix;
211 201
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after
1083 } 1073 }
1084 1074
1085 /** 1075 /**
1086 * A synthetic element which holds a getter and/or a setter. 1076 * A synthetic element which holds a getter and/or a setter.
1087 * 1077 *
1088 * This element unifies handling of fields and getters/setters. When 1078 * This element unifies handling of fields and getters/setters. When
1089 * looking at code like "foo.x", we don't have to look for both a 1079 * looking at code like "foo.x", we don't have to look for both a
1090 * field named "x", a getter named "x", and a setter named "x=". 1080 * field named "x", a getter named "x", and a setter named "x=".
1091 */ 1081 */
1092 abstract class AbstractFieldElement extends Element { 1082 abstract class AbstractFieldElement extends Element {
1093 FunctionElement get getter; 1083 GetterElement get getter;
1094 FunctionElement get setter; 1084 SetterElement get setter;
1095 } 1085 }
1096 1086
1097 abstract class FunctionSignature { 1087 abstract class FunctionSignature {
1098 FunctionType get type; 1088 FunctionType get type;
1099 List<FormalElement> get requiredParameters; 1089 List<FormalElement> get requiredParameters;
1100 List<FormalElement> get optionalParameters; 1090 List<FormalElement> get optionalParameters;
1101 1091
1102 int get requiredParameterCount; 1092 int get requiredParameterCount;
1103 int get optionalParameterCount; 1093 int get optionalParameterCount;
1104 bool get optionalParametersAreNamed; 1094 bool get optionalParametersAreNamed;
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1285 1275
1286 /// JavaScript backend specific element for the body of constructor. 1276 /// JavaScript backend specific element for the body of constructor.
1287 // TODO(johnniwinther): Remove this class from the element model. 1277 // TODO(johnniwinther): Remove this class from the element model.
1288 abstract class ConstructorBodyElement extends MethodElement { 1278 abstract class ConstructorBodyElement extends MethodElement {
1289 FunctionElement get constructor; 1279 FunctionElement get constructor;
1290 } 1280 }
1291 1281
1292 /// [TypeDeclarationElement] defines the common interface for class/interface 1282 /// [TypeDeclarationElement] defines the common interface for class/interface
1293 /// declarations and typedefs. 1283 /// declarations and typedefs.
1294 abstract class TypeDeclarationElement extends Element implements AstElement { 1284 abstract class TypeDeclarationElement extends Element implements AstElement {
1285 /// Do not use [computeType] outside of the resolver; instead retrieve the
1286 /// type from the [thisType] or [rawType], depending on the use case.
1287 ///
1288 /// Trying to access a type that has not been computed in resolution is an
1289 /// error and calling [computeType] covers that error.
1290 /// This method will go away!
1291 @deprecated
1292 GenericType computeType(Compiler compiler);
1293
1295 /** 1294 /**
1296 * The `this type` for this type declaration. 1295 * The `this type` for this type declaration.
1297 * 1296 *
1298 * The type of [:this:] is the generic type based on this element in which 1297 * The type of [:this:] is the generic type based on this element in which
1299 * the type arguments are the declared type variables. For instance, 1298 * the type arguments are the declared type variables. For instance,
1300 * [:List<E>:] for [:List:] and [:Map<K,V>:] for [:Map:]. 1299 * [:List<E>:] for [:List:] and [:Map<K,V>:] for [:Map:].
1301 * 1300 *
1302 * For a class declaration this is the type of [:this:]. 1301 * For a class declaration this is the type of [:this:].
1303 */ 1302 */
1304 GenericType get thisType; 1303 GenericType get thisType;
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
1517 Token get endToken; 1516 Token get endToken;
1518 1517
1519 bool get hasNode; 1518 bool get hasNode;
1520 Node get node; 1519 Node get node;
1521 1520
1522 MetadataAnnotation ensureResolved(Compiler compiler); 1521 MetadataAnnotation ensureResolved(Compiler compiler);
1523 } 1522 }
1524 1523
1525 /// An [Element] that has a type. 1524 /// An [Element] that has a type.
1526 abstract class TypedElement extends Element { 1525 abstract class TypedElement extends Element {
1526 /// Do not use [computeType] outside of the resolver; instead retrieve the
1527 /// type from [type] property.
1528 ///
1529 /// Trying to access a type that has not been computed in resolution is an
1530 /// error and calling [computeType] covers that error.
1531 /// This method will go away!
1532 @deprecated
1533 DartType computeType(Compiler compiler);
1534
1527 DartType get type; 1535 DartType get type;
1528 } 1536 }
1529 1537
1530 /// An [Element] that can define a function type. 1538 /// An [Element] that can define a function type.
1531 abstract class FunctionTypedElement extends Element { 1539 abstract class FunctionTypedElement extends Element {
1532 /// The function signature for the function type defined by this element, 1540 /// The function signature for the function type defined by this element,
1533 /// if any. 1541 /// if any.
1534 FunctionSignature get functionSignature; 1542 FunctionSignature get functionSignature;
1535 } 1543 }
1536 1544
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1644 bool get isDeclaredByField; 1652 bool get isDeclaredByField;
1645 1653
1646 /// Returns `true` if this member is abstract. 1654 /// Returns `true` if this member is abstract.
1647 bool get isAbstract; 1655 bool get isAbstract;
1648 1656
1649 /// If abstract, [implementation] points to the overridden concrete member, 1657 /// If abstract, [implementation] points to the overridden concrete member,
1650 /// if any. Otherwise [implementation] points to the member itself. 1658 /// if any. Otherwise [implementation] points to the member itself.
1651 Member get implementation; 1659 Member get implementation;
1652 } 1660 }
1653 1661
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/elements/modelx.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698