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

Unified 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: Rebased again Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: pkg/compiler/lib/src/elements/elements.dart
diff --git a/pkg/compiler/lib/src/elements/elements.dart b/pkg/compiler/lib/src/elements/elements.dart
index 0216f562bad7ca5d9890368b7f1163ed73076d8d..5d3137271975ba89b0b4a7327a85fb6f5125888c 100644
--- a/pkg/compiler/lib/src/elements/elements.dart
+++ b/pkg/compiler/lib/src/elements/elements.dart
@@ -486,7 +486,12 @@ class Elements {
return true;
}
- static bool hasAccessToTypeVariables(Element element) {
+ static bool hasAccessToTypeVariable(Element element,
+ TypeVariableElement typeVariable) {
+ GenericElement declaration = typeVariable.typeDeclaration;
+ if (declaration is FunctionElement || declaration is ParameterElement) {
+ return true;
+ }
Element outer = element.outermostEnclosingMemberOrTopLevel;
return (outer != null && outer.isFactoryConstructor) ||
!isInStaticContext(element);
@@ -1107,6 +1112,7 @@ abstract class AbstractFieldElement extends Element {
abstract class FunctionSignature {
FunctionType get type;
+ List<DartType> get typeVariables;
List<FormalElement> get requiredParameters;
List<FormalElement> get optionalParameters;
@@ -1134,7 +1140,8 @@ abstract class FunctionElement extends Element
AstElement,
TypedElement,
FunctionTypedElement,
- ExecutableElement {
+ ExecutableElement,
+ GenericElement {
FunctionExpression get node;
FunctionElement get patch;
@@ -1142,7 +1149,7 @@ abstract class FunctionElement extends Element
bool get hasFunctionSignature;
- /// The parameters of this functions.
+ /// The parameters of this function.
List<ParameterElement> get parameters;
/// The type of this function.
@@ -1322,9 +1329,20 @@ abstract class ConstructorBodyElement extends MethodElement {
FunctionElement get constructor;
}
+/// [GenericElement] defines the common interface for generic functions and
+/// [TypeDeclarationElement].
+abstract class GenericElement extends Element implements AstElement {
+ /**
+ * The type variables declared on this declaration. The type variables are not
+ * available until the type of the element has been computed through
+ * [computeType].
+ */
+ List<DartType> get typeVariables;
+}
+
/// [TypeDeclarationElement] defines the common interface for class/interface
/// declarations and typedefs.
-abstract class TypeDeclarationElement extends Element implements AstElement {
+abstract class TypeDeclarationElement extends GenericElement {
/// The name of this type declaration, taking privacy into account.
Name get memberName;
@@ -1366,13 +1384,6 @@ abstract class TypeDeclarationElement extends Element implements AstElement {
*/
GenericType get rawType;
- /**
- * The type variables declared on this declaration. The type variables are not
- * available until the type of the element has been computed through
- * [computeType].
- */
- List<DartType> get typeVariables;
-
bool get isResolved;
void ensureResolved(Resolution resolution);
@@ -1569,8 +1580,9 @@ abstract class TypeVariableElement extends Element
@deprecated
get enclosingElement;
- /// The class or typedef on which this type variable is defined.
- TypeDeclarationElement get typeDeclaration;
+ /// The class, typedef, function, method, or function typed parameter on
+ /// which this type variable is defined.
+ GenericElement get typeDeclaration;
/// The index of this type variable within its type declaration.
int get index;
@@ -1612,7 +1624,7 @@ abstract class TypedElement extends Element {
}
/// An [Element] that can define a function type.
-abstract class FunctionTypedElement extends Element {
+abstract class FunctionTypedElement extends Element implements GenericElement {
/// The function signature for the function type defined by this element,
/// if any.
FunctionSignature get functionSignature;
« no previous file with comments | « pkg/compiler/lib/src/dart_backend/backend_ast_to_frontend_ast.dart ('k') | pkg/compiler/lib/src/elements/modelx.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698