forked from TrueCloudLab/neoneo-go
pkg: hide it by moving to _pkg.dev
The idea here is to preserve the history of `dev` branch development and its code when merging with the `master`. Later this code could be moved into the masters code where appropriate.
This commit is contained in:
parent
bb2568cc53
commit
ddd1d92ff1
183 changed files with 0 additions and 0 deletions
|
@ -1,39 +0,0 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/CityOfZion/neo-go/pkg/vm/stack"
|
||||
)
|
||||
|
||||
// vm exceptions
|
||||
|
||||
// THROWIFNOT faults if the item on the top of the stack
|
||||
// does not evaluate to true
|
||||
// For specific logic on how a number of bytearray is evaluated can be seen
|
||||
// from the boolean conversion methods on the stack items
|
||||
func THROWIFNOT(op stack.Instruction, ctx *stack.Context, istack *stack.Invocation, rstack *stack.RandomAccess) (Vmstate, error) {
|
||||
|
||||
// Pop item from top of stack
|
||||
item, err := ctx.Estack.Pop()
|
||||
if err != nil {
|
||||
return FAULT, err
|
||||
}
|
||||
// Convert to a boolean
|
||||
ok, err := item.Boolean()
|
||||
if err != nil {
|
||||
return FAULT, err
|
||||
}
|
||||
|
||||
// If false, throw
|
||||
if !ok.Value() {
|
||||
return FAULT, errors.New("item on top of stack evaluates to false")
|
||||
}
|
||||
return NONE, nil
|
||||
}
|
||||
|
||||
// THROW returns a FAULT VM state. This indicate that there is an error in the
|
||||
// current context loaded program.
|
||||
func THROW(op stack.Instruction, ctx *stack.Context, istack *stack.Invocation, rstack *stack.RandomAccess) (Vmstate, error) {
|
||||
return FAULT, errors.New("the execution of the script program end with an error")
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue