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

Unified Diff: pkg/analyzer/tool/summary/dump_inferred_types.dart

Issue 1957133002: Drop trailing `dynamic` when dumping inferred types. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/tool/summary/dump_inferred_types.dart
diff --git a/pkg/analyzer/tool/summary/dump_inferred_types.dart b/pkg/analyzer/tool/summary/dump_inferred_types.dart
index 4c086e0c89813dfd83d1a87085e9429564ec2f76..bb7073416bdfd9a13f67798952aa0385e93f4bb0 100644
--- a/pkg/analyzer/tool/summary/dump_inferred_types.dart
+++ b/pkg/analyzer/tool/summary/dump_inferred_types.dart
@@ -178,8 +178,12 @@ class InferredTypeCollector {
typeParamsInScope.length - entityRef.paramReference];
}
String result = formatReference(entityRef.reference, typeOf: true);
- if (entityRef.typeArguments.isNotEmpty) {
- result += '<${entityRef.typeArguments.map(formatType).join(', ')}>';
+ List<EntityRef> typeArguments = entityRef.typeArguments.toList();
+ while (typeArguments.isNotEmpty && isDynamic(typeArguments.last)) {
+ typeArguments.removeLast();
+ }
+ if (typeArguments.isNotEmpty) {
+ result += '<${typeArguments.map(formatType).join(', ')}>';
}
if (implicitFunctionTypeIndices.isNotEmpty) {
result =
@@ -189,6 +193,17 @@ class InferredTypeCollector {
}
/**
+ * Determine if the given [entityRef] represents the pseudo-type `dynamic`.
+ */
+ bool isDynamic(EntityRef entityRef) {
+ if (entityRef.syntheticReturnType != null ||
+ entityRef.paramReference != 0) {
+ return false;
+ }
+ return formatReference(entityRef.reference, typeOf: true) == 'dynamic';
+ }
+
+ /**
* Collect all the inferred types contained in [obj], which is reachable via
* [path]. [properties] is the result of calling `obj.toMap()`, and may be
* modified before returning.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698