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

Side by Side Diff: pkg/docgen/lib/src/models/owned_indexable.dart

Issue 242363004: pkg/docgen: moved model classes into minilibs (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 library docgen.models.owned_indexable;
2
3 import '../exports/mirrors_util.dart' as dart2js_util;
4 import '../exports/source_mirrors.dart';
5
6 import '../library_helpers.dart';
7 import '../mdn.dart';
8 import '../package_helpers.dart';
9
10 import 'annotation.dart';
11 import 'indexable.dart';
12 import 'model_helpers.dart';
13
14 abstract class OwnedIndexable<TMirror extends DeclarationMirror>
15 extends Indexable<TMirror> {
16 /// List of the meta annotations on this item.
17 final List<Annotation> annotations;
18
19 /// The object one scope-level above which this item is defined.
20 ///
21 /// Ex: The owner for a top level class, would be its enclosing library.
22 /// The owner of a local variable in a method would be the enclosing method.
23 final Indexable owner;
24
25 /// Returns this object's qualified name, but following the conventions
26 /// we're using in Dartdoc, which is that library names with dots in them
27 /// have them replaced with hyphens.
28 String get docName => owner.docName + '.' + dart2js_util.nameOf(mirror);
29
30 OwnedIndexable(DeclarationMirror mirror, Indexable owner)
31 : annotations = createAnnotations(mirror, owner.owningLibrary),
32 this.owner = owner,
33 super(mirror);
34
35 /// Generates MDN comments from database.json.
36 String getMdnComment() {
37 var domAnnotation = this.annotations.firstWhere(
38 (e) => e.mirror.qualifiedName == #metadata.DomName,
39 orElse: () => null);
40 if (domAnnotation == null) return '';
41 var domName = domAnnotation.parameters.single;
42
43 return mdnComment(rootDirectory, logger, domName);
44 }
45
46 String get packagePrefix => owner.packagePrefix;
47 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698