compiler: check emitted event names
Check that all `Notify` invocations in source correspond to some event in manifest. Helpful for typos such as `transfer` instead of `Transfer`.
This commit is contained in:
parent
25f1db6de0
commit
75a9a42403
15 changed files with 172 additions and 7 deletions
21
cli/testdata/invalid1/invalid.go
vendored
Normal file
21
cli/testdata/invalid1/invalid.go
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
// invalid is an example of contract which doesn't pass event check.
|
||||
package invalid1
|
||||
|
||||
import (
|
||||
"github.com/nspcc-dev/neo-go/pkg/interop"
|
||||
"github.com/nspcc-dev/neo-go/pkg/interop/runtime"
|
||||
)
|
||||
|
||||
// Notify1 emits correctly typed event.
|
||||
func Notify1() bool {
|
||||
runtime.Notify("Event", interop.Hash160{1, 2, 3})
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// Notify2 emits invalid event (ByteString instead of Hash160).
|
||||
func Notify2() bool {
|
||||
runtime.Notify("Event", []byte{1, 2, 3})
|
||||
|
||||
return true
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue