Skip to content

Commit d1ccf5f

Browse files
authored
runtime/sam/expr: move NewArithmetic op param (#6443)
The op param follows the lhs and rhs params, which feels odd. Move op ahead of lhs and rhs.
1 parent de8cbd3 commit d1ccf5f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

compiler/rungen/expr.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ func (b *Builder) compileBinary(e *dag.BinaryExpr) (expr.Evaluator, error) {
125125
case "<", "<=", ">", ">=":
126126
return expr.NewCompareRelative(b.sctx(), lhs, rhs, op)
127127
case "+", "-", "*", "/", "%":
128-
return expr.NewArithmetic(b.sctx(), lhs, rhs, op)
128+
return expr.NewArithmetic(b.sctx(), op, lhs, rhs)
129129
default:
130130
return nil, fmt.Errorf("invalid binary operator %s", op)
131131
}

runtime/sam/expr/eval.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ var DivideByZero = errors.New("divide by zero")
428428

429429
// NewArithmetic compiles an expression of the form "expr1 op expr2"
430430
// for the arithmetic operators +, -, *, /
431-
func NewArithmetic(sctx *super.Context, lhs, rhs Evaluator, op string) (Evaluator, error) {
431+
func NewArithmetic(sctx *super.Context, op string, lhs, rhs Evaluator) (Evaluator, error) {
432432
n := newNumeric(sctx, lhs, rhs)
433433
switch op {
434434
case "+":

0 commit comments

Comments
 (0)