Skip to content

Commit 4b0bb44

Browse files
committed
fix panic
1 parent 4187603 commit 4b0bb44

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

parser/visitor.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ func (v *JavaVisitor) VisitClassBodyDeclaration(ctx *javaAntlr.ClassBodyDeclarat
7171
for _, child := range ctx.GetChildren() {
7272
switch node := child.(type) {
7373
case *javaAntlr.MemberDeclarationContext:
74+
v.currentNode = v.currentClass
7475
v.VisitMemberDeclaration(node)
7576
case *javaAntlr.ModifierContext:
7677
if node.GetText() == STATIC {
@@ -83,7 +84,7 @@ func (v *JavaVisitor) VisitClassBodyDeclaration(ctx *javaAntlr.ClassBodyDeclarat
8384
}
8485

8586
func (v *JavaVisitor) VisitMemberDeclaration(ctx *javaAntlr.MemberDeclarationContext) interface{} {
86-
classBlock := v.currentNode.(*ClassBlock)
87+
classBlock := v.currentClass
8788
for _, child := range ctx.GetChildren() {
8889
switch node := child.(type) {
8990
case *javaAntlr.FieldDeclarationContext:

0 commit comments

Comments
 (0)