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

Unified Diff: pkg/analyzer/lib/src/generated/constant.dart

Issue 1131383008: Generate the proper error when a constant refers to itself. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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 | pkg/analyzer/lib/src/task/driver.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/constant.dart
diff --git a/pkg/analyzer/lib/src/generated/constant.dart b/pkg/analyzer/lib/src/generated/constant.dart
index b0b795867375cbc893541bdd656cb104b5ee6187..fccd3603022149198b4aa8e59984f903f06ca8ad 100644
--- a/pkg/analyzer/lib/src/generated/constant.dart
+++ b/pkg/analyzer/lib/src/generated/constant.dart
@@ -1273,12 +1273,15 @@ class ConstantValueComputer {
referenceGraph.computeTopologicalSort();
for (List<ConstantEvaluationTarget> constantsInCycle in topologicalSort) {
if (constantsInCycle.length == 1) {
- _computeValueFor(constantsInCycle[0]);
- } else {
- for (ConstantEvaluationTarget constant in constantsInCycle) {
- evaluationEngine.generateCycleError(constantsInCycle, constant);
+ ConstantEvaluationTarget constant = constantsInCycle[0];
+ if (!referenceGraph.getTails(constant).contains(constant)) {
+ _computeValueFor(constant);
+ continue;
}
}
+ for (ConstantEvaluationTarget constant in constantsInCycle) {
+ evaluationEngine.generateCycleError(constantsInCycle, constant);
+ }
}
}
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/task/driver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698