diff --git a/chapi-ast-go/src/main/kotlin/chapi/ast/goast/GoFullIdentListener.kt b/chapi-ast-go/src/main/kotlin/chapi/ast/goast/GoFullIdentListener.kt index d41e78e1..0559eec3 100644 --- a/chapi-ast-go/src/main/kotlin/chapi/ast/goast/GoFullIdentListener.kt +++ b/chapi-ast-go/src/main/kotlin/chapi/ast/goast/GoFullIdentListener.kt @@ -105,6 +105,7 @@ class GoFullIdentListener(var fileName: String) : GoAstListener() { "StructTypeContext" -> { buildStruct(identifyName, typeChild) } + else -> { } @@ -171,14 +172,16 @@ class GoFullIdentListener(var fileName: String) : GoAstListener() { NodeName = primaryExprCtx.getChild(0).text ) val argumentsContext = primaryExprCtx.getChild(1) as GoParser.ArgumentsContext - for (expressionContext in argumentsContext.expressionList().expression()) { - val codeProperty = CodeProperty( - TypeValue = expressionContext.text, - TypeType = "" - ) - codeCall.Parameters += codeProperty + + if (argumentsContext.expressionList() != null) { + for (expressionContext in argumentsContext.expressionList().expression()) { + codeCall.Parameters += CodeProperty( + TypeValue = expressionContext.text, + TypeType = "" + ) + } + currentFunction.FunctionCalls += codeCall } - currentFunction.FunctionCalls += codeCall } } } diff --git a/chapi-ast-go/src/test/kotlin/chapi/ast/goast/GoAnalyserTest.kt b/chapi-ast-go/src/test/kotlin/chapi/ast/goast/GoAnalyserTest.kt index a1df1568..46fd0b29 100644 --- a/chapi-ast-go/src/test/kotlin/chapi/ast/goast/GoAnalyserTest.kt +++ b/chapi-ast-go/src/test/kotlin/chapi/ast/goast/GoAnalyserTest.kt @@ -6,7 +6,7 @@ import org.junit.jupiter.api.Test internal class GoAnalyserTest { @Test fun analysis() { - var helloworld = """ + val helloworld = """ package main import "fmt" func main() { @@ -17,7 +17,6 @@ func main() { } @Test - @Ignore fun analysis2() { val helloworldApi = """package main