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:
Evgeniy Stratonikov 2021-02-16 16:45:06 +03:00
parent fc3b840335
commit d16ef53653
2 changed files with 43 additions and 4 deletions

View file

@ -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