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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/task/driver.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine.constant; 8 library engine.constant;
9 9
10 import 'dart:collection'; 10 import 'dart:collection';
(...skipping 1255 matching lines...) Expand 10 before | Expand all | Expand 10 after
1266 referenceGraph.addNode(constant); 1266 referenceGraph.addNode(constant);
1267 evaluationEngine.computeDependencies(constant, 1267 evaluationEngine.computeDependencies(constant,
1268 (ConstantEvaluationTarget dependency) { 1268 (ConstantEvaluationTarget dependency) {
1269 referenceGraph.addEdge(constant, dependency); 1269 referenceGraph.addEdge(constant, dependency);
1270 }); 1270 });
1271 } 1271 }
1272 List<List<ConstantEvaluationTarget>> topologicalSort = 1272 List<List<ConstantEvaluationTarget>> topologicalSort =
1273 referenceGraph.computeTopologicalSort(); 1273 referenceGraph.computeTopologicalSort();
1274 for (List<ConstantEvaluationTarget> constantsInCycle in topologicalSort) { 1274 for (List<ConstantEvaluationTarget> constantsInCycle in topologicalSort) {
1275 if (constantsInCycle.length == 1) { 1275 if (constantsInCycle.length == 1) {
1276 _computeValueFor(constantsInCycle[0]); 1276 ConstantEvaluationTarget constant = constantsInCycle[0];
1277 } else { 1277 if (!referenceGraph.getTails(constant).contains(constant)) {
1278 for (ConstantEvaluationTarget constant in constantsInCycle) { 1278 _computeValueFor(constant);
1279 evaluationEngine.generateCycleError(constantsInCycle, constant); 1279 continue;
1280 } 1280 }
1281 } 1281 }
1282 for (ConstantEvaluationTarget constant in constantsInCycle) {
1283 evaluationEngine.generateCycleError(constantsInCycle, constant);
1284 }
1282 } 1285 }
1283 } 1286 }
1284 1287
1285 /** 1288 /**
1286 * Compute a value for the given [constant]. 1289 * Compute a value for the given [constant].
1287 */ 1290 */
1288 void _computeValueFor(ConstantEvaluationTarget constant) { 1291 void _computeValueFor(ConstantEvaluationTarget constant) {
1289 if (!_constantsToCompute.contains(constant)) { 1292 if (!_constantsToCompute.contains(constant)) {
1290 // Element is in the dependency graph but should have been computed by 1293 // Element is in the dependency graph but should have been computed by
1291 // a previous stage of analysis. 1294 // a previous stage of analysis.
(...skipping 3923 matching lines...) Expand 10 before | Expand all | Expand 10 after
5215 return BoolState.from(_element == rightElement); 5218 return BoolState.from(_element == rightElement);
5216 } else if (rightOperand is DynamicState) { 5219 } else if (rightOperand is DynamicState) {
5217 return BoolState.UNKNOWN_VALUE; 5220 return BoolState.UNKNOWN_VALUE;
5218 } 5221 }
5219 return BoolState.FALSE_STATE; 5222 return BoolState.FALSE_STATE;
5220 } 5223 }
5221 5224
5222 @override 5225 @override
5223 String toString() => _element == null ? "-unknown-" : _element.name; 5226 String toString() => _element == null ? "-unknown-" : _element.name;
5224 } 5227 }
OLDNEW
« 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