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

Unified Diff: pkg/analyzer/lib/src/generated/element.dart

Issue 1217373005: Generic method support in element model (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/element_handle.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/element.dart
diff --git a/pkg/analyzer/lib/src/generated/element.dart b/pkg/analyzer/lib/src/generated/element.dart
index 24344aae432ecac820252d7241b5f33c41a4f541..e5bf3a101b2c90344e8c631cb132c4968a44e5b5 100644
--- a/pkg/analyzer/lib/src/generated/element.dart
+++ b/pkg/analyzer/lib/src/generated/element.dart
@@ -3593,6 +3593,12 @@ abstract class ExecutableElement implements Element {
* Return the type of function defined by this executable element.
*/
FunctionType get type;
+
+ /**
+ * Return a list containing all of the type parameters defined for this
+ * executable element.
+ */
+ List<TypeParameterElement> get typeParameters;
}
/**
@@ -3630,6 +3636,11 @@ abstract class ExecutableElementImpl extends ElementImpl
List<ParameterElement> _parameters = ParameterElement.EMPTY_LIST;
/**
+ * A list containing all of the type parameters defined for this function.
scheglov 2015/07/06 15:03:21 "for this executable element"?
Brian Wilkerson 2015/07/09 22:02:27 Done
+ */
+ List<TypeParameterElement> _typeParameters = TypeParameterElement.EMPTY_LIST;
+
+ /**
* The return type defined by this executable element.
*/
DartType returnType;
@@ -3746,8 +3757,33 @@ abstract class ExecutableElementImpl extends ElementImpl
}
@override
+ List<TypeParameterElement> get typeParameters => _typeParameters;
+
+ /**
+ * Set the type parameters defined by this executable element to the given
+ * [typeParameters].
+ */
+ void set typeParameters(List<TypeParameterElement> typeParameters) {
+ for (TypeParameterElement parameter in typeParameters) {
+ (parameter as TypeParameterElementImpl).enclosingElement = this;
+ }
+ this._typeParameters = typeParameters;
+ }
+
+ @override
void appendTo(StringBuffer buffer) {
if (this.kind != ElementKind.GETTER) {
+ int typeParameterCount = _typeParameters.length;
+ if (typeParameterCount > 0) {
+ buffer.write('<');
+ for (int i = 0; i < typeParameterCount; i++) {
+ if (i > 0) {
+ buffer.write(", ");
+ }
+ (_typeParameters[i] as TypeParameterElementImpl).appendTo(buffer);
+ }
+ buffer.write('>');
+ }
buffer.write("(");
String closing = null;
ParameterKind kind = ParameterKind.REQUIRED;
@@ -3903,6 +3939,9 @@ abstract class ExecutableMember extends Member implements ExecutableElement {
FunctionType get type => substituteFor(baseElement.type);
@override
+ List<TypeParameterElement> get typeParameters => baseElement.typeParameters;
+
+ @override
void visitChildren(ElementVisitor visitor) {
// TODO(brianwilkerson) We need to finish implementing the accessors used
// below so that we can safely invoke them.
@@ -8604,6 +8643,13 @@ abstract class ParameterElement
*/
List<ParameterElement> get parameters;
+ /**
+ * Return a list containing all of the type parameters defined by this
+ * parameter. A parameter will only define other parameters if it is a
+ * function typed parameter.
+ */
+ List<TypeParameterElement> get typeParameters;
+
@override
FormalParameter computeNode();
}
@@ -8627,6 +8673,13 @@ class ParameterElementImpl extends VariableElementImpl
List<ParameterElement> _parameters = ParameterElement.EMPTY_LIST;
/**
+ * A list containing all of the type parameters defined for this parameter
+ * element. There will only be parameters if this parameter is a function
+ * typed parameter.
+ */
+ List<TypeParameterElement> _typeParameters = TypeParameterElement.EMPTY_LIST;
+
+ /**
* The kind of this parameter.
*/
ParameterKind parameterKind;
@@ -8697,6 +8750,20 @@ class ParameterElementImpl extends VariableElementImpl
}
@override
+ List<TypeParameterElement> get typeParameters => _typeParameters;
+
+ /**
+ * Set the type parameters defined by this executable element to the given
scheglov 2015/07/06 15:03:21 "defined by this parameter element"?
Brian Wilkerson 2015/07/09 22:02:28 Done
+ * [typeParameters].
+ */
+ void set typeParameters(List<TypeParameterElement> typeParameters) {
+ for (TypeParameterElement parameter in typeParameters) {
+ (parameter as TypeParameterElementImpl).enclosingElement = this;
+ }
+ this._typeParameters = typeParameters;
+ }
+
+ @override
SourceRange get visibleRange {
if (_visibleRangeLength < 0) {
return null;
@@ -8852,6 +8919,9 @@ class ParameterMember extends VariableMember implements ParameterElement {
}
@override
+ List<TypeParameterElement> get typeParameters => baseElement.typeParameters;
+
+ @override
SourceRange get visibleRange => baseElement.visibleRange;
@override
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/element_handle.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698