compiler: simplify convert.To* processing

With inlining there is no need for special logic in compiler.
This commit is contained in:
Evgeniy Stratonikov 2021-03-02 14:43:58 +03:00
parent e754ca62db
commit 56fe6574c9
3 changed files with 4 additions and 14 deletions

View file

@ -1708,15 +1708,6 @@ func (c *codegen) convertBuiltin(expr *ast.CallExpr) {
c.emitStoreByIndex(varGlobal, c.exceptionIndex)
case "delete":
emit.Opcodes(c.prog.BinWriter, opcode.REMOVE)
case "ToInteger", "ToByteArray", "ToBool":
typ := stackitem.IntegerT
switch name {
case "ToByteArray":
typ = stackitem.ByteArrayT
case "ToBool":
typ = stackitem.BooleanT
}
c.emitConvert(typ)
case "Remove":
if !isCompoundSlice(c.typeOf(expr.Args[0])) {
c.prog.Err = errors.New("`Remove` supports only non-byte slices")