Skip to content

Commit 3e31863

Browse files
committed
merge identical cases for getting operator functions
1 parent e4d456b commit 3e31863

File tree

1 file changed

+5
-25
lines changed

1 file changed

+5
-25
lines changed

operator.go

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -156,19 +156,15 @@ func (op Operator) GoString() (str string) {
156156

157157
func (op Operator) getFunc() string {
158158
switch op {
159-
case OpPipe:
160-
panic("unreachable")
161-
case OpComma:
162-
panic("unreachable")
163-
case OpAdd:
159+
case OpAdd, OpUpdateAdd:
164160
return "_add"
165-
case OpSub:
161+
case OpSub, OpUpdateSub:
166162
return "_subtract"
167-
case OpMul:
163+
case OpMul, OpUpdateMul:
168164
return "_multiply"
169-
case OpDiv:
165+
case OpDiv, OpUpdateDiv:
170166
return "_divide"
171-
case OpMod:
167+
case OpMod, OpUpdateMod:
172168
return "_modulo"
173169
case OpEq:
174170
return "_equal"
@@ -182,26 +178,10 @@ func (op Operator) getFunc() string {
182178
return "_greatereq"
183179
case OpLe:
184180
return "_lesseq"
185-
case OpAnd:
186-
panic("unreachable")
187-
case OpOr:
188-
panic("unreachable")
189-
case OpAlt:
190-
panic("unreachable")
191181
case OpAssign:
192182
return "_assign"
193183
case OpModify:
194184
return "_modify"
195-
case OpUpdateAdd:
196-
return "_add"
197-
case OpUpdateSub:
198-
return "_subtract"
199-
case OpUpdateMul:
200-
return "_multiply"
201-
case OpUpdateDiv:
202-
return "_divide"
203-
case OpUpdateMod:
204-
return "_modulo"
205185
case OpUpdateAlt:
206186
return "_alternative"
207187
default:

0 commit comments

Comments
 (0)