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

Side by Side Diff: pkg/analyzer/lib/src/dart/element/element.dart

Issue 3000183002: Fix ClassElement.allSupertypes to include interfaces of mixins (issue 29767) (Closed)
Patch Set: Created 3 years, 4 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 | no next file » | 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 library analyzer.src.dart.element.element; 5 library analyzer.src.dart.element.element;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import 'dart:math' show min; 8 import 'dart:math' show min;
9 9
10 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1147 ClassElement currentElement = currentType.element; 1147 ClassElement currentElement = currentType.element;
1148 if (!visitedClasses.contains(currentElement)) { 1148 if (!visitedClasses.contains(currentElement)) {
1149 visitedClasses.add(currentElement); 1149 visitedClasses.add(currentElement);
1150 if (!identical(currentType, this.type)) { 1150 if (!identical(currentType, this.type)) {
1151 supertypes.add(currentType); 1151 supertypes.add(currentType);
1152 } 1152 }
1153 InterfaceType supertype = currentType.superclass; 1153 InterfaceType supertype = currentType.superclass;
1154 if (supertype != null) { 1154 if (supertype != null) {
1155 typesToVisit.add(supertype); 1155 typesToVisit.add(supertype);
1156 } 1156 }
1157 for (InterfaceType type in currentElement.interfaces) { 1157 for (InterfaceType type in currentType.interfaces) {
Jennifer Messerly 2017/08/17 21:57:29 oh wow, nice catch!
1158 typesToVisit.add(type); 1158 typesToVisit.add(type);
1159 } 1159 }
1160 for (InterfaceType type in currentElement.mixins) { 1160 for (InterfaceType type in currentType.mixins) {
1161 ClassElement element = type.element; 1161 ClassElement element = type.element;
1162 if (!visitedClasses.contains(element)) { 1162 if (!visitedClasses.contains(element)) {
1163 supertypes.add(type); 1163 supertypes.add(type);
1164 for (InterfaceType type in type.interfaces) {
Jennifer Messerly 2017/08/17 21:57:29 there's also the weird case where a mixin's mixin
Brian Wilkerson 2017/08/17 22:49:25 Is it still the case that classes used as mixins c
Jennifer Messerly 2017/08/17 23:14:39 oh yeah, good call! yeah with super mixins, the su
1165 typesToVisit.add(type);
1166 }
1164 } 1167 }
1165 } 1168 }
1166 } 1169 }
1167 } 1170 }
1168 } 1171 }
1169 1172
1170 /** 1173 /**
1171 * Compute a list of constructors for this class, which is a mixin 1174 * Compute a list of constructors for this class, which is a mixin
1172 * application. If specified, [visitedClasses] is a list of the other mixin 1175 * application. If specified, [visitedClasses] is a list of the other mixin
1173 * application classes which have been visited on the way to reaching this 1176 * application classes which have been visited on the way to reaching this
(...skipping 8765 matching lines...) Expand 10 before | Expand all | Expand 10 after
9939 9942
9940 @override 9943 @override
9941 DartObject computeConstantValue() => null; 9944 DartObject computeConstantValue() => null;
9942 9945
9943 @override 9946 @override
9944 void visitChildren(ElementVisitor visitor) { 9947 void visitChildren(ElementVisitor visitor) {
9945 super.visitChildren(visitor); 9948 super.visitChildren(visitor);
9946 _initializer?.accept(visitor); 9949 _initializer?.accept(visitor);
9947 } 9950 }
9948 } 9951 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698