mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-03 23:02:27 +00:00
compiler: do not log panic message
In NEO3 THROW accepts an argument and exceptions can be handled, so there is no need to log it.
This commit is contained in:
parent
04f5fdefa0
commit
14ea3c2228
2 changed files with 1 additions and 37 deletions
|
@ -12,7 +12,6 @@ import (
|
|||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/interop/interopnames"
|
||||
"github.com/nspcc-dev/neo-go/pkg/encoding/address"
|
||||
"github.com/nspcc-dev/neo-go/pkg/io"
|
||||
"github.com/nspcc-dev/neo-go/pkg/vm"
|
||||
|
@ -1464,17 +1463,7 @@ func (c *codegen) convertBuiltin(expr *ast.CallExpr) {
|
|||
}
|
||||
}
|
||||
case "panic":
|
||||
arg := expr.Args[0]
|
||||
if isExprNil(arg) {
|
||||
emit.Opcode(c.prog.BinWriter, opcode.DROP)
|
||||
emit.Opcode(c.prog.BinWriter, opcode.THROW)
|
||||
} else if isString(c.typeInfo.Types[arg].Type) {
|
||||
ast.Walk(c, arg)
|
||||
emit.Syscall(c.prog.BinWriter, interopnames.SystemRuntimeLog)
|
||||
emit.Opcode(c.prog.BinWriter, opcode.THROW)
|
||||
} else {
|
||||
c.prog.Err = errors.New("panic should have string or nil argument")
|
||||
}
|
||||
emit.Opcode(c.prog.BinWriter, opcode.THROW)
|
||||
case "ToInteger", "ToByteArray", "ToBool":
|
||||
typ := stackitem.IntegerT
|
||||
switch name {
|
||||
|
@ -1518,8 +1507,6 @@ func transformArgs(fun ast.Expr, args []ast.Expr) []ast.Expr {
|
|||
}
|
||||
case *ast.Ident:
|
||||
switch f.Name {
|
||||
case "panic":
|
||||
return args[1:]
|
||||
case "make", "copy":
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue