@@ -33,6 +33,11 @@ module td
33
33
*/
34
34
private comments :{ [ id :number ] :IModuleComment } ;
35
35
36
+ /**
37
+ * List of hidden reflections.
38
+ */
39
+ private hidden :Reflection [ ] ;
40
+
36
41
37
42
/**
38
43
* Create a new CommentPlugin instance.
@@ -134,6 +139,11 @@ module td
134
139
reflection . setFlag ( ReflectionFlag . Public ) ;
135
140
CommentPlugin . removeTags ( comment , 'public' ) ;
136
141
}
142
+
143
+ if ( comment . hasTag ( 'hidden' ) ) {
144
+ if ( ! this . hidden ) this . hidden = [ ] ;
145
+ this . hidden . push ( reflection ) ;
146
+ }
137
147
}
138
148
139
149
@@ -160,8 +170,15 @@ module td
160
170
var comment = CommentPlugin . parseComment ( info . fullText ) ;
161
171
CommentPlugin . removeTags ( comment , 'preferred' ) ;
162
172
173
+ this . applyAccessModifiers ( info . reflection , comment ) ;
163
174
info . reflection . comment = comment ;
164
175
}
176
+
177
+ if ( this . hidden ) {
178
+ this . hidden . forEach ( ( reflection ) => {
179
+ CommentPlugin . removeReflection ( event . getProject ( ) , reflection ) ;
180
+ } ) ;
181
+ }
165
182
}
166
183
167
184
@@ -300,6 +317,67 @@ module td
300
317
}
301
318
302
319
320
+ /**
321
+ * Remove the given reflection from the project.
322
+ */
323
+ static removeReflection ( project :ProjectReflection , reflection :Reflection ) {
324
+ reflection . traverse ( ( child ) => CommentPlugin . removeReflection ( project , child ) ) ;
325
+
326
+ var parent = < DeclarationReflection > reflection . parent ;
327
+ parent . traverse ( ( child :Reflection , property :TraverseProperty ) => {
328
+ if ( child == reflection ) {
329
+ switch ( property ) {
330
+ case TraverseProperty . Children :
331
+ if ( parent . children ) {
332
+ var index = parent . children . indexOf ( < DeclarationReflection > reflection ) ;
333
+ if ( index != - 1 ) parent . children . splice ( index , 1 ) ;
334
+ }
335
+ break ;
336
+ case TraverseProperty . GetSignature :
337
+ delete parent . getSignature ;
338
+ break ;
339
+ case TraverseProperty . IndexSignature :
340
+ delete parent . indexSignature ;
341
+ break ;
342
+ case TraverseProperty . Parameters :
343
+ if ( ( < SignatureReflection > reflection . parent ) . parameters ) {
344
+ var index = ( < SignatureReflection > reflection . parent ) . parameters . indexOf ( < ParameterReflection > reflection ) ;
345
+ if ( index != - 1 ) ( < SignatureReflection > reflection . parent ) . parameters . splice ( index , 1 ) ;
346
+ }
347
+ break ;
348
+ case TraverseProperty . SetSignature :
349
+ delete parent . setSignature ;
350
+ break ;
351
+ case TraverseProperty . Signatures :
352
+ if ( parent . signatures ) {
353
+ var index = parent . signatures . indexOf ( < SignatureReflection > reflection ) ;
354
+ if ( index != - 1 ) parent . signatures . splice ( index , 1 ) ;
355
+ }
356
+ break ;
357
+ case TraverseProperty . TypeLiteral :
358
+ parent . type = new IntrinsicType ( 'Object' ) ;
359
+ break ;
360
+ case TraverseProperty . TypeParameter :
361
+ if ( parent . typeParameters ) {
362
+ var index = parent . typeParameters . indexOf ( < TypeParameterReflection > reflection ) ;
363
+ if ( index != - 1 ) parent . typeParameters . splice ( index , 1 ) ;
364
+ }
365
+ break ;
366
+ }
367
+ }
368
+ } ) ;
369
+
370
+ var id = reflection . id ;
371
+ delete project . reflections [ id ] ;
372
+
373
+ for ( var key in project . symbolMapping ) {
374
+ if ( project . symbolMapping . hasOwnProperty ( key ) && project . symbolMapping [ key ] == id ) {
375
+ delete project . symbolMapping [ key ] ;
376
+ }
377
+ }
378
+ }
379
+
380
+
303
381
/**
304
382
* Parse the given doc comment string.
305
383
*
0 commit comments