vm: implement ASSERT/ABORT opcodes
Rename THROWIFNOT to ASSERT, add ABORT opcode. ABORT cannot be caught, but the implementation should be postponed until exception handling is implemented.
This commit is contained in:
parent
963a70d54a
commit
977c431bf1
9 changed files with 104 additions and 98 deletions
|
@ -1298,9 +1298,12 @@ func (v *VM) execute(ctx *Context, op opcode.Opcode, parameter []byte) (err erro
|
|||
case opcode.THROW:
|
||||
panic("THROW")
|
||||
|
||||
case opcode.THROWIFNOT:
|
||||
case opcode.ABORT:
|
||||
panic("ABORT")
|
||||
|
||||
case opcode.ASSERT:
|
||||
if !v.estack.Pop().Bool() {
|
||||
panic("THROWIFNOT")
|
||||
panic("ASSERT failed")
|
||||
}
|
||||
|
||||
default:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue