@@ -19,7 +19,7 @@ export interface IApiItemContainerJson extends IApiItemJson {
1919
2020const _members : unique symbol = Symbol ( 'ApiItemContainerMixin._members' ) ;
2121const _membersSorted : unique symbol = Symbol ( 'ApiItemContainerMixin._membersSorted' ) ;
22- const _membersByCanonicalReference : unique symbol = Symbol ( 'ApiItemContainerMixin._membersByCanonicalReference ' ) ;
22+ const _membersByContainerKey : unique symbol = Symbol ( 'ApiItemContainerMixin._membersByContainerKey ' ) ;
2323const _membersByName : unique symbol = Symbol ( 'ApiItemContainerMixin._membersByName' ) ;
2424
2525/**
@@ -58,9 +58,15 @@ export interface ApiItemContainerMixin extends ApiItem {
5858 addMember ( member : ApiItem ) : void ;
5959
6060 /**
61- * Attempts to retrieve a member using its canonicalReference, or returns undefined if no matching member was found.
61+ * Attempts to retrieve a member using its containerKey, or returns `undefined` if no matching member was found.
62+ *
63+ * @remarks
64+ * Use the `getContainerKey()` static member to construct the key. Each subclass has a different implementation
65+ * of this function, according to the aspects that are important for identifying it.
66+ *
67+ * See {@link ApiItem.containerKey} for more information.
6268 */
63- tryGetMember ( canonicalReference : string ) : ApiItem | undefined ;
69+ tryGetMemberByKey ( containerKey : string ) : ApiItem | undefined ;
6470
6571 /**
6672 * Returns a list of members with the specified name.
@@ -85,7 +91,7 @@ export function ApiItemContainerMixin<TBaseClass extends IApiItemConstructor>(ba
8591 abstract class MixedClass extends baseClass implements ApiItemContainerMixin {
8692 public readonly [ _members ] : ApiItem [ ] ;
8793 public [ _membersSorted ] : boolean ;
88- public [ _membersByCanonicalReference ] : Map < string , ApiItem > ;
94+ public [ _membersByContainerKey ] : Map < string , ApiItem > ;
8995 public [ _membersByName ] : Map < string , ApiItem [ ] > | undefined ;
9096
9197 /** @override */
@@ -106,7 +112,7 @@ export function ApiItemContainerMixin<TBaseClass extends IApiItemConstructor>(ba
106112 const options : IApiItemContainerMixinOptions = args [ 0 ] as IApiItemContainerMixinOptions ;
107113
108114 this [ _members ] = [ ] ;
109- this [ _membersByCanonicalReference ] = new Map < string , ApiItem > ( ) ;
115+ this [ _membersByContainerKey ] = new Map < string , ApiItem > ( ) ;
110116
111117 if ( options . members ) {
112118 for ( const member of options . members ) {
@@ -125,8 +131,8 @@ export function ApiItemContainerMixin<TBaseClass extends IApiItemConstructor>(ba
125131 }
126132
127133 public addMember ( member : ApiItem ) : void {
128- if ( this [ _membersByCanonicalReference ] . has ( member . canonicalReference ) ) {
129- throw new Error ( 'Another member has already been added with the same name and canonicalReference ' ) ;
134+ if ( this [ _membersByContainerKey ] . has ( member . containerKey ) ) {
135+ throw new Error ( 'Another member has already been added with the same name and containerKey ' ) ;
130136 }
131137
132138 const existingParent : ApiItem | undefined = member [ ApiItem_parent ] ;
@@ -137,13 +143,13 @@ export function ApiItemContainerMixin<TBaseClass extends IApiItemConstructor>(ba
137143 this [ _members ] . push ( member ) ;
138144 this [ _membersByName ] = undefined ; // invalidate the lookup
139145 this [ _membersSorted ] = false ;
140- this [ _membersByCanonicalReference ] . set ( member . canonicalReference , member ) ;
146+ this [ _membersByContainerKey ] . set ( member . containerKey , member ) ;
141147
142148 member [ ApiItem_parent ] = this ;
143149 }
144150
145- public tryGetMember ( canonicalReference : string ) : ApiItem | undefined {
146- return this [ _membersByCanonicalReference ] . get ( canonicalReference ) ;
151+ public tryGetMemberByKey ( containerKey : string ) : ApiItem | undefined {
152+ return this [ _membersByContainerKey ] . get ( containerKey ) ;
147153 }
148154
149155 public findMembersByName ( name : string ) : ReadonlyArray < ApiItem > {
0 commit comments