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

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

Issue 1915123008: Implements support for ignoring method type arguments in resolution. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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 elements; 5 library elements;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../common/resolution.dart' show Resolution; 8 import '../common/resolution.dart' show Resolution;
9 import '../compiler.dart' show Compiler; 9 import '../compiler.dart' show Compiler;
10 import '../constants/constructors.dart'; 10 import '../constants/constructors.dart';
(...skipping 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after
1093 * looking at code like "foo.x", we don't have to look for both a 1093 * looking at code like "foo.x", we don't have to look for both a
1094 * field named "x", a getter named "x", and a setter named "x=". 1094 * field named "x", a getter named "x", and a setter named "x=".
1095 */ 1095 */
1096 abstract class AbstractFieldElement extends Element { 1096 abstract class AbstractFieldElement extends Element {
1097 GetterElement get getter; 1097 GetterElement get getter;
1098 SetterElement get setter; 1098 SetterElement get setter;
1099 } 1099 }
1100 1100
1101 abstract class FunctionSignature { 1101 abstract class FunctionSignature {
1102 FunctionType get type; 1102 FunctionType get type;
1103 List<DartType> get typeVariables;
1103 List<FormalElement> get requiredParameters; 1104 List<FormalElement> get requiredParameters;
1104 List<FormalElement> get optionalParameters; 1105 List<FormalElement> get optionalParameters;
1105 1106
1106 int get requiredParameterCount; 1107 int get requiredParameterCount;
1107 int get optionalParameterCount; 1108 int get optionalParameterCount;
1108 bool get optionalParametersAreNamed; 1109 bool get optionalParametersAreNamed;
1109 bool get hasOptionalParameters; 1110 bool get hasOptionalParameters;
1110 1111
1111 int get parameterCount; 1112 int get parameterCount;
1112 List<FormalElement> get orderedOptionalParameters; 1113 List<FormalElement> get orderedOptionalParameters;
1113 1114
1114 void forEachParameter(void function(FormalElement parameter)); 1115 void forEachParameter(void function(FormalElement parameter));
1115 void forEachRequiredParameter(void function(FormalElement parameter)); 1116 void forEachRequiredParameter(void function(FormalElement parameter));
1116 void forEachOptionalParameter(void function(FormalElement parameter)); 1117 void forEachOptionalParameter(void function(FormalElement parameter));
1117 1118
1118 void orderedForEachParameter(void function(FormalElement parameter)); 1119 void orderedForEachParameter(void function(FormalElement parameter));
1119 1120
1120 bool isCompatibleWith(FunctionSignature constructorSignature); 1121 bool isCompatibleWith(FunctionSignature constructorSignature);
1121 } 1122 }
1122 1123
1123 /// A top level, static or instance method, constructor, local function, or 1124 /// A top level, static or instance method, constructor, local function, or
1124 /// closure (anonymous local function). 1125 /// closure (anonymous local function).
1125 abstract class FunctionElement extends Element 1126 abstract class FunctionElement extends Element
1126 implements 1127 implements
1127 AstElement, 1128 AstElement,
1128 TypedElement, 1129 TypedElement,
1129 FunctionTypedElement, 1130 FunctionTypedElement,
1130 ExecutableElement { 1131 ExecutableElement,
1132 GenericElement {
1131 FunctionExpression get node; 1133 FunctionExpression get node;
1132 1134
1133 FunctionElement get patch; 1135 FunctionElement get patch;
1134 FunctionElement get origin; 1136 FunctionElement get origin;
1135 1137
1136 bool get hasFunctionSignature; 1138 bool get hasFunctionSignature;
1137 1139
1138 /// The parameters of this functions. 1140 /// The parameters of this function.
1139 List<ParameterElement> get parameters; 1141 List<ParameterElement> get parameters;
1140 1142
1141 /// The type of this function. 1143 /// The type of this function.
1142 FunctionType get type; 1144 FunctionType get type;
1143 1145
1144 /// The synchronous/asynchronous marker on this function. 1146 /// The synchronous/asynchronous marker on this function.
1145 AsyncMarker get asyncMarker; 1147 AsyncMarker get asyncMarker;
1146 1148
1147 /// `true` if this function is external. 1149 /// `true` if this function is external.
1148 bool get isExternal; 1150 bool get isExternal;
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
1308 @deprecated 1310 @deprecated
1309 get enclosingElement; 1311 get enclosingElement;
1310 } 1312 }
1311 1313
1312 /// JavaScript backend specific element for the body of constructor. 1314 /// JavaScript backend specific element for the body of constructor.
1313 // TODO(johnniwinther): Remove this class from the element model. 1315 // TODO(johnniwinther): Remove this class from the element model.
1314 abstract class ConstructorBodyElement extends MethodElement { 1316 abstract class ConstructorBodyElement extends MethodElement {
1315 FunctionElement get constructor; 1317 FunctionElement get constructor;
1316 } 1318 }
1317 1319
1320 /// [GenericElement] defines the common interface for generic functions and
1321 /// [TypeDeclarationElement].
1322 abstract class GenericElement extends Element implements AstElement {
1323 /**
1324 * The type variables declared on this declaration. The type variables are not
1325 * available until the type of the element has been computed through
1326 * [computeType].
1327 */
1328 List<DartType> get typeVariables;
1329 }
1330
1318 /// [TypeDeclarationElement] defines the common interface for class/interface 1331 /// [TypeDeclarationElement] defines the common interface for class/interface
1319 /// declarations and typedefs. 1332 /// declarations and typedefs.
1320 abstract class TypeDeclarationElement extends Element implements AstElement { 1333 abstract class TypeDeclarationElement extends GenericElement {
1321 /// The name of this type declaration, taking privacy into account. 1334 /// The name of this type declaration, taking privacy into account.
1322 Name get memberName; 1335 Name get memberName;
1323 1336
1324 /// Do not use [computeType] outside of the resolver; instead retrieve the 1337 /// Do not use [computeType] outside of the resolver; instead retrieve the
1325 /// type from the [thisType] or [rawType], depending on the use case. 1338 /// type from the [thisType] or [rawType], depending on the use case.
1326 /// 1339 ///
1327 /// Trying to access a type that has not been computed in resolution is an 1340 /// Trying to access a type that has not been computed in resolution is an
1328 /// error and calling [computeType] covers that error. 1341 /// error and calling [computeType] covers that error.
1329 /// This method will go away! 1342 /// This method will go away!
1330 @deprecated 1343 @deprecated
(...skipping 21 matching lines...) Expand all
1352 * The [rawType] field is a canonicalization of the raw type and should be 1365 * The [rawType] field is a canonicalization of the raw type and should be
1353 * used to distinguish explicit and implicit uses of the [dynamic] 1366 * used to distinguish explicit and implicit uses of the [dynamic]
1354 * type arguments. For instance should [:List:] be the [rawType] of the 1367 * type arguments. For instance should [:List:] be the [rawType] of the
1355 * [:List:] class element whereas [:List<dynamic>:] should be its own 1368 * [:List:] class element whereas [:List<dynamic>:] should be its own
1356 * instantiation of [InterfaceType] with [:dynamic:] as type argument. Using 1369 * instantiation of [InterfaceType] with [:dynamic:] as type argument. Using
1357 * this distinction, we can print the raw type with type arguments only when 1370 * this distinction, we can print the raw type with type arguments only when
1358 * the input source has used explicit type arguments. 1371 * the input source has used explicit type arguments.
1359 */ 1372 */
1360 GenericType get rawType; 1373 GenericType get rawType;
1361 1374
1362 /**
1363 * The type variables declared on this declaration. The type variables are not
1364 * available until the type of the element has been computed through
1365 * [computeType].
1366 */
1367 List<DartType> get typeVariables;
1368
1369 bool get isResolved; 1375 bool get isResolved;
1370 1376
1371 void ensureResolved(Resolution resolution); 1377 void ensureResolved(Resolution resolution);
1372 } 1378 }
1373 1379
1374 abstract class ClassElement extends TypeDeclarationElement 1380 abstract class ClassElement extends TypeDeclarationElement
1375 implements ScopeContainerElement { 1381 implements ScopeContainerElement {
1376 /// The length of the longest inheritance path from [:Object:]. 1382 /// The length of the longest inheritance path from [:Object:].
1377 int get hierarchyDepth; 1383 int get hierarchyDepth;
1378 1384
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1555 /// The [Element] for a type variable declaration on a generic class or typedef. 1561 /// The [Element] for a type variable declaration on a generic class or typedef.
1556 abstract class TypeVariableElement extends Element 1562 abstract class TypeVariableElement extends Element
1557 implements AstElement, TypedElement { 1563 implements AstElement, TypedElement {
1558 /// The name of this type variable, taking privacy into account. 1564 /// The name of this type variable, taking privacy into account.
1559 Name get memberName; 1565 Name get memberName;
1560 1566
1561 /// Use [typeDeclaration] instead. 1567 /// Use [typeDeclaration] instead.
1562 @deprecated 1568 @deprecated
1563 get enclosingElement; 1569 get enclosingElement;
1564 1570
1565 /// The class or typedef on which this type variable is defined. 1571 /// The class, typedef, function, or method on which this type variable is
Johnni Winther 2016/04/29 07:21:06 or function typed parameter
eernst 2016/04/29 13:24:50 Done.
1566 TypeDeclarationElement get typeDeclaration; 1572 /// defined.
1573 GenericElement get typeDeclaration;
1567 1574
1568 /// The index of this type variable within its type declaration. 1575 /// The index of this type variable within its type declaration.
1569 int get index; 1576 int get index;
1570 1577
1571 /// The [type] defined by the type variable. 1578 /// The [type] defined by the type variable.
1572 TypeVariableType get type; 1579 TypeVariableType get type;
1573 1580
1574 /// The upper bound on the type variable. If not explicitly declared, this is 1581 /// The upper bound on the type variable. If not explicitly declared, this is
1575 /// `Object`. 1582 /// `Object`.
1576 DartType get bound; 1583 DartType get bound;
(...skipping 21 matching lines...) Expand all
1598 /// Trying to access a type that has not been computed in resolution is an 1605 /// Trying to access a type that has not been computed in resolution is an
1599 /// error and calling [computeType] covers that error. 1606 /// error and calling [computeType] covers that error.
1600 /// This method will go away! 1607 /// This method will go away!
1601 @deprecated 1608 @deprecated
1602 DartType computeType(Resolution resolution); 1609 DartType computeType(Resolution resolution);
1603 1610
1604 DartType get type; 1611 DartType get type;
1605 } 1612 }
1606 1613
1607 /// An [Element] that can define a function type. 1614 /// An [Element] that can define a function type.
1608 abstract class FunctionTypedElement extends Element { 1615 abstract class FunctionTypedElement extends Element implements GenericElement {
1609 /// The function signature for the function type defined by this element, 1616 /// The function signature for the function type defined by this element,
1610 /// if any. 1617 /// if any.
1611 FunctionSignature get functionSignature; 1618 FunctionSignature get functionSignature;
1612 } 1619 }
1613 1620
1614 /// An [Element] that holds a [TreeElements] mapping. 1621 /// An [Element] that holds a [TreeElements] mapping.
1615 abstract class AnalyzableElement extends Element { 1622 abstract class AnalyzableElement extends Element {
1616 /// Return `true` if [treeElements] have been (partially) computed for this 1623 /// Return `true` if [treeElements] have been (partially) computed for this
1617 /// element. 1624 /// element.
1618 bool get hasTreeElements; 1625 bool get hasTreeElements;
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
1794 /// by a field. 1801 /// by a field.
1795 bool get isDeclaredByField; 1802 bool get isDeclaredByField;
1796 1803
1797 /// Returns `true` if this member is abstract. 1804 /// Returns `true` if this member is abstract.
1798 bool get isAbstract; 1805 bool get isAbstract;
1799 1806
1800 /// If abstract, [implementation] points to the overridden concrete member, 1807 /// If abstract, [implementation] points to the overridden concrete member,
1801 /// if any. Otherwise [implementation] points to the member itself. 1808 /// if any. Otherwise [implementation] points to the member itself.
1802 Member get implementation; 1809 Member get implementation;
1803 } 1810 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698