mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-04 19:19:44 +00:00
compiler/iterator: add missing iterator.Concat function
We have a syscall for it, so it should be exposed.
This commit is contained in:
parent
a17bd6176f
commit
eb82661f6b
2 changed files with 10 additions and 0 deletions
|
@ -105,6 +105,7 @@ var syscalls = map[string]map[string]string{
|
||||||
"GetExecutingScriptHash": "System.ExecutionEngine.GetExecutingScriptHash",
|
"GetExecutingScriptHash": "System.ExecutionEngine.GetExecutingScriptHash",
|
||||||
},
|
},
|
||||||
"iterator": {
|
"iterator": {
|
||||||
|
"Concat": "Neo.Iterator.Concat",
|
||||||
"Create": "Neo.Iterator.Create",
|
"Create": "Neo.Iterator.Create",
|
||||||
"Key": "Neo.Iterator.Key",
|
"Key": "Neo.Iterator.Key",
|
||||||
"Keys": "Neo.Iterator.Keys",
|
"Keys": "Neo.Iterator.Keys",
|
||||||
|
|
|
@ -18,6 +18,15 @@ func Create(items []interface{}) Iterator {
|
||||||
return Iterator{}
|
return Iterator{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Concat concatenates two given iterators returning one that will range on
|
||||||
|
// a first and then continue with b. Iterator positions are not reset for a
|
||||||
|
// and b, so if any of them was already advanced by Next the resulting
|
||||||
|
// Iterator will point at this new position and never go back to previous
|
||||||
|
// key-value pairs. This function uses `Neo.Iterator.Concat` syscall.
|
||||||
|
func Concat(a, b Iterator) Iterator {
|
||||||
|
return Iterator{}
|
||||||
|
}
|
||||||
|
|
||||||
// Key returns iterator's key at current position. It's only valid to call after
|
// Key returns iterator's key at current position. It's only valid to call after
|
||||||
// successful Next call. This function uses `Neo.Iterator.Key` syscall.
|
// successful Next call. This function uses `Neo.Iterator.Key` syscall.
|
||||||
func Key(it Iterator) interface{} {
|
func Key(it Iterator) interface{} {
|
||||||
|
|
Loading…
Reference in a new issue