Skip to content

Commit 2bbe649

Browse files
authored
Drop support for final, interface, and sealed mixins (#3369)
1 parent 7fde7a4 commit 2bbe649

File tree

7 files changed

+1686
-1698
lines changed

7 files changed

+1686
-1698
lines changed

lib/resources/docs.dart.js

Lines changed: 1669 additions & 1677 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/resources/docs.dart.js.map

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/src/element_type.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class UndefinedElementType extends ElementType {
101101

102102
@override
103103
String get name {
104-
if (type.isVoid) return 'void';
104+
if (type is VoidType) return 'void';
105105
if (type.isDynamic) return 'dynamic';
106106
assert(const {'Never'}.contains(typeElement!.name),
107107
'Unrecognized type for UndefinedElementType: ${type.toString()}');
@@ -436,7 +436,7 @@ class GenericTypeAliasElementType extends TypeParameterElementType {
436436
extension on DartType {
437437
/// The dartdoc nullability suffix for this type in [library].
438438
String nullabilitySuffixWithin(Library library) {
439-
if (!isVoid && !isBottom) {
439+
if (this is! VoidType && !isBottom) {
440440
/// If a legacy type appears inside the public interface of a Null
441441
/// safety library, we pretend it is nullable for the purpose of
442442
/// documentation (since star-types are not supposed to be public).

lib/src/generator/templates.runtime_renderers.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15982,6 +15982,7 @@ const _invisibleGetters = {
1598215982
'nonSynthetic',
1598315983
'runtimeType',
1598415984
'session',
15985+
'sinceSdkVersion',
1598515986
'source'
1598615987
},
1598715988
'ElementAnnotation': {
@@ -16074,6 +16075,7 @@ const _invisibleGetters = {
1607416075
'returnType',
1607516076
'runtimeType',
1607616077
'session',
16078+
'sinceSdkVersion',
1607716079
'substitution',
1607816080
'type',
1607916081
'typeParameters'
@@ -16314,6 +16316,7 @@ const _invisibleGetters = {
1631416316
'nonSynthetic',
1631516317
'runtimeType',
1631616318
'session',
16319+
'sinceSdkVersion',
1631716320
'substitution'
1631816321
},
1631916322
'MethodElement': {'augmentation', 'declaration', 'hashCode', 'runtimeType'},
@@ -16483,6 +16486,7 @@ const _invisibleGetters = {
1648316486
'parameters',
1648416487
'runtimeType',
1648516488
'session',
16489+
'sinceSdkVersion',
1648616490
'source',
1648716491
'substitution',
1648816492
'type',

lib/src/model/extension.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// BSD-style license that can be found in the LICENSE file.
44

55
import 'package:analyzer/dart/element/element.dart';
6+
import 'package:analyzer/dart/element/type.dart';
67
import 'package:dartdoc/src/element_type.dart';
78
import 'package:dartdoc/src/model/comment_referable.dart';
89
import 'package:dartdoc/src/model/extension_target.dart';
@@ -23,7 +24,7 @@ class Extension extends Container implements EnclosedElement {
2324
/// Detect if this extension applies to every object.
2425
bool get alwaysApplies =>
2526
extendedType.instantiatedType.isDynamic ||
26-
extendedType.instantiatedType.isVoid ||
27+
extendedType.instantiatedType is VoidType ||
2728
extendedType.instantiatedType.isDartCoreObject;
2829

2930
bool couldApplyTo<T extends ExtensionTarget>(T c) =>
@@ -32,7 +33,7 @@ class Extension extends Container implements EnclosedElement {
3233
/// Whether this extension could apply to [type].
3334
bool _couldApplyTo(DefinedElementType type) {
3435
if (extendedType.instantiatedType.isDynamic ||
35-
extendedType.instantiatedType.isVoid) {
36+
extendedType.instantiatedType is VoidType) {
3637
return true;
3738
}
3839
var typeInstantiated = type.instantiatedType;

lib/src/model/mixin.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,18 @@ class Mixin extends InheritingContainer with TypeImplementing {
6161
bool get isBase => element.isBase;
6262

6363
@override
64-
bool get isFinal => element.isFinal;
64+
bool get isFinal => false;
6565

6666
@override
67-
bool get isInterface => element.isInterface;
67+
bool get isInterface => false;
6868

6969
@override
7070

7171
/// Mixins are not mixin classes by definition.
7272
bool get isMixinClass => false;
7373

7474
@override
75-
bool get isSealed => element.isSealed;
75+
bool get isSealed => false;
7676

7777
@override
7878
String get kind => 'mixin';

test/class_modifiers_test.dart

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,6 @@ abstract mixin class L {}
4545
abstract base mixin class M {}
4646
mixin N {}
4747
base mixin O {}
48-
interface mixin P {}
49-
final mixin Q {}
50-
sealed mixin R {}
5148
''');
5249
// This almost seems worth a map and loop, but leaving expanded for now for
5350
// test clarity.
@@ -66,9 +63,6 @@ sealed mixin R {}
6663
var Mclass = library.classes.named('M');
6764
var Nmixin = library.mixins.named('N');
6865
var Omixin = library.mixins.named('O');
69-
var Pmixin = library.mixins.named('P');
70-
var Qmixin = library.mixins.named('Q');
71-
var Rmixin = library.mixins.named('R');
7266
expect(Aclass.fullkind, equals('class'));
7367
expect(Bclass.fullkind, equals('base class'));
7468
expect(Cclass.fullkind, equals('interface class'));
@@ -84,8 +78,5 @@ sealed mixin R {}
8478
expect(Mclass.fullkind, equals('abstract base mixin class'));
8579
expect(Nmixin.fullkind, equals('mixin'));
8680
expect(Omixin.fullkind, equals('base mixin'));
87-
expect(Pmixin.fullkind, equals('interface mixin'));
88-
expect(Qmixin.fullkind, equals('final mixin'));
89-
expect(Rmixin.fullkind, equals('sealed mixin'));
9081
}
9182
}

0 commit comments

Comments
 (0)