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

Side by Side 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, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/compile_time_error_code_test.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 977 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 while (constructor.isFactory) { 988 while (constructor.isFactory) {
989 if (identical( 989 if (identical(
990 constructor.enclosingElement.type, typeProvider.symbolType)) { 990 constructor.enclosingElement.type, typeProvider.symbolType)) {
991 // The dart:core.Symbol has a const factory constructor that redirects 991 // The dart:core.Symbol has a const factory constructor that redirects
992 // to dart:_internal.Symbol. That in turn redirects to an external 992 // to dart:_internal.Symbol. That in turn redirects to an external
993 // const constructor, which we won't be able to evaluate. 993 // const constructor, which we won't be able to evaluate.
994 // So stop following the chain of redirections at dart:core.Symbol, and 994 // So stop following the chain of redirections at dart:core.Symbol, and
995 // let [evaluateInstanceCreationExpression] handle it specially. 995 // let [evaluateInstanceCreationExpression] handle it specially.
996 break; 996 break;
997 } 997 }
998 constructorsVisited.add(constructor); 998 ConstructorElement constructorBase = _getConstructorBase(constructor);
999 constructorsVisited.add(constructorBase);
999 ConstructorElement redirectedConstructor = 1000 ConstructorElement redirectedConstructor =
1000 constructor.redirectedConstructor; 1001 constructor.redirectedConstructor;
1001 if (redirectedConstructor == null) { 1002 if (redirectedConstructor == null) {
1002 // This can happen if constructor is an external factory constructor. 1003 // This can happen if constructor is an external factory constructor.
1003 break; 1004 break;
1004 } 1005 }
1005 if (!redirectedConstructor.isConst) { 1006 if (!redirectedConstructor.isConst) {
1006 // Delegating to a non-const constructor--this is not allowed (and 1007 // Delegating to a non-const constructor--this is not allowed (and
1007 // is checked elsewhere--see 1008 // is checked elsewhere--see
1008 // [ErrorVerifier.checkForRedirectToNonConstConstructor()]). 1009 // [ErrorVerifier.checkForRedirectToNonConstConstructor()]).
1009 break; 1010 break;
1010 } 1011 }
1011 if (constructorsVisited.contains(redirectedConstructor)) { 1012 ConstructorElement redirectedConstructorBase =
1013 _getConstructorBase(redirectedConstructor);
1014 if (constructorsVisited.contains(redirectedConstructorBase)) {
1012 // Cycle in redirecting factory constructors--this is not allowed 1015 // Cycle in redirecting factory constructors--this is not allowed
1013 // and is checked elsewhere--see 1016 // and is checked elsewhere--see
1014 // [ErrorVerifier.checkForRecursiveFactoryRedirect()]). 1017 // [ErrorVerifier.checkForRecursiveFactoryRedirect()]).
1015 break; 1018 break;
1016 } 1019 }
1017 constructor = redirectedConstructor; 1020 constructor = redirectedConstructor;
1018 } 1021 }
1019 return constructor; 1022 return constructor;
1020 } 1023 }
1021 1024
(...skipping 4040 matching lines...) Expand 10 before | Expand all | Expand 10 after
5062 return BoolState.from(_element == rightElement); 5065 return BoolState.from(_element == rightElement);
5063 } else if (rightOperand is DynamicState) { 5066 } else if (rightOperand is DynamicState) {
5064 return BoolState.UNKNOWN_VALUE; 5067 return BoolState.UNKNOWN_VALUE;
5065 } 5068 }
5066 return BoolState.FALSE_STATE; 5069 return BoolState.FALSE_STATE;
5067 } 5070 }
5068 5071
5069 @override 5072 @override
5070 String toString() => _element == null ? "-unknown-" : _element.name; 5073 String toString() => _element == null ? "-unknown-" : _element.name;
5071 } 5074 }
OLDNEW
« 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