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

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

Issue 1042963002: Avoid infinite loop if const constructor redirects don't reach a fixed point. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add missing copyright notice. Created 5 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 | « no previous file | pkg/analyzer/test/generated/compile_time_error_code_test.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 dab71f3420c5cb15602ea712bccd6898626e6a99..d14bba86194ac45e0a211366f9c7bb0b3bc5030f 100644
--- a/pkg/analyzer/lib/src/generated/constant.dart
+++ b/pkg/analyzer/lib/src/generated/constant.dart
@@ -995,7 +995,8 @@ class ConstantValueComputer {
// let [evaluateInstanceCreationExpression] handle it specially.
break;
}
- constructorsVisited.add(constructor);
+ ConstructorElement constructorBase = _getConstructorBase(constructor);
+ constructorsVisited.add(constructorBase);
ConstructorElement redirectedConstructor =
constructor.redirectedConstructor;
if (redirectedConstructor == null) {
@@ -1008,7 +1009,9 @@ class ConstantValueComputer {
// [ErrorVerifier.checkForRedirectToNonConstConstructor()]).
break;
}
- if (constructorsVisited.contains(redirectedConstructor)) {
+ ConstructorElement redirectedConstructorBase =
+ _getConstructorBase(redirectedConstructor);
+ if (constructorsVisited.contains(redirectedConstructorBase)) {
// Cycle in redirecting factory constructors--this is not allowed
// and is checked elsewhere--see
// [ErrorVerifier.checkForRecursiveFactoryRedirect()]).
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/compile_time_error_code_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698