aboutsummaryrefslogtreecommitdiffstats
path: root/calc.go
diff options
context:
space:
mode:
Diffstat (limited to 'calc.go')
-rw-r--r--calc.go10
1 files changed, 3 insertions, 7 deletions
diff --git a/calc.go b/calc.go
index 67794aa..1e0e598 100644
--- a/calc.go
+++ b/calc.go
@@ -61,17 +61,13 @@ func (c *Calculator) negate() {
}
}
-// performOp performs the specified arithmetic operation.
-func (c *Calculator) performOperation(operator byte) {
- fn, err := parseOperator(operator)
- if err != nil {
- return
- }
+// operate performs a binary arithmetic operation on the stored values.
+func (c *Calculator) operate(op Op) {
lhs, rhs, err := c.operands()
if err != nil {
return
}
- c.stack.push(fn(lhs, rhs))
+ c.stack.push(op(lhs, rhs))
c.buf = ""
}