Fixed union infinite loop #930

This commit is contained in:
Mike Farah
2021-09-05 11:07:40 +10:00
parent 8941573c1a
commit 3543a2dbdc
4 changed files with 48 additions and 18 deletions
+10
View File
@@ -2,8 +2,10 @@ package yqlib
import (
"container/list"
"fmt"
"github.com/jinzhu/copier"
logging "gopkg.in/op/go-logging.v1"
)
type Context struct {
@@ -51,6 +53,14 @@ func (n *Context) ChildContext(results *list.List) Context {
return clone
}
func (n *Context) ToString() string {
if !log.IsEnabledFor(logging.DEBUG) {
return ""
}
result := fmt.Sprintf("Context\nDontAutoCreate: %v\n", n.DontAutoCreate)
return result + NodesToString(n.MatchingNodes)
}
func (n *Context) Clone() Context {
clone := Context{}
err := copier.Copy(&clone, n)