Skip to content

Commit

Permalink
feat(go): fix null issues
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Nov 9, 2022
1 parent 455e747 commit de13d9d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ class GoFullIdentListener(var fileName: String) : GoAstListener() {
"StructTypeContext" -> {
buildStruct(identifyName, typeChild)
}

else -> {

}
Expand Down Expand Up @@ -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
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -17,7 +17,6 @@ func main() {
}

@Test
@Ignore
fun analysis2() {
val helloworldApi = """package main
Expand Down

0 comments on commit de13d9d

Please sign in to comment.