Clean up a little lint and some shadowed variables
This commit is contained in:
parent
969aa1a6c3
commit
67673b31f4
8 changed files with 26 additions and 20 deletions
|
|
@ -140,10 +140,12 @@ func buildInOutIterator(obj *otto.Object, qs graph.QuadStore, base graph.Iterato
|
|||
}
|
||||
|
||||
func buildIteratorTreeHelper(obj *otto.Object, qs graph.QuadStore, base graph.Iterator) graph.Iterator {
|
||||
it := base
|
||||
|
||||
// TODO: Better error handling
|
||||
var subIt graph.Iterator
|
||||
var (
|
||||
it graph.Iterator
|
||||
subIt graph.Iterator
|
||||
)
|
||||
|
||||
if prev, _ := obj.Get("_gremlin_prev"); !prev.IsObject() {
|
||||
subIt = base
|
||||
} else {
|
||||
|
|
@ -314,5 +316,8 @@ func buildIteratorTreeHelper(obj *otto.Object, qs graph.QuadStore, base graph.It
|
|||
and.AddSubIterator(notIt)
|
||||
it = and
|
||||
}
|
||||
if it == nil {
|
||||
panic("Iterator building does not catch the output iterator in some case.")
|
||||
}
|
||||
return it
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,9 +57,9 @@ var testQueries = []struct {
|
|||
func TestMemstoreBackedSexp(t *testing.T) {
|
||||
qs, _ := graph.NewQuadStore("memstore", "", nil)
|
||||
w, _ := graph.NewQuadWriter("single", qs, nil)
|
||||
it := BuildIteratorTreeForQuery(qs, "()")
|
||||
if it.Type() != graph.Null {
|
||||
t.Errorf(`Incorrect type for empty query, got:%q expect: "null"`, it.Type())
|
||||
emptyIt := BuildIteratorTreeForQuery(qs, "()")
|
||||
if emptyIt.Type() != graph.Null {
|
||||
t.Errorf(`Incorrect type for empty query, got:%q expect: "null"`, emptyIt.Type())
|
||||
}
|
||||
for _, test := range testQueries {
|
||||
if test.add.IsValid() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue