compiler: add hash field to debug info

New debugger won't work without it.
This commit is contained in:
Roman Khimov 2022-04-06 15:27:01 +03:00
parent 66f5ae8fd9
commit e390981747

View file

@ -12,6 +12,7 @@ import (
"unicode" "unicode"
"unicode/utf8" "unicode/utf8"
"github.com/nspcc-dev/neo-go/pkg/crypto/hash"
"github.com/nspcc-dev/neo-go/pkg/smartcontract" "github.com/nspcc-dev/neo-go/pkg/smartcontract"
"github.com/nspcc-dev/neo-go/pkg/smartcontract/binding" "github.com/nspcc-dev/neo-go/pkg/smartcontract/binding"
"github.com/nspcc-dev/neo-go/pkg/smartcontract/manifest" "github.com/nspcc-dev/neo-go/pkg/smartcontract/manifest"
@ -22,6 +23,7 @@ import (
// DebugInfo represents smart-contract debug information. // DebugInfo represents smart-contract debug information.
type DebugInfo struct { type DebugInfo struct {
MainPkg string `json:"-"` MainPkg string `json:"-"`
Hash util.Uint160 `json:"hash"`
Documents []string `json:"documents"` Documents []string `json:"documents"`
Methods []MethodDebugInfo `json:"methods"` Methods []MethodDebugInfo `json:"methods"`
Events []EventDebugInfo `json:"events"` Events []EventDebugInfo `json:"events"`
@ -125,6 +127,7 @@ func (c *codegen) saveSequencePoint(n ast.Node) {
func (c *codegen) emitDebugInfo(contract []byte) *DebugInfo { func (c *codegen) emitDebugInfo(contract []byte) *DebugInfo {
d := &DebugInfo{ d := &DebugInfo{
Hash: hash.Hash160(contract),
MainPkg: c.mainPkg.Name, MainPkg: c.mainPkg.Name,
Events: []EventDebugInfo{}, Events: []EventDebugInfo{},
Documents: c.documents, Documents: c.documents,