mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-03 23:02:27 +00:00
compiler: support ellipsis for append of non-byte slices
NeoVM lacks opcode for array append, thus some kind of loop is needed for this.
This commit is contained in:
parent
fc3b840335
commit
d16ef53653
2 changed files with 43 additions and 4 deletions
|
@ -181,6 +181,23 @@ var sliceTestCases = []testCase{
|
|||
stackitem.NewBigInteger(big.NewInt(5)),
|
||||
},
|
||||
},
|
||||
{
|
||||
"int slice, append slice",
|
||||
`package foo
|
||||
func getByte() byte { return 0x80 }
|
||||
func Main() []int {
|
||||
x := []int{1}
|
||||
y := []int{2, 3}
|
||||
x = append(x, y...)
|
||||
x = append(x, y...)
|
||||
return x
|
||||
}`,
|
||||
[]stackitem.Item{
|
||||
stackitem.Make(1),
|
||||
stackitem.Make(2), stackitem.Make(3),
|
||||
stackitem.Make(2), stackitem.Make(3),
|
||||
},
|
||||
},
|
||||
{
|
||||
"declare compound slice",
|
||||
`package foo
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue