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

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

Issue 1643403002: Test and fix a few more corner cases of summarizing type inference. (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
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 5d6964aa93bdc216b077fe2d5b4776fed1f1203c..5c50d2e14fdc8520923aa7c0617ee06944f47ebb 100644
--- a/pkg/analyzer/lib/src/summary/summarize_elements.dart
+++ b/pkg/analyzer/lib/src/summary/summarize_elements.dart
@@ -388,6 +388,7 @@ class _CompilationUnitSerializer {
List<UnlinkedPublicNameBuilder> bs = <UnlinkedPublicNameBuilder>[];
for (FieldElement field in cls.fields) {
if (field.isStatic && field.isConst && field.isPublic) {
+ // TODO(paulberry): should numTypeParameters include class params?
bs.add(new UnlinkedPublicNameBuilder(
name: field.name,
kind: ReferenceKind.propertyAccessor,
@@ -396,6 +397,7 @@ class _CompilationUnitSerializer {
}
for (MethodElement method in cls.methods) {
if (method.isStatic && method.isPublic) {
+ // TODO(paulberry): should numTypeParameters include class params?
bs.add(new UnlinkedPublicNameBuilder(
name: method.name,
kind: ReferenceKind.method,
@@ -404,6 +406,7 @@ class _CompilationUnitSerializer {
}
for (ConstructorElement constructor in cls.constructors) {
if (constructor.isConst && constructor.isPublic) {
+ // TODO(paulberry): should numTypeParameters include class params?
bs.add(new UnlinkedPublicNameBuilder(
name: constructor.name,
kind: ReferenceKind.constructor,
@@ -843,15 +846,13 @@ class _CompilationUnitSerializer {
unit = dependentLibrary.units.indexOf(unitElement);
assert(unit != -1);
}
- int numTypeParameters = 0;
- if (element is TypeParameterizedElement) {
- numTypeParameters = element.typeParameters.length;
- }
LinkedReferenceBuilder linkedReference = new LinkedReferenceBuilder(
dependency: librarySerializer.serializeDependency(dependentLibrary),
kind: _getReferenceKind(element),
- unit: unit,
- numTypeParameters: numTypeParameters);
+ unit: unit);
+ if (element is TypeParameterizedElement) {
+ linkedReference.numTypeParameters = element.typeParameters.length;
+ }
String name = element == null ? 'void' : element.name;
if (linked) {
linkedReference.name = name;
@@ -859,6 +860,7 @@ class _CompilationUnitSerializer {
if (enclosing is ClassElement) {
linkedReference.containingReference =
_getElementReferenceId(enclosing, linked: linked);
+ linkedReference.numTypeParameters += enclosing.typeParameters.length;
}
} else {
assert(unlinkedReferences.length == linkedReferences.length);
« no previous file with comments | « pkg/analyzer/lib/src/summary/resynthesize.dart ('k') | pkg/analyzer/test/src/summary/resynthesize_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698