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

Unified Diff: pkg/analyzer/lib/src/dart/element/element.dart

Issue 1846703002: Fix for infinite resursion while finding a concrete method. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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/dart/element/element.dart
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart
index 214b4f4db108ca3c069a867161ba7d24cf400cf3..01da784f14b23bd973e8dbdac1d34cc10179fd39 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -568,7 +568,8 @@ class ClassElementImpl extends ElementImpl implements ClassElement {
@override
MethodElement lookUpConcreteMethod(
String methodName, LibraryElement library) =>
- _internalLookUpConcreteMethod(methodName, library, true);
+ _internalLookUpConcreteMethod(
+ methodName, library, true, new HashSet<ClassElement>());
@override
PropertyAccessorElement lookUpGetter(
@@ -583,7 +584,8 @@ class ClassElementImpl extends ElementImpl implements ClassElement {
@override
MethodElement lookUpInheritedConcreteMethod(
String methodName, LibraryElement library) =>
- _internalLookUpConcreteMethod(methodName, library, false);
+ _internalLookUpConcreteMethod(
+ methodName, library, false, new HashSet<ClassElement>());
@override
PropertyAccessorElement lookUpInheritedConcreteSetter(
@@ -593,11 +595,13 @@ class ClassElementImpl extends ElementImpl implements ClassElement {
@override
MethodElement lookUpInheritedMethod(
String methodName, LibraryElement library) =>
- _internalLookUpMethod(methodName, library, false);
+ _internalLookUpMethod(
+ methodName, library, false, new HashSet<ClassElement>());
@override
MethodElement lookUpMethod(String methodName, LibraryElement library) =>
- _internalLookUpMethod(methodName, library, true);
+ _internalLookUpMethod(
+ methodName, library, true, new HashSet<ClassElement>());
@override
PropertyAccessorElement lookUpSetter(
@@ -751,15 +755,19 @@ class ClassElementImpl extends ElementImpl implements ClassElement {
}
MethodElement _internalLookUpConcreteMethod(
- String methodName, LibraryElement library, bool includeThisClass) {
- MethodElement method =
- _internalLookUpMethod(methodName, library, includeThisClass);
+ String methodName,
+ LibraryElement library,
+ bool includeThisClass,
+ HashSet<ClassElement> visitedClasses) {
+ MethodElement method = _internalLookUpMethod(
+ methodName, library, includeThisClass, visitedClasses);
while (method != null && method.isAbstract) {
ClassElement definingClass = method.enclosingElement;
if (definingClass == null) {
return null;
}
- method = definingClass.lookUpInheritedMethod(methodName, library);
+ method = getImpl(definingClass)
+ ._internalLookUpMethod(methodName, library, false, visitedClasses);
}
return method;
}
@@ -812,9 +820,8 @@ class ClassElementImpl extends ElementImpl implements ClassElement {
return null;
}
- MethodElement _internalLookUpMethod(
- String methodName, LibraryElement library, bool includeThisClass) {
- HashSet<ClassElement> visitedClasses = new HashSet<ClassElement>();
+ MethodElement _internalLookUpMethod(String methodName, LibraryElement library,
+ bool includeThisClass, HashSet<ClassElement> visitedClasses) {
ClassElement currentElement = this;
if (includeThisClass) {
MethodElement element = currentElement.getMethod(methodName);
« 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