From fdf9a3aab7d92771fbf18ba513af6d2c570803c4 Mon Sep 17 00:00:00 2001 From: Julius Volz Date: Fri, 11 Jan 2013 01:09:31 +0100 Subject: [PATCH] Fix node type checks in arithmetic expressions. --- rules/ast/ast.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/rules/ast/ast.go b/rules/ast/ast.go index 2e52aa404..6faf4caf9 100644 --- a/rules/ast/ast.go +++ b/rules/ast/ast.go @@ -540,13 +540,17 @@ func NewFunctionCall(function *Function, args []Node) (Node, error) { func nodesHaveTypes(nodes []Node, exprTypes []ExprType) bool { for _, node := range nodes { + correctType := false for _, exprType := range exprTypes { if node.Type() == exprType { - return true + correctType = true } } + if !correctType { + return false + } } - return false + return true } func NewArithExpr(opType BinOpType, lhs Node, rhs Node) (Node, error) {