forked from TrueCloudLab/neoneo-go
compiler: check correctness of emitted bytecode
The error here indicates a bug in compiler implementation. Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
a885f84cad
commit
4fe188a60d
1 changed files with 8 additions and 1 deletions
|
@ -16,6 +16,7 @@ import (
|
||||||
"github.com/nspcc-dev/neo-go/pkg/io"
|
"github.com/nspcc-dev/neo-go/pkg/io"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/smartcontract"
|
"github.com/nspcc-dev/neo-go/pkg/smartcontract"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/util"
|
"github.com/nspcc-dev/neo-go/pkg/util"
|
||||||
|
"github.com/nspcc-dev/neo-go/pkg/util/bitfield"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/vm"
|
"github.com/nspcc-dev/neo-go/pkg/vm"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/vm/emit"
|
"github.com/nspcc-dev/neo-go/pkg/vm/emit"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/vm/opcode"
|
"github.com/nspcc-dev/neo-go/pkg/vm/opcode"
|
||||||
|
@ -2073,7 +2074,13 @@ func CodeGen(info *buildInfo) ([]byte, *DebugInfo, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
return buf, c.emitDebugInfo(buf), nil
|
|
||||||
|
methods := bitfield.New(len(buf))
|
||||||
|
di := c.emitDebugInfo(buf)
|
||||||
|
for i := range di.Methods {
|
||||||
|
methods.Set(int(di.Methods[i].Range.Start))
|
||||||
|
}
|
||||||
|
return buf, di, vm.IsScriptCorrect(buf, methods)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *codegen) resolveFuncDecls(f *ast.File, pkg *types.Package) {
|
func (c *codegen) resolveFuncDecls(f *ast.File, pkg *types.Package) {
|
||||||
|
|
Loading…
Reference in a new issue