diff --git a/chapi-ast-typescript/src/main/kotlin/chapi/ast/typescriptast/TypeScriptFullIdentListener.kt b/chapi-ast-typescript/src/main/kotlin/chapi/ast/typescriptast/TypeScriptFullIdentListener.kt index 6ea1aade290aa8aa29a294cbb3609931a382118c..f88c858eb03f105933878e74f259109307b587c2 100644 --- a/chapi-ast-typescript/src/main/kotlin/chapi/ast/typescriptast/TypeScriptFullIdentListener.kt +++ b/chapi-ast-typescript/src/main/kotlin/chapi/ast/typescriptast/TypeScriptFullIdentListener.kt @@ -66,24 +66,8 @@ class TypeScriptFullIdentListener(private var node: TSIdentify) : TypeScriptAstL this.buildConstructorMethod(childCtx as TypeScriptParser.ConstructorDeclarationContext) currentNode.Functions += codeFunction } - "PropertyMemberDeclarationContext" -> { - this.buildPropertyMember(childCtx as TypeScriptParser.PropertyMemberDeclarationContext) - } - else -> { - println("handleClassBodyElements -> childElementType : $childElementType") - } - } - } - } - - private fun buildPropertyMember(originCtx: TypeScriptParser.PropertyMemberDeclarationContext) { - val childType = originCtx::class.java.simpleName - - when (childType) { - "PropertyDeclarationExpressionContext" -> { - val ctx = originCtx as TypeScriptParser.PropertyDeclarationExpressionContext - val isField = ctx.propertyName() != null - if (isField) { + "PropertyDeclarationExpressionContext" -> { + val ctx = childCtx as TypeScriptParser.PropertyDeclarationExpressionContext val codeField = CodeField( TypeValue = ctx.propertyName().text ) @@ -98,20 +82,35 @@ class TypeScriptFullIdentListener(private var node: TSIdentify) : TypeScriptAstL currentNode.Fields += codeField } - } - "MethodDeclarationExpressionContext" -> { - val ctx = originCtx as TypeScriptParser.MethodDeclarationExpressionContext - val codeFunction = CodeFunction( - Name = ctx.propertyName().text, - Position = buildPosition(ctx) - ) - val callSignCtx = ctx.callSignature() - - if (callSignCtx.typeAnnotation() != null) { - codeFunction.ReturnType = buildTypeAnnotation(callSignCtx.typeAnnotation())!! + "MethodDeclarationExpressionContext" -> { + val ctx = childCtx as TypeScriptParser.MethodDeclarationExpressionContext + val codeFunction = CodeFunction( + Name = ctx.propertyName().text, + Position = buildPosition(ctx) + ) + val callSignCtx = ctx.callSignature() + + if (callSignCtx.typeAnnotation() != null) { + codeFunction.ReturnType = buildTypeAnnotation(callSignCtx.typeAnnotation())!! + } + + currentNode.Functions += codeFunction } + else -> { + println("handleClassBodyElements -> childElementType : $childElementType") + } + } + } + } + + private fun buildPropertyMember(originCtx: TypeScriptParser.PropertyMemberDeclarationContext) { + val childType = originCtx::class.java.simpleName.toString() - currentNode.Functions += codeFunction + print(childType) + when (childType) { + + else -> { + println("handleClassBody -> buildPropertyMember") } } }