OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 library kernel.canonical_name; | 4 library kernel.canonical_name; |
5 | 5 |
6 import 'ast.dart'; | 6 import 'ast.dart'; |
7 | 7 |
8 /// A string sequence that identifies a library, class, or member. | 8 /// A string sequence that identifies a library, class, or member. |
9 /// | 9 /// |
10 /// Canonical names are organized in a prefix tree. Each node knows its | 10 /// Canonical names are organized in a prefix tree. Each node knows its |
(...skipping 12 matching lines...) Expand all Loading... |
23 /// Constructor: | 23 /// Constructor: |
24 /// Canonical name of enclosing class or library | 24 /// Canonical name of enclosing class or library |
25 /// "@constructors" | 25 /// "@constructors" |
26 /// Qualified name | 26 /// Qualified name |
27 /// | 27 /// |
28 /// Field: | 28 /// Field: |
29 /// Canonical name of enclosing class or library | 29 /// Canonical name of enclosing class or library |
30 /// "@fields" | 30 /// "@fields" |
31 /// Qualified name | 31 /// Qualified name |
32 /// | 32 /// |
33 /// Procedure that is not an accessor: | 33 /// Procedure that is not an accessor or factory: |
34 /// Canonical name of enclosing class or library | 34 /// Canonical name of enclosing class or library |
35 /// "@methods" | 35 /// "@methods" |
36 /// Qualified name | 36 /// Qualified name |
37 /// | 37 /// |
38 /// Procedure that is a getter: | 38 /// Procedure that is a getter: |
39 /// Canonical name of enclosing class or library | 39 /// Canonical name of enclosing class or library |
40 /// "@getters" | 40 /// "@getters" |
41 /// Qualified name | 41 /// Qualified name |
42 /// | 42 /// |
43 /// Procedure that is a setter: | 43 /// Procedure that is a setter: |
44 /// Canonical name of enclosing class or library | 44 /// Canonical name of enclosing class or library |
45 /// "@setters" | 45 /// "@setters" |
46 /// Qualified name | 46 /// Qualified name |
47 /// | 47 /// |
| 48 /// Procedure that is a factory: |
| 49 /// Canonical name of enclosing class |
| 50 /// "@factories" |
| 51 /// Qualified name |
| 52 /// |
48 /// Qualified name: | 53 /// Qualified name: |
49 /// if private: URI of library | 54 /// if private: URI of library |
50 /// Name text | 55 /// Name text |
51 /// | 56 /// |
52 /// The "qualified name" allows a member to have a name that is private to | 57 /// The "qualified name" allows a member to have a name that is private to |
53 /// a library other than the one containing that member. | 58 /// a library other than the one containing that member. |
54 class CanonicalName { | 59 class CanonicalName { |
55 final CanonicalName parent; | 60 final CanonicalName parent; |
56 final String name; | 61 final String name; |
57 | 62 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 String toString() => parent == null ? 'root' : '$parent::$name'; | 134 String toString() => parent == null ? 'root' : '$parent::$name'; |
130 | 135 |
131 Reference getReference() { | 136 Reference getReference() { |
132 return reference ??= (new Reference()..canonicalName = this); | 137 return reference ??= (new Reference()..canonicalName = this); |
133 } | 138 } |
134 | 139 |
135 static String getMemberQualifier(Member member) { | 140 static String getMemberQualifier(Member member) { |
136 if (member is Procedure) { | 141 if (member is Procedure) { |
137 if (member.isGetter) return '@getters'; | 142 if (member.isGetter) return '@getters'; |
138 if (member.isSetter) return '@setters'; | 143 if (member.isSetter) return '@setters'; |
| 144 if (member.isFactory) return '@factories'; |
139 return '@methods'; | 145 return '@methods'; |
140 } | 146 } |
141 if (member is Field) { | 147 if (member is Field) { |
142 return '@fields'; | 148 return '@fields'; |
143 } | 149 } |
144 if (member is Constructor) { | 150 if (member is Constructor) { |
145 return '@constructors'; | 151 return '@constructors'; |
146 } | 152 } |
147 throw 'Unexpected member: $member'; | 153 throw 'Unexpected member: $member'; |
148 } | 154 } |
149 } | 155 } |
OLD | NEW |