Fix node type checks in arithmetic expressions.

This commit is contained in:
Julius Volz 2013-01-11 01:09:31 +01:00
parent c4a2358551
commit fdf9a3aab7
1 changed files with 6 additions and 2 deletions

View File

@ -540,14 +540,18 @@ 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 true
}
func NewArithExpr(opType BinOpType, lhs Node, rhs Node) (Node, error) {
if !nodesHaveTypes([]Node{lhs, rhs}, []ExprType{SCALAR, VECTOR}) {