compiler/iterator: add missing iterator.Concat function
We have a syscall for it, so it should be exposed.
This commit is contained in:
parent
01b5299355
commit
6d2b2d7263
2 changed files with 12 additions and 0 deletions
|
@ -108,6 +108,7 @@ var syscalls = map[string]map[string]string{
|
|||
"GetExecutingScriptHash": "System.ExecutionEngine.GetExecutingScriptHash",
|
||||
},
|
||||
"iterator": {
|
||||
"Concat": "Neo.Iterator.Concat",
|
||||
"Create": "Neo.Iterator.Create",
|
||||
"Key": "Neo.Iterator.Key",
|
||||
"Keys": "Neo.Iterator.Keys",
|
||||
|
|
|
@ -18,6 +18,17 @@ func Create(items []interface{}) 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. Concatenated iterators also remain completely independent
|
||||
// in results they return, so if both contain the same key you'll receive this
|
||||
// key twice when iterating. 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
|
||||
// successful Next call. This function uses `Neo.Iterator.Key` syscall.
|
||||
func Key(it Iterator) interface{} {
|
||||
|
|
Loading…
Reference in a new issue