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

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

Issue 1950333003: Fix a corner case of inferred types with function-typed parameters. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Also test resynthesis. 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 side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/lib/src/summary/summarize_elements.dart
diff --git a/pkg/analyzer/lib/src/summary/summarize_elements.dart b/pkg/analyzer/lib/src/summary/summarize_elements.dart
index 3bebefa4e23ad0cdcbbfa534c420c5d4c30d7e11..92388eeb85bfe915b1ae28e250cd7ecaeeff7371 100644
--- a/pkg/analyzer/lib/src/summary/summarize_elements.dart
+++ b/pkg/analyzer/lib/src/summary/summarize_elements.dart
@@ -617,9 +617,7 @@ class _CompilationUnitSerializer {
}
}
for (PropertyAccessorElement accessor in cls.accessors) {
- if (accessor.isStatic &&
- accessor.isGetter &&
- accessor.isPublic) {
+ if (accessor.isStatic && accessor.isGetter && accessor.isPublic) {
// TODO(paulberry): should numTypeParameters include class params?
bs.add(new UnlinkedPublicNameBuilder(
name: accessor.name, kind: ReferenceKind.propertyAccessor));
@@ -1051,19 +1049,19 @@ class _CompilationUnitSerializer {
ParameterElement parameterElement = typeElement.enclosingElement;
while (true) {
Element parent = parameterElement.enclosingElement;
- if (parent is FunctionTypedElement) {
- Element grandParent = parent.enclosingElement;
+ if (parent is ParameterElement) {
+ // Function-typed parameter inside a function-typed parameter.
b.implicitFunctionTypeIndices
.insert(0, parent.parameters.indexOf(parameterElement));
- if (grandParent is ParameterElement) {
- // Function-typed parameter inside a function-typed parameter.
- parameterElement = grandParent;
- continue;
- } else {
- // Function-typed parameter inside a top level function or method.
- b.reference = _getElementReferenceId(parent);
- break;
- }
+ parameterElement = parent;
+ continue;
+ } else if (parent is FunctionTypedElement) {
+ b.implicitFunctionTypeIndices
+ .insert(0, parent.parameters.indexOf(parameterElement));
+ // Function-typed parameter inside a top level function, method, or
+ // typedef.
+ b.reference = _getElementReferenceId(parent);
+ break;
} else {
throw new StateError(
'Unexpected element enclosing parameter: ${parent.runtimeType}');

Powered by Google App Engine
This is Rietveld 408576698