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

Unified Diff: pkg/analyzer/lib/src/summary/resynthesize.dart

Issue 1560343002: Test and fix resynthesized function-typed parameters referring to type parameters. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analyzer/test/src/summary/resynthesize_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/summary/resynthesize.dart
diff --git a/pkg/analyzer/lib/src/summary/resynthesize.dart b/pkg/analyzer/lib/src/summary/resynthesize.dart
index e83b6619d47a447cf9a055e6cf0bf8470da9669a..8e316049f04855555dd72f299a76b9c8c7f76e4b 100644
--- a/pkg/analyzer/lib/src/summary/resynthesize.dart
+++ b/pkg/analyzer/lib/src/summary/resynthesize.dart
@@ -212,6 +212,13 @@ class _LibraryResynthesizer {
}
/**
+ * Return a list of type arguments corresponding to [currentTypeParameters].
+ */
+ List<TypeParameterType> get currentTypeArguments => currentTypeParameters
+ ?.map((TypeParameterElement param) => param.type)
+ ?.toList();
+
+ /**
* Resynthesize a [ClassElement] and place it in [unitHolder].
*/
void buildClass(UnlinkedClass serializedClass) {
@@ -266,11 +273,7 @@ class _LibraryResynthesizer {
constructor.synthetic = true;
constructor.returnType = correspondingType;
constructor.type = new FunctionTypeImpl.elementWithNameAndArgs(
- constructor,
- null,
- currentTypeParameters
- .map((TypeParameterElement e) => e.type)
- .toList());
+ constructor, null, currentTypeArguments);
memberHolder.addConstructor(constructor);
}
classElement.constructors = memberHolder.constructors;
@@ -278,8 +281,7 @@ class _LibraryResynthesizer {
classElement.accessors = memberHolder.accessors;
classElement.fields = memberHolder.fields;
classElement.methods = memberHolder.methods;
- correspondingType.typeArguments =
- currentTypeParameters.map((param) => param.type).toList();
+ correspondingType.typeArguments = currentTypeArguments;
classElement.type = correspondingType;
unitHolder.addType(classElement);
} finally {
@@ -453,11 +455,7 @@ class _LibraryResynthesizer {
executableElement.returnType = VoidTypeImpl.instance;
}
executableElement.type = new FunctionTypeImpl.elementWithNameAndArgs(
- executableElement,
- null,
- currentTypeParameters
- ?.map((TypeParameterElement e) => e.type)
- ?.toList());
+ executableElement, null, currentTypeArguments);
executableElement.hasImplicitReturnType =
serializedExecutable.hasImplicitReturnType;
executableElement.external = serializedExecutable.isExternal;
@@ -668,7 +666,8 @@ class _LibraryResynthesizer {
} else {
parameterTypeElement.returnType = VoidTypeImpl.instance;
}
- parameterElement.type = new FunctionTypeImpl(parameterTypeElement);
+ parameterElement.type = new FunctionTypeImpl.elementWithNameAndArgs(
+ parameterTypeElement, null, currentTypeArguments);
} else {
parameterElement.type = buildType(serializedParameter.type);
parameterElement.hasImplicitType = serializedParameter.hasImplicitType;
« no previous file with comments | « no previous file | pkg/analyzer/test/src/summary/resynthesize_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698