Skip to content

Commit 48f2d10

Browse files
scheglovcommit-bot@chromium.org
authored andcommitted
Deprecate ClassElement.hasReferenceToSuper
Change-Id: Ie94d8e2b0be6ccb30c7ca59c80da2832cfed3689 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151168 Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
1 parent b7efcd2 commit 48f2d10

File tree

6 files changed

+11
-7
lines changed

6 files changed

+11
-7
lines changed

pkg/analysis_server/lib/src/status/element_writer.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ class ElementWriter extends GeneralizingElementVisitor with TreeWriter {
3939
properties['nameOffset'] = element.nameOffset;
4040
if (element is ClassElement) {
4141
properties['hasNonFinalField'] = element.hasNonFinalField;
42-
properties['hasReferenceToSuper'] = element.hasReferenceToSuper;
4342
properties['hasStaticMember'] = element.hasStaticMember;
4443
properties['interfaces'] = element.interfaces;
4544
properties['isAbstract'] = element.isAbstract;

pkg/analyzer/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.39.11-dev
2+
* Deprecated `ClassElement.hasReferenceToSuper`.
3+
It was used internally, should not be part of API.
4+
15
## 0.39.10
26
* Restored the default constructor in internal `SummaryBuilder`,
37
and the `featureSet` named parameter in `build`, for `build_resolvers`

pkg/analyzer/lib/dart/element/element.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ abstract class ClassElement
8282
/// hence cannot be used as a mixin), or `false` if this element represents a
8383
/// mixin, even if the mixin has a reference to `super`, because it is allowed
8484
/// to be used as a mixin.
85+
@Deprecated('It was used internally, should not be part of API')
8586
bool get hasReferenceToSuper;
8687

8788
/// Return `true` if this class declares a static member.

pkg/analyzer/lib/src/dart/element/element.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -685,10 +685,12 @@ class ClassElementImpl extends AbstractClassElementImpl
685685
return definingClass != null && !definingClass.isDartCoreObject;
686686
}
687687

688+
@Deprecated('It was used internally, should not be part of API')
688689
@override
689690
bool get hasReferenceToSuper => hasModifier(Modifier.REFERENCES_SUPER);
690691

691692
/// Set whether this class references 'super'.
693+
/// TODO(scheglov) Remove it.
692694
set hasReferenceToSuper(bool isReferencedSuper) {
693695
setModifier(Modifier.REFERENCES_SUPER, isReferencedSuper);
694696
}
@@ -782,9 +784,6 @@ class ClassElementImpl extends AbstractClassElementImpl
782784

783785
@override
784786
bool get isValidMixin {
785-
if (hasReferenceToSuper) {
786-
return false;
787-
}
788787
if (!supertype.isDartCoreObject) {
789788
return false;
790789
}
@@ -3402,6 +3401,7 @@ class EnumElementImpl extends AbstractClassElementImpl {
34023401
@override
34033402
bool get hasNonFinalField => false;
34043403

3404+
@Deprecated('It was used internally, should not be part of API')
34053405
@override
34063406
bool get hasReferenceToSuper => false;
34073407

pkg/analyzer/lib/src/dart/resolver/resolution_visitor.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ class ResolutionVisitor extends RecursiveAstVisitor<void> {
8585

8686
/// The flag specifying if currently visited class references 'super'
8787
/// expression.
88-
/// TODO(scheglov) put into summary
8988
bool _hasReferenceToSuper = false;
9089

9190
factory ResolutionVisitor({

pkg/analyzer/test/generated/simple_resolver_test.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,7 @@ void main() {
652652
);
653653
}
654654

655+
@Deprecated('It was used internally, should not be part of API')
655656
test_hasReferenceToSuper() async {
656657
await assertNoErrorsInCode(r'''
657658
class A {}
@@ -860,7 +861,7 @@ class C = Object with A;''');
860861
expect(a.isValidMixin, isTrue);
861862
}
862863

863-
test_isValidMixin_super() async {
864+
test_isValidMixin_super_toString() async {
864865
await assertNoErrorsInCode(r'''
865866
class A {
866867
toString() {
@@ -871,7 +872,7 @@ class C = Object with A;''');
871872
verifyTestResolved();
872873

873874
var a = findElement.class_('A');
874-
expect(a.isValidMixin, isFalse);
875+
expect(a.isValidMixin, isTrue);
875876
}
876877

877878
test_isValidMixin_valid() async {

0 commit comments

Comments
 (0)