OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library docgen.models.owned_indexable; | 5 library docgen.models.owned_indexable; |
6 | 6 |
7 import '../exports/mirrors_util.dart' as dart2js_util; | 7 import '../exports/mirrors_util.dart' as dart2js_util; |
8 import '../exports/source_mirrors.dart'; | 8 import '../exports/source_mirrors.dart'; |
9 | 9 |
10 import '../library_helpers.dart'; | 10 import '../library_helpers.dart'; |
11 import '../mdn.dart'; | 11 import '../mdn.dart'; |
12 import '../package_helpers.dart'; | 12 import '../package_helpers.dart'; |
13 | 13 |
14 import 'annotation.dart'; | 14 import 'annotation.dart'; |
| 15 import 'dummy_mirror.dart'; |
15 import 'indexable.dart'; | 16 import 'indexable.dart'; |
16 import 'model_helpers.dart'; | 17 import 'model_helpers.dart'; |
17 | 18 |
18 abstract class OwnedIndexable<TMirror extends DeclarationMirror> | 19 abstract class OwnedIndexable<TMirror extends DeclarationMirror> |
19 extends Indexable<TMirror> { | 20 extends Indexable<TMirror> { |
20 /// List of the meta annotations on this item. | 21 /// List of the meta annotations on this item. |
21 final List<Annotation> annotations; | 22 final List<Annotation> annotations; |
22 | 23 |
23 /// The object one scope-level above which this item is defined. | 24 /// The object one scope-level above which this item is defined. |
24 /// | 25 /// |
(...skipping 16 matching lines...) Expand all Loading... |
41 var domAnnotation = this.annotations.firstWhere( | 42 var domAnnotation = this.annotations.firstWhere( |
42 (e) => e.mirror.qualifiedName == #metadata.DomName, | 43 (e) => e.mirror.qualifiedName == #metadata.DomName, |
43 orElse: () => null); | 44 orElse: () => null); |
44 if (domAnnotation == null) return ''; | 45 if (domAnnotation == null) return ''; |
45 var domName = domAnnotation.parameters.single; | 46 var domName = domAnnotation.parameters.single; |
46 | 47 |
47 return mdnComment(rootDirectory, logger, domName); | 48 return mdnComment(rootDirectory, logger, domName); |
48 } | 49 } |
49 | 50 |
50 String get packagePrefix => owner.packagePrefix; | 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 } |
51 } | 70 } |
OLD | NEW |