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

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

Issue 2777783003: Record variable names in type inference cycles. (Closed)
Patch Set: Created 3 years, 9 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 | « pkg/analyzer/lib/src/summary/idl.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/summary/link.dart
diff --git a/pkg/analyzer/lib/src/summary/link.dart b/pkg/analyzer/lib/src/summary/link.dart
index 6a87b7fa20182469c28e786f8fc8bc86d50c1aca..5c70e57bbd0209aa89ff7e4d43078d112ff10684 100644
--- a/pkg/analyzer/lib/src/summary/link.dart
+++ b/pkg/analyzer/lib/src/summary/link.dart
@@ -4797,13 +4797,13 @@ class TypeInferenceDependencyWalker
extends DependencyWalker<TypeInferenceNode> {
@override
void evaluate(TypeInferenceNode v) {
- v.evaluate(false);
+ v.evaluate(null);
}
@override
void evaluateScc(List<TypeInferenceNode> scc) {
for (TypeInferenceNode v in scc) {
- v.evaluate(true);
+ v.evaluate(scc);
}
}
}
@@ -4922,10 +4922,24 @@ class TypeInferenceNode extends Node<TypeInferenceNode> {
return dependencies;
}
- void evaluate(bool inCycle) {
- if (inCycle) {
+ void evaluate(List<TypeInferenceNode> cycle) {
+ if (cycle != null) {
+ List<String> cycleNames = cycle
+ .map((node) {
+ Element e = node.functionElement;
+ while (e != null) {
+ if (e is VariableElement) {
+ return e.name;
+ }
+ e = e.enclosingElement;
+ }
+ return '<unknown>';
+ })
+ .toSet()
+ .toList();
functionElement._setInferenceError(new TopLevelInferenceErrorBuilder(
- kind: TopLevelInferenceErrorKind.dependencyCycle));
+ kind: TopLevelInferenceErrorKind.dependencyCycle,
+ arguments: cycleNames));
functionElement._setInferredType(DynamicTypeImpl.instance);
} else {
var computer = new ExprTypeComputer(functionElement);
« no previous file with comments | « pkg/analyzer/lib/src/summary/idl.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698