Skip to content

Commit

Permalink
Merge pull request #21 from shivasurya/shiva/java-bug-fix-null-crash
Browse files Browse the repository at this point in the history
Fix crash mis-match variable formal parameters as comments
  • Loading branch information
shivasurya authored May 8, 2024
2 parents bfb80b9 + 2f425c7 commit b44f8b2
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions sourcecode-parser/construct.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,13 @@ func buildGraphFromAST(node *sitter.Node, sourceCode []byte, graph *CodeGraph, c
// get method arguments
for j := 0; j < int(childNode.NamedChildCount()); j++ {
param := childNode.NamedChild(j)
// get type of argument and add to method arguments
paramType := param.Child(0).Content(sourceCode)
paramValue := param.Child(1).Content(sourceCode)
methodArgumentType = append(methodArgumentType, paramType)
methodArgumentValue = append(methodArgumentValue, paramValue)
if param.Type() == "formal_parameter" {
// get type of argument and add to method arguments
paramType := param.Child(0).Content(sourceCode)
paramValue := param.Child(1).Content(sourceCode)
methodArgumentType = append(methodArgumentType, paramType)
methodArgumentValue = append(methodArgumentValue, paramValue)
}
}
}
}
Expand Down

0 comments on commit b44f8b2

Please sign in to comment.