Skip to content

Commit

Permalink
code review
Browse files Browse the repository at this point in the history
* don't skip decides based on stop_at
* don't push explore context into parse context for parsing condition
  • Loading branch information
willscott committed Aug 3, 2021
1 parent 465fafb commit cef2a56
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
2 changes: 1 addition & 1 deletion traversal/selector/condition.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const (
func (c *Condition) Match(n ipld.Node) bool {
switch c.mode {
case ConditionMode_Link:
if n.Kind() != ipld.Kind_Link || c.match.Kind() != ipld.Kind_Link {
if n.Kind() != ipld.Kind_Link {
return false
}
lnk, err := n.AsLink()
Expand Down
5 changes: 1 addition & 4 deletions traversal/selector/exploreRecursive.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,6 @@ func (s ExploreRecursive) replaceRecursiveEdge(nextSelector Selector, replacemen

// Decide if a node directly matches
func (s ExploreRecursive) Decide(n ipld.Node) bool {
if s.stopAt != nil && s.stopAt.Match(n) {
return false
}
return s.current.Decide(n)
}

Expand Down Expand Up @@ -203,7 +200,7 @@ func (pc ParseContext) ParseExploreRecursive(n ipld.Node) (Selector, error) {
var stopCondition *Condition
stop, err := n.LookupByString(SelectorKey_StopAt)
if err == nil {
condition, err := pc.PushParent(erc).ParseCondition(stop)
condition, err := pc.ParseCondition(stop)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit cef2a56

Please sign in to comment.