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

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

Issue 1364553002: remove docgen source and targets from build (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: remove scripts Created 5 years, 2 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
« no previous file with comments | « pkg/docgen/lib/src/models/model_helpers.dart ('k') | pkg/docgen/lib/src/models/parameter.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 'dummy_mirror.dart';
16 import 'indexable.dart';
17 import 'model_helpers.dart';
18
19 abstract class OwnedIndexable<TMirror extends DeclarationMirror>
20 extends Indexable<TMirror> {
21 /// List of the meta annotations on this item.
22 final List<Annotation> annotations;
23
24 /// The object one scope-level above which this item is defined.
25 ///
26 /// Ex: The owner for a top level class, would be its enclosing library.
27 /// The owner of a local variable in a method would be the enclosing method.
28 final Indexable owner;
29
30 /// Returns this object's qualified name, but following the conventions
31 /// we're using in Dartdoc, which is that library names with dots in them
32 /// have them replaced with hyphens.
33 String get docName => owner.docName + '.' + dart2js_util.nameOf(mirror);
34
35 OwnedIndexable(DeclarationMirror mirror, Indexable owner)
36 : annotations = createAnnotations(mirror, owner.owningLibrary),
37 this.owner = owner,
38 super(mirror);
39
40 /// Generates MDN comments from database.json.
41 String getMdnComment() {
42 var domAnnotation = this.annotations.firstWhere(
43 (e) => e.mirror.qualifiedName == #metadata.DomName,
44 orElse: () => null);
45 if (domAnnotation == null) return '';
46 var domName = domAnnotation.parameters.single;
47
48 return mdnComment(rootDirectory, logger, domName);
49 }
50
51 String get packagePrefix => owner.packagePrefix;
52
53 String findElementInScope(String name) {
54 var lookupFunc = determineLookupFunc(name);
55 var result = lookupFunc(mirror, name);
56 if (result != null) {
57 result = getDocgenObject(result);
58 if (result is DummyMirror) return packagePrefix + result.docName;
59 return result.packagePrefix + result.docName;
60 }
61
62 if (owner != null) {
63 var result = owner.findElementInScope(name);
64 if (result != null) {
65 return result;
66 }
67 }
68 return super.findElementInScope(name);
69 }
70 }
OLDNEW
« no previous file with comments | « pkg/docgen/lib/src/models/model_helpers.dart ('k') | pkg/docgen/lib/src/models/parameter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698