From eb82661f6b43322f3cd18ff3b7f3aa356508ee1b Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Mon, 18 May 2020 15:38:11 +0300 Subject: [PATCH] compiler/iterator: add missing iterator.Concat function We have a syscall for it, so it should be exposed. --- pkg/compiler/syscall.go | 1 + pkg/interop/iterator/iterator.go | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/pkg/compiler/syscall.go b/pkg/compiler/syscall.go index 82d49a16e..2c990c87b 100644 --- a/pkg/compiler/syscall.go +++ b/pkg/compiler/syscall.go @@ -105,6 +105,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", diff --git a/pkg/interop/iterator/iterator.go b/pkg/interop/iterator/iterator.go index b4bd281da..5ca5947cc 100644 --- a/pkg/interop/iterator/iterator.go +++ b/pkg/interop/iterator/iterator.go @@ -18,6 +18,15 @@ 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. 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{} {