@@ -109,6 +109,7 @@ open class KotlinBasicIdentListener(private val fileName: String) : KotlinAstLis
109109 currentNode = buildClass(ctx)
110110 }
111111
112+
112113 open fun buildClass (ctx : KotlinParser .ClassDeclarationContext ): CodeDataStruct {
113114 val implements = ctx.delegationSpecifiers()?.text?.let (::getTypeFullName)?.let (::listOf) ? : emptyList()
114115 val annotations = ctx.modifiers().getAnnotations()
@@ -139,6 +140,29 @@ open class KotlinBasicIdentListener(private val fileName: String) : KotlinAstLis
139140 isEnteredClass.decrementAndGet()
140141 }
141142
143+ override fun enterObjectDeclaration (ctx : KotlinParser .ObjectDeclarationContext ? ) {
144+ isEnteredClass.incrementAndGet()
145+ currentNode = buildObject(ctx!! )
146+ }
147+
148+ private fun buildObject (ctx : KotlinParser .ObjectDeclarationContext ): CodeDataStruct {
149+ val annotations = ctx.modifiers().getAnnotations()
150+ return CodeDataStruct ().apply {
151+ NodeName = ctx.simpleIdentifier().Identifier ().text
152+ Type = DataStructType .OBJECT
153+ Package = codeContainer.PackageName
154+ FilePath = codeContainer.FullName
155+ Annotations = annotations
156+ Imports = imports
157+ Position = buildPosition(ctx)
158+ }
159+ }
160+
161+ override fun exitObjectDeclaration (ctx : KotlinParser .ObjectDeclarationContext ? ) {
162+ classes.add(currentNode)
163+ isEnteredClass.decrementAndGet()
164+ }
165+
142166 override fun enterPrimaryConstructor (ctx : KotlinParser .PrimaryConstructorContext ) {
143167 val parameters = ctx.classParameters().classParameter().map(::buildProperty)
144168 val fields = ctx.classParameters().classParameter().mapNotNull(::buildField)
0 commit comments