Skip to content

Commit

Permalink
Add OnVisitEnd
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent Rasquier committed Dec 13, 2017
1 parent 5a43fb5 commit 5631c19
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
10 changes: 8 additions & 2 deletions event-visitor.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package main

import "github.com/leaklessgfy/asm/asm"
import (
"github.com/leaklessgfy/asm/asm"
)

type EventVisitor struct {
OnVisit []func(version, access int, name, signature, superName string, interfaces []string)
OnVisit []func(version, access int, name, signature, superName string, interfaces []string)
OnVisitEnd []func()
}

func (e EventVisitor) Visit(version, access int, name, signature, superName string, interfaces []string) {
Expand Down Expand Up @@ -49,4 +52,7 @@ func (e EventVisitor) VisitMethod(access int, name, descriptor, signature string
}

func (e EventVisitor) VisitEnd() {
for _, callback := range e.OnVisitEnd {
callback()
}
}
5 changes: 5 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,10 @@ func main() {
fmt.Println(name, signature, superName, interfaces)
},
},
OnVisitEnd: []func(){
func() {
fmt.Println("End")
},
},
}, 0)
}

0 comments on commit 5631c19

Please sign in to comment.