| 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 or factory: | 33 /// Procedure that is not an accessor: |
| 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 /// | |
| 53 /// Qualified name: | 48 /// Qualified name: |
| 54 /// if private: URI of library | 49 /// if private: URI of library |
| 55 /// Name text | 50 /// Name text |
| 56 /// | 51 /// |
| 57 /// The "qualified name" allows a member to have a name that is private to | 52 /// The "qualified name" allows a member to have a name that is private to |
| 58 /// a library other than the one containing that member. | 53 /// a library other than the one containing that member. |
| 59 class CanonicalName { | 54 class CanonicalName { |
| 60 final CanonicalName parent; | 55 final CanonicalName parent; |
| 61 final String name; | 56 final String name; |
| 62 | 57 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 String toString() => parent == null ? 'root' : '$parent::$name'; | 129 String toString() => parent == null ? 'root' : '$parent::$name'; |
| 135 | 130 |
| 136 Reference getReference() { | 131 Reference getReference() { |
| 137 return reference ??= (new Reference()..canonicalName = this); | 132 return reference ??= (new Reference()..canonicalName = this); |
| 138 } | 133 } |
| 139 | 134 |
| 140 static String getMemberQualifier(Member member) { | 135 static String getMemberQualifier(Member member) { |
| 141 if (member is Procedure) { | 136 if (member is Procedure) { |
| 142 if (member.isGetter) return '@getters'; | 137 if (member.isGetter) return '@getters'; |
| 143 if (member.isSetter) return '@setters'; | 138 if (member.isSetter) return '@setters'; |
| 144 if (member.isFactory) return '@factories'; | |
| 145 return '@methods'; | 139 return '@methods'; |
| 146 } | 140 } |
| 147 if (member is Field) { | 141 if (member is Field) { |
| 148 return '@fields'; | 142 return '@fields'; |
| 149 } | 143 } |
| 150 if (member is Constructor) { | 144 if (member is Constructor) { |
| 151 return '@constructors'; | 145 return '@constructors'; |
| 152 } | 146 } |
| 153 throw 'Unexpected member: $member'; | 147 throw 'Unexpected member: $member'; |
| 154 } | 148 } |
| 155 } | 149 } |
| OLD | NEW |