feat: error for when there is more source code than parsed
This commit is contained in:
@@ -39,6 +39,15 @@ func (i Iterator[T]) Get() (T, error) {
|
||||
return i.items[i.index], nil
|
||||
}
|
||||
|
||||
func (i Iterator[T]) MustGet() T {
|
||||
var null T
|
||||
if i.Done() {
|
||||
return null
|
||||
}
|
||||
|
||||
return i.items[i.index]
|
||||
}
|
||||
|
||||
// Create a new iterator, over a set of items.
|
||||
func (i *Iterator[T]) Next() (T, error) {
|
||||
item, err := i.Get()
|
||||
|
||||
Reference in New Issue
Block a user