| Index: pkg/docgen/lib/src/models/owned_indexable.dart
|
| diff --git a/pkg/docgen/lib/src/models/owned_indexable.dart b/pkg/docgen/lib/src/models/owned_indexable.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..1df771e3c8d60212ff1a89239addd1826bf707cd
|
| --- /dev/null
|
| +++ b/pkg/docgen/lib/src/models/owned_indexable.dart
|
| @@ -0,0 +1,51 @@
|
| +// Copyright (c) 2014, 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.
|
| +
|
| +library docgen.models.owned_indexable;
|
| +
|
| +import '../exports/mirrors_util.dart' as dart2js_util;
|
| +import '../exports/source_mirrors.dart';
|
| +
|
| +import '../library_helpers.dart';
|
| +import '../mdn.dart';
|
| +import '../package_helpers.dart';
|
| +
|
| +import 'annotation.dart';
|
| +import 'indexable.dart';
|
| +import 'model_helpers.dart';
|
| +
|
| +abstract class OwnedIndexable<TMirror extends DeclarationMirror>
|
| + extends Indexable<TMirror> {
|
| + /// List of the meta annotations on this item.
|
| + final List<Annotation> annotations;
|
| +
|
| + /// The object one scope-level above which this item is defined.
|
| + ///
|
| + /// Ex: The owner for a top level class, would be its enclosing library.
|
| + /// The owner of a local variable in a method would be the enclosing method.
|
| + final Indexable owner;
|
| +
|
| + /// Returns this object's qualified name, but following the conventions
|
| + /// we're using in Dartdoc, which is that library names with dots in them
|
| + /// have them replaced with hyphens.
|
| + String get docName => owner.docName + '.' + dart2js_util.nameOf(mirror);
|
| +
|
| + OwnedIndexable(DeclarationMirror mirror, Indexable owner)
|
| + : annotations = createAnnotations(mirror, owner.owningLibrary),
|
| + this.owner = owner,
|
| + super(mirror);
|
| +
|
| + /// Generates MDN comments from database.json.
|
| + String getMdnComment() {
|
| + var domAnnotation = this.annotations.firstWhere(
|
| + (e) => e.mirror.qualifiedName == #metadata.DomName,
|
| + orElse: () => null);
|
| + if (domAnnotation == null) return '';
|
| + var domName = domAnnotation.parameters.single;
|
| +
|
| + return mdnComment(rootDirectory, logger, domName);
|
| + }
|
| +
|
| + String get packagePrefix => owner.packagePrefix;
|
| +}
|
|
|