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.dummy_mirror; | 5 library docgen.models.dummy_mirror; |
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 | 11 |
12 import 'indexable.dart'; | 12 import 'indexable.dart'; |
13 import 'model_helpers.dart'; | 13 import 'model_helpers.dart'; |
14 | 14 |
15 /// For types that we do not explicitly create or have not yet created in our | 15 /// For types that we do not explicitly create or have not yet created in our |
16 /// entity map (like core types). | 16 /// entity map (like core types). |
17 class DummyMirror implements Indexable { | 17 class DummyMirror implements Indexable { |
18 final DeclarationMirror mirror; | 18 final DeclarationMirror mirror; |
19 /// The library that contains this element, if any. Used as a hint to help | 19 /// The library that contains this element, if any. Used as a hint to help |
20 /// determine which object we're referring to when looking up this mirror in | 20 /// determine which object we're referring to when looking up this mirror in |
21 /// our map. | 21 /// our map. |
22 final Indexable owner; | 22 final Indexable owner; |
| 23 |
23 DummyMirror(this.mirror, [this.owner]); | 24 DummyMirror(this.mirror, [this.owner]); |
24 | 25 |
25 String get docName { | 26 String get docName { |
26 if (mirror == null) return ''; | 27 if (mirror == null) return ''; |
27 if (mirror is LibraryMirror) { | 28 if (mirror is LibraryMirror) { |
28 return dart2js_util.qualifiedNameOf(mirror).replaceAll('.', '-'); | 29 return dart2js_util.qualifiedNameOf(mirror).replaceAll('.', '-'); |
29 } | 30 } |
30 var mirrorOwner = mirror.owner; | 31 var mirrorOwner = mirror.owner; |
31 if (mirrorOwner == null) return dart2js_util.qualifiedNameOf(mirror); | 32 if (mirrorOwner == null) return dart2js_util.qualifiedNameOf(mirror); |
32 var simpleName = dart2js_util.nameOf(mirror); | 33 var simpleName = dart2js_util.nameOf(mirror); |
(...skipping 22 matching lines...) Expand all Loading... |
55 LibraryMirror _getOwningLibraryFromMirror(DeclarationMirror mirror) { | 56 LibraryMirror _getOwningLibraryFromMirror(DeclarationMirror mirror) { |
56 if (mirror is LibraryMirror) return mirror; | 57 if (mirror is LibraryMirror) return mirror; |
57 if (mirror == null) return null; | 58 if (mirror == null) return null; |
58 return _getOwningLibraryFromMirror(mirror.owner); | 59 return _getOwningLibraryFromMirror(mirror.owner); |
59 } | 60 } |
60 | 61 |
61 noSuchMethod(Invocation invocation) { | 62 noSuchMethod(Invocation invocation) { |
62 throw new UnimplementedError(invocation.memberName.toString()); | 63 throw new UnimplementedError(invocation.memberName.toString()); |
63 } | 64 } |
64 } | 65 } |
OLD | NEW |