blob: 40a62349c4ebeee5dd0fe2bac33fd1b674c9a464 [file] [log] [blame]
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/type.dart';
import 'package:dartdoc/src/element_type.dart';
import 'package:dartdoc/src/model/comment_referable.dart';
import 'package:dartdoc/src/model/model.dart';
import 'package:dartdoc/src/model_utils.dart' as model_utils;
import 'package:dartdoc/src/special_elements.dart';
import 'package:meta/meta.dart';
class Mixin extends InheritingContainer with TypeImplementing {
final MixinElement element;
late final List<ParameterizedElementType> superclassConstraints = [
.map((InterfaceType i) =>
modelBuilder.typeFrom(i, library) as ParameterizedElementType)
.where((t) =>
t.modelElement != packageGraph.specialClasses[SpecialClass.object])
String get sidebarPath =>
late final List<InheritingContainer> inheritanceChain = [
// Mix-in interfaces come before other interfaces.
for (var container in superChain.modelElements)
// Interfaces need to come last, because classes in the superChain might
// implement them even when they aren't mentioned.
Mixin(this.element, super.library, super.packageGraph);
Iterable<MapEntry<String, CommentReferable>> get extraReferenceChildren =>
const [];
bool get hasModifiers => super.hasModifiers || hasPublicSuperclassConstraints;
bool get hasPublicSuperclassConstraints =>
bool get isAbstract => false;
bool get isBase => element.isBase;
bool get isFinal => false;
bool get isInterface => false;
/// Mixins are not mixin classes by definition.
bool get isMixinClass => false;
bool get isSealed => false;
Kind get kind => Kind.mixin;
Iterable<ParameterizedElementType> get publicSuperclassConstraints =>
String get relationshipsClass => 'mixin-relationships';