@@ -176,10 +176,10 @@ class ResolverImpl(
176
176
}
177
177
}
178
178
179
- override fun getSymbolsWithAnnotation (annotationName : String ): List <KSAnnotated > {
179
+ override fun getSymbolsWithAnnotation (annotationName : String , inDepth : Boolean ): List <KSAnnotated > {
180
180
val ksName = KSNameImpl .getCached(annotationName)
181
181
182
- val visitor = object : BaseVisitor () {
182
+ val visitor = object : KSVisitorVoid () {
183
183
val symbols = mutableSetOf<KSAnnotated >()
184
184
override fun visitAnnotated (annotated : KSAnnotated , data : Unit ) {
185
185
if (annotated.annotations.any {
@@ -192,31 +192,46 @@ class ResolverImpl(
192
192
}
193
193
}
194
194
195
- override fun visitClassDeclaration (type : KSClassDeclaration , data : Unit ) {
196
- visitAnnotated(type, data)
197
- super .visitClassDeclaration(type, data)
195
+ override fun visitFile (file : KSFile , data : Unit ) {
196
+ visitAnnotated(file, data)
197
+ file.declarations.map { it.accept(this , data) }
198
+ }
199
+
200
+ override fun visitClassDeclaration (classDeclaration : KSClassDeclaration , data : Unit ) {
201
+ visitAnnotated(classDeclaration, data)
202
+ classDeclaration.typeParameters.map { it.accept(this , data) }
203
+ classDeclaration.declarations.map { it.accept(this , data) }
204
+ classDeclaration.primaryConstructor?.let { it.accept(this , data) }
205
+ }
206
+
207
+ override fun visitPropertyGetter (getter : KSPropertyGetter , data : Unit ) {
208
+ visitAnnotated(getter, data)
209
+ }
210
+
211
+ override fun visitPropertySetter (setter : KSPropertySetter , data : Unit ) {
212
+ visitAnnotated(setter, data)
198
213
}
199
214
200
215
override fun visitFunctionDeclaration (function : KSFunctionDeclaration , data : Unit ) {
201
216
visitAnnotated(function, data)
202
- super .visitFunctionDeclaration(function, data)
217
+ function.typeParameters.map { it.accept(this , data) }
218
+ function.parameters.map { it.accept(this , data) }
219
+ if (inDepth) {
220
+ function.declarations.map { it.accept(this , data) }
221
+ }
203
222
}
204
223
205
224
override fun visitPropertyDeclaration (property : KSPropertyDeclaration , data : Unit ) {
206
225
visitAnnotated(property, data)
207
- super .visitPropertyDeclaration(property, data)
226
+ property.typeParameters.map { it.accept(this , data) }
227
+ property.getter?.let { it.accept(this , data) }
228
+ property.setter?.let { it.accept(this , data) }
208
229
}
209
230
210
231
override fun visitTypeParameter (typeParameter : KSTypeParameter , data : Unit ) {
211
232
visitAnnotated(typeParameter, data)
212
233
super .visitTypeParameter(typeParameter, data)
213
234
}
214
-
215
- override fun visitTypeReference (typeReference : KSTypeReference , data : Unit ) {
216
- visitAnnotated(typeReference, data)
217
- super .visitTypeReference(typeReference, data)
218
- }
219
-
220
235
}
221
236
222
237
for (file in ksFiles) {
0 commit comments