Merge pull request #642 from nspcc-dev/feature/emit
vm, compiler: move Emit* functions to a separate package Closes #449, #534.
This commit is contained in:
commit
9b9adb28c1
16 changed files with 521 additions and 564 deletions
|
@ -3,6 +3,8 @@ package vm
|
|||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/CityOfZion/neo-go/pkg/vm/emit"
|
||||
|
||||
"github.com/CityOfZion/neo-go/pkg/io"
|
||||
)
|
||||
|
||||
|
@ -49,7 +51,7 @@ func serializeItemTo(item StackItem, w *io.BinWriter, seen map[StackItem]bool) {
|
|||
w.WriteBool(t.value)
|
||||
case *BigIntegerItem:
|
||||
w.WriteBytes([]byte{byte(integerT)})
|
||||
w.WriteVarBytes(IntToBytes(t.value))
|
||||
w.WriteVarBytes(emit.IntToBytes(t.value))
|
||||
case *InteropItem:
|
||||
w.Err = errors.New("interop item can't be serialized")
|
||||
case *ArrayItem, *StructItem:
|
||||
|
@ -108,7 +110,7 @@ func DecodeBinaryStackItem(r *io.BinReader) StackItem {
|
|||
return NewBoolItem(b)
|
||||
case integerT:
|
||||
data := r.ReadVarBytes()
|
||||
num := BytesToInt(data)
|
||||
num := emit.BytesToInt(data)
|
||||
return &BigIntegerItem{
|
||||
value: num,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue