mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-03 23:02:27 +00:00
compiler: support removing slice elements
Go-way of removing elements from slice is via `append` builtin. There is a separate opcode for removing elements from Arrays, which is cheaper and supported in this commit.
This commit is contained in:
parent
78948ef7af
commit
bcc11cbd74
4 changed files with 36 additions and 1 deletions
|
@ -1542,6 +1542,12 @@ func (c *codegen) convertBuiltin(expr *ast.CallExpr) {
|
|||
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")
|
||||
return
|
||||
}
|
||||
emit.Opcode(c.prog.BinWriter, opcode.REMOVE)
|
||||
case "Equals":
|
||||
emit.Opcode(c.prog.BinWriter, opcode.EQUAL)
|
||||
case "FromAddress":
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue