// split returns a slice of all subexpressions in e that are connected by op. // For example, given 'a || (b || c) || d' with the or op, // split returns []{d, c, b, a}. func (op boolOp) split(e ast.Expr) (exprs []ast.Expr) { for { e = astutil.Unparen(e) if b, ok := e.(*ast.BinaryExpr); ok && b.Op == op.tok { exprs = append(exprs, op.split(b.Y)...) e = b.X } else { exprs = append(exprs, e) break } } return }
func unparen(e ast.Expr) ast.Expr { return astutil.Unparen(e) }
func unparen(x ast.Expr) ast.Expr { return astutil.Unparen(x) }