mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-27 05:42:56 +00:00
vm: pretty-print CONVERT and ISTYPE opcodes
This commit is contained in:
parent
95d86b67c3
commit
92ddc474d8
2 changed files with 5 additions and 0 deletions
|
@ -191,6 +191,9 @@ func (v *VM) PrintOps() {
|
|||
v.getOffsetDesc(ctx, catchP), v.getOffsetDesc(ctx, finallyP))
|
||||
case opcode.INITSSLOT:
|
||||
desc = fmt.Sprint(parameter[0])
|
||||
case opcode.CONVERT, opcode.ISTYPE:
|
||||
typ := stackitem.Type(parameter[0])
|
||||
desc = fmt.Sprintf("%s (%x)", typ, parameter[0])
|
||||
case opcode.INITSLOT:
|
||||
desc = fmt.Sprintf("%d local, %d arg", parameter[0], parameter[1])
|
||||
case opcode.SYSCALL:
|
||||
|
|
|
@ -244,6 +244,8 @@ func TestISTYPE(t *testing.T) {
|
|||
func testCONVERT(to stackitem.Type, item, res stackitem.Item) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
prog := []byte{byte(opcode.CONVERT), byte(to)}
|
||||
v := load(prog)
|
||||
v.PrintOps()
|
||||
runWithArgs(t, prog, res, item)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue