Skip to content

Commit

Permalink
fix: fix arch array issue
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Dec 28, 2019
1 parent ef95e1c commit 5ab4c1f
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions core/adapter/call/java_call_listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,29 @@ func (s *JavaCallListener) EnterFormalParameter(ctx *parser.FormalParameterConte

func (s *JavaCallListener) EnterFieldDeclaration(ctx *parser.FieldDeclarationContext) {
decelerators := ctx.VariableDeclarators()
typeType := decelerators.GetParent().GetChild(0).(antlr.ParseTree).GetText()
typeType := decelerators.GetParent().GetChild(0).(*parser.TypeTypeContext)
for _, declarator := range decelerators.(*parser.VariableDeclaratorsContext).AllVariableDeclarator() {
var typeCtx *parser.ClassOrInterfaceTypeContext = nil
if reflect.TypeOf(typeType.GetChild(0)).String() == "*parser.ClassOrInterfaceTypeContext" {
typeCtx = typeType.GetChild(0).(*parser.ClassOrInterfaceTypeContext)
}

if typeType.GetChildCount() > 1 {
if reflect.TypeOf(typeType.GetChild(1)).String() == "*parser.ClassOrInterfaceTypeContext" {
typeCtx = typeType.GetChild(1).(*parser.ClassOrInterfaceTypeContext)
}
}

if typeCtx == nil {
continue
}

typeTypeText := typeCtx.IDENTIFIER(0).GetText()
value := declarator.(*parser.VariableDeclaratorContext).VariableDeclaratorId().(*parser.VariableDeclaratorIdContext).IDENTIFIER().GetText()
mapFields[value] = typeType
fields = append(fields, *&models.JAppField{Type: typeType, Value: value})
mapFields[value] = typeTypeText
fields = append(fields, *&models.JAppField{Type: typeTypeText, Value: value})

buildFieldCall(typeType, ctx)
buildFieldCall(typeTypeText, ctx)
}
}

Expand Down

0 comments on commit 5ab4c1f

Please sign in to comment.