vm: move opcodes into their own package
This allows easier reuse of opcodes and in some cases allows to eliminate dependencies on the whole vm package, like in compiler that only needs opcodes and doesn't care about VM for any other purpose. And yes, they're opcodes because an instruction is a whole thing with operands, that's what context.Next() returns.
This commit is contained in:
parent
f48228ef7d
commit
8d4dd2d2e1
21 changed files with 1285 additions and 1248 deletions
|
@ -15,6 +15,7 @@ import (
|
|||
|
||||
"github.com/CityOfZion/neo-go/pkg/crypto/hash"
|
||||
"github.com/CityOfZion/neo-go/pkg/util"
|
||||
"github.com/CityOfZion/neo-go/pkg/vm/opcode"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
@ -154,7 +155,7 @@ func testFile(t *testing.T, filename string) {
|
|||
ctx := vm.istack.Peek(i).Value().(*Context)
|
||||
if ctx.nextip < len(ctx.prog) {
|
||||
require.Equal(t, s.InstructionPointer, ctx.nextip)
|
||||
require.Equal(t, s.Instruction, Instruction(ctx.prog[ctx.nextip]).String())
|
||||
require.Equal(t, s.Instruction, opcode.Opcode(ctx.prog[ctx.nextip]).String())
|
||||
}
|
||||
compareStacks(t, s.EStack, vm.estack)
|
||||
compareStacks(t, s.AStack, vm.astack)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue