mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-03 23:02:27 +00:00
compiler: support panic
in source
In situations where VM's FAULT state needs to be reached, panic function can be used. It compiles to THROW instruction.
This commit is contained in:
parent
a839efb35e
commit
d2326a8b96
3 changed files with 89 additions and 0 deletions
|
@ -16,6 +16,7 @@ var (
|
|||
"SHA1", "Hash256", "Hash160",
|
||||
"VerifySignature", "AppCall",
|
||||
"FromAddress", "Equals",
|
||||
"panic",
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -69,6 +70,12 @@ func isIdentBool(ident *ast.Ident) bool {
|
|||
return ident.Name == "true" || ident.Name == "false"
|
||||
}
|
||||
|
||||
// isExprNil looks if the given expression is a `nil`.
|
||||
func isExprNil(e ast.Expr) bool {
|
||||
v, ok := e.(*ast.Ident)
|
||||
return ok && v.Name == "nil"
|
||||
}
|
||||
|
||||
// makeBoolFromIdent creates a bool type from an *ast.Ident.
|
||||
func makeBoolFromIdent(ident *ast.Ident, tinfo *types.Info) (types.TypeAndValue, error) {
|
||||
var b bool
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue