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

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: cl nits 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 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 library docgen.models.owned_indexable;
6
7 import '../exports/mirrors_util.dart' as dart2js_util;
8 import '../exports/source_mirrors.dart';
9
10 import '../library_helpers.dart';
11 import '../mdn.dart';
12 import '../package_helpers.dart';
13
14 import 'annotation.dart';
15 import 'indexable.dart';
16 import 'model_helpers.dart';
17
18 abstract class OwnedIndexable<TMirror extends DeclarationMirror>
19 extends Indexable<TMirror> {
20 /// List of the meta annotations on this item.
21 final List<Annotation> annotations;
22
23 /// The object one scope-level above which this item is defined.
24 ///
25 /// Ex: The owner for a top level class, would be its enclosing library.
26 /// The owner of a local variable in a method would be the enclosing method.
27 final Indexable owner;
28
29 /// Returns this object's qualified name, but following the conventions
30 /// we're using in Dartdoc, which is that library names with dots in them
31 /// have them replaced with hyphens.
32 String get docName => owner.docName + '.' + dart2js_util.nameOf(mirror);
33
34 OwnedIndexable(DeclarationMirror mirror, Indexable owner)
35 : annotations = createAnnotations(mirror, owner.owningLibrary),
36 this.owner = owner,
37 super(mirror);
38
39 /// Generates MDN comments from database.json.
40 String getMdnComment() {
41 var domAnnotation = this.annotations.firstWhere(
42 (e) => e.mirror.qualifiedName == #metadata.DomName,
43 orElse: () => null);
44 if (domAnnotation == null) return '';
45 var domName = domAnnotation.parameters.single;
46
47 return mdnComment(rootDirectory, logger, domName);
48 }
49
50 String get packagePrefix => owner.packagePrefix;
51 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698