@@ -283,10 +283,10 @@ namespace ts {
283
283
}
284
284
}
285
285
286
- enum ContextualDocumentationType {
287
- None = "None" ,
288
- GetAccessor = "GetAccessor" ,
289
- SetAccessor = "SetAccessor"
286
+ const enum ContextualDocumentationType {
287
+ None ,
288
+ GetAccessor ,
289
+ SetAccessor
290
290
}
291
291
292
292
class SymbolObject implements Symbol {
@@ -299,7 +299,8 @@ namespace ts {
299
299
// symbol has no doc comment, then the empty array will be returned.
300
300
documentationComment ?: SymbolDisplayPart [ ] ;
301
301
302
- contextualDocumentationComment ?: Map < SymbolDisplayPart [ ] > ;
302
+ contextualGetAccessorDocumentationComment ?: SymbolDisplayPart [ ] ;
303
+ contextualSetAccessorDocumentationComment ?: SymbolDisplayPart [ ] ;
303
304
304
305
// Undefined is used to indicate the value has not been computed. If, after computing, the
305
306
// symbol has no JSDoc tags, then the empty array will be returned.
@@ -341,24 +342,22 @@ namespace ts {
341
342
getContextualDocumentationComment ( context : Node | undefined , checker : TypeChecker | undefined ) : SymbolDisplayPart [ ] {
342
343
switch ( context ?. kind ) {
343
344
case SyntaxKind . GetAccessor :
344
- return this . getContextualDocumentationCommentCached ( ContextualDocumentationType . GetAccessor , filter ( this . declarations , isGetAccessor ) , checker ) ;
345
+ if ( ! this . contextualGetAccessorDocumentationComment ) {
346
+ this . contextualGetAccessorDocumentationComment = emptyArray ;
347
+ this . contextualGetAccessorDocumentationComment = getDocumentationComment ( filter ( this . declarations , isGetAccessor ) , checker ) ;
348
+ }
349
+ return this . contextualGetAccessorDocumentationComment
345
350
case SyntaxKind . SetAccessor :
346
- return this . getContextualDocumentationCommentCached ( ContextualDocumentationType . SetAccessor , filter ( this . declarations , isSetAccessor ) , checker ) ;
351
+ if ( ! this . contextualSetAccessorDocumentationComment ) {
352
+ this . contextualSetAccessorDocumentationComment = emptyArray ;
353
+ this . contextualSetAccessorDocumentationComment = getDocumentationComment ( filter ( this . declarations , isSetAccessor ) , checker ) ;
354
+ }
355
+ return this . contextualSetAccessorDocumentationComment
347
356
default :
348
357
return this . getDocumentationComment ( checker ) ;
349
358
}
350
359
}
351
360
352
- getContextualDocumentationCommentCached ( type : ContextualDocumentationType , declarations : Declaration [ ] , checker : TypeChecker | undefined ) : SymbolDisplayPart [ ] {
353
- if ( ! this . contextualDocumentationComment ) {
354
- this . contextualDocumentationComment = createMultiMap < SymbolDisplayPart > ( ) ;
355
- }
356
- if ( ! this . contextualDocumentationComment . has ( type ) ) {
357
- this . contextualDocumentationComment . set ( type , getDocumentationComment ( declarations , checker ) ) ;
358
- }
359
- return this . contextualDocumentationComment . get ( type ) ! ;
360
- }
361
-
362
361
getJsDocTags ( ) : JSDocTagInfo [ ] {
363
362
if ( this . tags === undefined ) {
364
363
this . tags = JsDoc . getJsDocTagsFromDeclarations ( this . declarations ) ;
0 commit comments