Debian Codegraph @

interp/op.go

raw symbols SCIP
1 package interp
2
3 // Code generated by 'go run ../internal/cmd/genop/genop.go'. DO NOT EDIT.
4
5 import (
6 "go/constant"
7 "go/token"
8 "reflect"
9 )
10
11 // Arithmetic operators
12
13 func add(n *node) {
14 next := getExec(n.tnext)
15 typ := n.typ.concrete().TypeOf()
16 isInterface := n.typ.TypeOf().Kind() == reflect.Interface
17 dest := genValueOutput(n, typ)
18 c0, c1 := n.child[0], n.child[1]
19
20 switch typ.Kind() {
21 case reflect.String:
22 switch {
23 case isInterface:
24 v0 := genValue(c0)
25 v1 := genValue(c1)
26 n.exec = func(f *frame) bltn {
27 dest(f).Set(reflect.ValueOf(v0(f).String() + v1(f).String()).Convert(typ))
28 return next
29 }
30 case c0.rval.IsValid():
31 s0 := vString(c0.rval)
32 v1 := genValue(c1)
33 n.exec = func(f *frame) bltn {
34 dest(f).SetString(s0 + v1(f).String())
35 return next
36 }
37 case c1.rval.IsValid():
38 v0 := genValue(c0)
39 s1 := vString(c1.rval)
40 n.exec = func(f *frame) bltn {
41 dest(f).SetString(v0(f).String() + s1)
42 return next
43 }
44 default:
45 v0 := genValue(c0)
46 v1 := genValue(c1)
47 n.exec = func(f *frame) bltn {
48 dest(f).SetString(v0(f).String() + v1(f).String())
49 return next
50 }
51 }
52 case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
53 switch {
54 case isInterface:
55 v0 := genValueInt(c0)
56 v1 := genValueInt(c1)
57 n.exec = func(f *frame) bltn {
58 _, i := v0(f)
59 _, j := v1(f)
60 dest(f).Set(reflect.ValueOf(i + j).Convert(typ))
61 return next
62 }
63 case c0.rval.IsValid():
64 i := vInt(c0.rval)
65 v1 := genValueInt(c1)
66 n.exec = func(f *frame) bltn {
67 _, j := v1(f)
68 dest(f).SetInt(i + j)
69 return next
70 }
71 case c1.rval.IsValid():
72 v0 := genValueInt(c0)
73 j := vInt(c1.rval)
74 n.exec = func(f *frame) bltn {
75 _, i := v0(f)
76 dest(f).SetInt(i + j)
77 return next
78 }
79 default:
80 v0 := genValueInt(c0)
81 v1 := genValueInt(c1)
82 n.exec = func(f *frame) bltn {
83 _, i := v0(f)
84 _, j := v1(f)
85 dest(f).SetInt(i + j)
86 return next
87 }
88 }
89 case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
90 switch {
91 case isInterface:
92 v0 := genValueUint(c0)
93 v1 := genValueUint(c1)
94 n.exec = func(f *frame) bltn {
95 _, i := v0(f)
96 _, j := v1(f)
97 dest(f).Set(reflect.ValueOf(i + j).Convert(typ))
98 return next
99 }
100 case c0.rval.IsValid():
101 i := vUint(c0.rval)
102 v1 := genValueUint(c1)
103 n.exec = func(f *frame) bltn {
104 _, j := v1(f)
105 dest(f).SetUint(i + j)
106 return next
107 }
108 case c1.rval.IsValid():
109 j := vUint(c1.rval)
110 v0 := genValueUint(c0)
111 n.exec = func(f *frame) bltn {
112 _, i := v0(f)
113 dest(f).SetUint(i + j)
114 return next
115 }
116 default:
117 v0 := genValueUint(c0)
118 v1 := genValueUint(c1)
119 n.exec = func(f *frame) bltn {
120 _, i := v0(f)
121 _, j := v1(f)
122 dest(f).SetUint(i + j)
123 return next
124 }
125 }
126 case reflect.Float32, reflect.Float64:
127 switch {
128 case isInterface:
129 v0 := genValueFloat(c0)
130 v1 := genValueFloat(c1)
131 n.exec = func(f *frame) bltn {
132 _, i := v0(f)
133 _, j := v1(f)
134 dest(f).Set(reflect.ValueOf(i + j).Convert(typ))
135 return next
136 }
137 case c0.rval.IsValid():
138 i := vFloat(c0.rval)
139 v1 := genValueFloat(c1)
140 n.exec = func(f *frame) bltn {
141 _, j := v1(f)
142 dest(f).SetFloat(i + j)
143 return next
144 }
145 case c1.rval.IsValid():
146 j := vFloat(c1.rval)
147 v0 := genValueFloat(c0)
148 n.exec = func(f *frame) bltn {
149 _, i := v0(f)
150 dest(f).SetFloat(i + j)
151 return next
152 }
153 default:
154 v0 := genValueFloat(c0)
155 v1 := genValueFloat(c1)
156 n.exec = func(f *frame) bltn {
157 _, i := v0(f)
158 _, j := v1(f)
159 dest(f).SetFloat(i + j)
160 return next
161 }
162 }
163 case reflect.Complex64, reflect.Complex128:
164 switch {
165 case isInterface:
166 v0 := genComplex(c0)
167 v1 := genComplex(c1)
168 n.exec = func(f *frame) bltn {
169 dest(f).Set(reflect.ValueOf(v0(f) + v1(f)).Convert(typ))
170 return next
171 }
172 case c0.rval.IsValid():
173 r0 := vComplex(c0.rval)
174 v1 := genComplex(c1)
175 n.exec = func(f *frame) bltn {
176 dest(f).SetComplex(r0 + v1(f))
177 return next
178 }
179 case c1.rval.IsValid():
180 r1 := vComplex(c1.rval)
181 v0 := genComplex(c0)
182 n.exec = func(f *frame) bltn {
183 dest(f).SetComplex(v0(f) + r1)
184 return next
185 }
186 default:
187 v0 := genComplex(c0)
188 v1 := genComplex(c1)
189 n.exec = func(f *frame) bltn {
190 dest(f).SetComplex(v0(f) + v1(f))
191 return next
192 }
193 }
194 }
195 }
196
197 func addConst(n *node) {
198 v0, v1 := n.child[0].rval, n.child[1].rval
199 isConst := (v0.IsValid() && isConstantValue(v0.Type())) && (v1.IsValid() && isConstantValue(v1.Type()))
200 t := n.typ.rtype
201 if isConst {
202 t = constVal
203 }
204 n.rval = reflect.New(t).Elem()
205 switch {
206 case isConst:
207 v := constant.BinaryOp(vConstantValue(v0), token.ADD, vConstantValue(v1))
208 n.rval.Set(reflect.ValueOf(v))
209 case isString(t):
210 n.rval.SetString(vString(v0) + vString(v1))
211 case isComplex(t):
212 n.rval.SetComplex(vComplex(v0) + vComplex(v1))
213 case isFloat(t):
214 n.rval.SetFloat(vFloat(v0) + vFloat(v1))
215 case isUint(t):
216 n.rval.SetUint(vUint(v0) + vUint(v1))
217 case isInt(t):
218 n.rval.SetInt(vInt(v0) + vInt(v1))
219 }
220 }
221
222 func and(n *node) {
223 next := getExec(n.tnext)
224 typ := n.typ.concrete().TypeOf()
225 isInterface := n.typ.TypeOf().Kind() == reflect.Interface
226 dest := genValueOutput(n, typ)
227 c0, c1 := n.child[0], n.child[1]
228
229 switch typ.Kind() {
230 case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
231 switch {
232 case isInterface:
233 v0 := genValueInt(c0)
234 v1 := genValueInt(c1)
235 n.exec = func(f *frame) bltn {
236 _, i := v0(f)
237 _, j := v1(f)
238 dest(f).Set(reflect.ValueOf(i & j).Convert(typ))
239 return next
240 }
241 case c0.rval.IsValid():
242 i := vInt(c0.rval)
243 v1 := genValueInt(c1)
244 n.exec = func(f *frame) bltn {
245 _, j := v1(f)
246 dest(f).SetInt(i & j)
247 return next
248 }
249 case c1.rval.IsValid():
250 v0 := genValueInt(c0)
251 j := vInt(c1.rval)
252 n.exec = func(f *frame) bltn {
253 _, i := v0(f)
254 dest(f).SetInt(i & j)
255 return next
256 }
257 default:
258 v0 := genValueInt(c0)
259 v1 := genValueInt(c1)
260 n.exec = func(f *frame) bltn {
261 _, i := v0(f)
262 _, j := v1(f)
263 dest(f).SetInt(i & j)
264 return next
265 }
266 }
267 case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
268 switch {
269 case isInterface:
270 v0 := genValueUint(c0)
271 v1 := genValueUint(c1)
272 n.exec = func(f *frame) bltn {
273 _, i := v0(f)
274 _, j := v1(f)
275 dest(f).Set(reflect.ValueOf(i & j).Convert(typ))
276 return next
277 }
278 case c0.rval.IsValid():
279 i := vUint(c0.rval)
280 v1 := genValueUint(c1)
281 n.exec = func(f *frame) bltn {
282 _, j := v1(f)
283 dest(f).SetUint(i & j)
284 return next
285 }
286 case c1.rval.IsValid():
287 j := vUint(c1.rval)
288 v0 := genValueUint(c0)
289 n.exec = func(f *frame) bltn {
290 _, i := v0(f)
291 dest(f).SetUint(i & j)
292 return next
293 }
294 default:
295 v0 := genValueUint(c0)
296 v1 := genValueUint(c1)
297 n.exec = func(f *frame) bltn {
298 _, i := v0(f)
299 _, j := v1(f)
300 dest(f).SetUint(i & j)
301 return next
302 }
303 }
304 }
305 }
306
307 func andConst(n *node) {
308 v0, v1 := n.child[0].rval, n.child[1].rval
309 isConst := (v0.IsValid() && isConstantValue(v0.Type())) && (v1.IsValid() && isConstantValue(v1.Type()))
310 t := n.typ.rtype
311 if isConst {
312 t = constVal
313 }
314 n.rval = reflect.New(t).Elem()
315 switch {
316 case isConst:
317 v := constant.BinaryOp(constant.ToInt(vConstantValue(v0)), token.AND, constant.ToInt(vConstantValue(v1)))
318 n.rval.Set(reflect.ValueOf(v))
319 case isUint(t):
320 n.rval.SetUint(vUint(v0) & vUint(v1))
321 case isInt(t):
322 n.rval.SetInt(vInt(v0) & vInt(v1))
323 }
324 }
325
326 func andNot(n *node) {
327 next := getExec(n.tnext)
328 typ := n.typ.concrete().TypeOf()
329 isInterface := n.typ.TypeOf().Kind() == reflect.Interface
330 dest := genValueOutput(n, typ)
331 c0, c1 := n.child[0], n.child[1]
332
333 switch typ.Kind() {
334 case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
335 switch {
336 case isInterface:
337 v0 := genValueInt(c0)
338 v1 := genValueInt(c1)
339 n.exec = func(f *frame) bltn {
340 _, i := v0(f)
341 _, j := v1(f)
342 dest(f).Set(reflect.ValueOf(i &^ j).Convert(typ))
343 return next
344 }
345 case c0.rval.IsValid():
346 i := vInt(c0.rval)
347 v1 := genValueInt(c1)
348 n.exec = func(f *frame) bltn {
349 _, j := v1(f)
350 dest(f).SetInt(i &^ j)
351 return next
352 }
353 case c1.rval.IsValid():
354 v0 := genValueInt(c0)
355 j := vInt(c1.rval)
356 n.exec = func(f *frame) bltn {
357 _, i := v0(f)
358 dest(f).SetInt(i &^ j)
359 return next
360 }
361 default:
362 v0 := genValueInt(c0)
363 v1 := genValueInt(c1)
364 n.exec = func(f *frame) bltn {
365 _, i := v0(f)
366 _, j := v1(f)
367 dest(f).SetInt(i &^ j)
368 return next
369 }
370 }
371 case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
372 switch {
373 case isInterface:
374 v0 := genValueUint(c0)
375 v1 := genValueUint(c1)
376 n.exec = func(f *frame) bltn {
377 _, i := v0(f)
378 _, j := v1(f)
379 dest(f).Set(reflect.ValueOf(i &^ j).Convert(typ))
380 return next
381 }
382 case c0.rval.IsValid():
383 i := vUint(c0.rval)
384 v1 := genValueUint(c1)
385 n.exec = func(f *frame) bltn {
386 _, j := v1(f)
387 dest(f).SetUint(i &^ j)
388 return next
389 }
390 case c1.rval.IsValid():
391 j := vUint(c1.rval)
392 v0 := genValueUint(c0)
393 n.exec = func(f *frame) bltn {
394 _, i := v0(f)
395 dest(f).SetUint(i &^ j)
396 return next
397 }
398 default:
399 v0 := genValueUint(c0)
400 v1 := genValueUint(c1)
401 n.exec = func(f *frame) bltn {
402 _, i := v0(f)
403 _, j := v1(f)
404 dest(f).SetUint(i &^ j)
405 return next
406 }
407 }
408 }
409 }
410
411 func andNotConst(n *node) {
412 v0, v1 := n.child[0].rval, n.child[1].rval
413 isConst := (v0.IsValid() && isConstantValue(v0.Type())) && (v1.IsValid() && isConstantValue(v1.Type()))
414 t := n.typ.rtype
415 if isConst {
416 t = constVal
417 }
418 n.rval = reflect.New(t).Elem()
419 switch {
420 case isConst:
421 v := constant.BinaryOp(constant.ToInt(vConstantValue(v0)), token.AND_NOT, constant.ToInt(vConstantValue(v1)))
422 n.rval.Set(reflect.ValueOf(v))
423 case isUint(t):
424 n.rval.SetUint(vUint(v0) &^ vUint(v1))
425 case isInt(t):
426 n.rval.SetInt(vInt(v0) &^ vInt(v1))
427 }
428 }
429
430 func mul(n *node) {
431 next := getExec(n.tnext)
432 typ := n.typ.concrete().TypeOf()
433 isInterface := n.typ.TypeOf().Kind() == reflect.Interface
434 dest := genValueOutput(n, typ)
435 c0, c1 := n.child[0], n.child[1]
436
437 switch typ.Kind() {
438 case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
439 switch {
440 case isInterface:
441 v0 := genValueInt(c0)
442 v1 := genValueInt(c1)
443 n.exec = func(f *frame) bltn {
444 _, i := v0(f)
445 _, j := v1(f)
446 dest(f).Set(reflect.ValueOf(i * j).Convert(typ))
447 return next
448 }
449 case c0.rval.IsValid():
450 i := vInt(c0.rval)
451 v1 := genValueInt(c1)
452 n.exec = func(f *frame) bltn {
453 _, j := v1(f)
454 dest(f).SetInt(i * j)
455 return next
456 }
457 case c1.rval.IsValid():
458 v0 := genValueInt(c0)
459 j := vInt(c1.rval)
460 n.exec = func(f *frame) bltn {
461 _, i := v0(f)
462 dest(f).SetInt(i * j)
463 return next
464 }
465 default:
466 v0 := genValueInt(c0)
467 v1 := genValueInt(c1)
468 n.exec = func(f *frame) bltn {
469 _, i := v0(f)
470 _, j := v1(f)
471 dest(f).SetInt(i * j)
472 return next
473 }
474 }
475 case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
476 switch {
477 case isInterface:
478 v0 := genValueUint(c0)
479 v1 := genValueUint(c1)
480 n.exec = func(f *frame) bltn {
481 _, i := v0(f)
482 _, j := v1(f)
483 dest(f).Set(reflect.ValueOf(i * j).Convert(typ))
484 return next
485 }
486 case c0.rval.IsValid():
487 i := vUint(c0.rval)
488 v1 := genValueUint(c1)
489 n.exec = func(f *frame) bltn {
490 _, j := v1(f)
491 dest(f).SetUint(i * j)
492 return next
493 }
494 case c1.rval.IsValid():
495 j := vUint(c1.rval)
496 v0 := genValueUint(c0)
497 n.exec = func(f *frame) bltn {
498 _, i := v0(f)
499 dest(f).SetUint(i * j)
500 return next
501 }
502 default:
503 v0 := genValueUint(c0)
504 v1 := genValueUint(c1)
505 n.exec = func(f *frame) bltn {
506 _, i := v0(f)
507 _, j := v1(f)
508 dest(f).SetUint(i * j)
509 return next
510 }
511 }
512 case reflect.Float32, reflect.Float64:
513 switch {
514 case isInterface:
515 v0 := genValueFloat(c0)
516 v1 := genValueFloat(c1)
517 n.exec = func(f *frame) bltn {
518 _, i := v0(f)
519 _, j := v1(f)
520 dest(f).Set(reflect.ValueOf(i * j).Convert(typ))
521 return next
522 }
523 case c0.rval.IsValid():
524 i := vFloat(c0.rval)
525 v1 := genValueFloat(c1)
526 n.exec = func(f *frame) bltn {
527 _, j := v1(f)
528 dest(f).SetFloat(i * j)
529 return next
530 }
531 case c1.rval.IsValid():
532 j := vFloat(c1.rval)
533 v0 := genValueFloat(c0)
534 n.exec = func(f *frame) bltn {
535 _, i := v0(f)
536 dest(f).SetFloat(i * j)
537 return next
538 }
539 default:
540 v0 := genValueFloat(c0)
541 v1 := genValueFloat(c1)
542 n.exec = func(f *frame) bltn {
543 _, i := v0(f)
544 _, j := v1(f)
545 dest(f).SetFloat(i * j)
546 return next
547 }
548 }
549 case reflect.Complex64, reflect.Complex128:
550 switch {
551 case isInterface:
552 v0 := genComplex(c0)
553 v1 := genComplex(c1)
554 n.exec = func(f *frame) bltn {
555 dest(f).Set(reflect.ValueOf(v0(f) * v1(f)).Convert(typ))
556 return next
557 }
558 case c0.rval.IsValid():
559 r0 := vComplex(c0.rval)
560 v1 := genComplex(c1)
561 n.exec = func(f *frame) bltn {
562 dest(f).SetComplex(r0 * v1(f))
563 return next
564 }
565 case c1.rval.IsValid():
566 r1 := vComplex(c1.rval)
567 v0 := genComplex(c0)
568 n.exec = func(f *frame) bltn {
569 dest(f).SetComplex(v0(f) * r1)
570 return next
571 }
572 default:
573 v0 := genComplex(c0)
574 v1 := genComplex(c1)
575 n.exec = func(f *frame) bltn {
576 dest(f).SetComplex(v0(f) * v1(f))
577 return next
578 }
579 }
580 }
581 }
582
583 func mulConst(n *node) {
584 v0, v1 := n.child[0].rval, n.child[1].rval
585 isConst := (v0.IsValid() && isConstantValue(v0.Type())) && (v1.IsValid() && isConstantValue(v1.Type()))
586 t := n.typ.rtype
587 if isConst {
588 t = constVal
589 }
590 n.rval = reflect.New(t).Elem()
591 switch {
592 case isConst:
593 v := constant.BinaryOp(vConstantValue(v0), token.MUL, vConstantValue(v1))
594 n.rval.Set(reflect.ValueOf(v))
595 case isComplex(t):
596 n.rval.SetComplex(vComplex(v0) * vComplex(v1))
597 case isFloat(t):
598 n.rval.SetFloat(vFloat(v0) * vFloat(v1))
599 case isUint(t):
600 n.rval.SetUint(vUint(v0) * vUint(v1))
601 case isInt(t):
602 n.rval.SetInt(vInt(v0) * vInt(v1))
603 }
604 }
605
606 func or(n *node) {
607 next := getExec(n.tnext)
608 typ := n.typ.concrete().TypeOf()
609 isInterface := n.typ.TypeOf().Kind() == reflect.Interface
610 dest := genValueOutput(n, typ)
611 c0, c1 := n.child[0], n.child[1]
612
613 switch typ.Kind() {
614 case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
615 switch {
616 case isInterface:
617 v0 := genValueInt(c0)
618 v1 := genValueInt(c1)
619 n.exec = func(f *frame) bltn {
620 _, i := v0(f)
621 _, j := v1(f)
622 dest(f).Set(reflect.ValueOf(i | j).Convert(typ))
623 return next
624 }
625 case c0.rval.IsValid():
626 i := vInt(c0.rval)
627 v1 := genValueInt(c1)
628 n.exec = func(f *frame) bltn {
629 _, j := v1(f)
630 dest(f).SetInt(i | j)
631 return next
632 }
633 case c1.rval.IsValid():
634 v0 := genValueInt(c0)
635 j := vInt(c1.rval)
636 n.exec = func(f *frame) bltn {
637 _, i := v0(f)
638 dest(f).SetInt(i | j)
639 return next
640 }
641 default:
642 v0 := genValueInt(c0)
643 v1 := genValueInt(c1)
644 n.exec = func(f *frame) bltn {
645 _, i := v0(f)
646 _, j := v1(f)
647 dest(f).SetInt(i | j)
648 return next
649 }
650 }
651 case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
652 switch {
653 case isInterface:
654 v0 := genValueUint(c0)
655 v1 := genValueUint(c1)
656 n.exec = func(f *frame) bltn {
657 _, i := v0(f)
658 _, j := v1(f)
659 dest(f).Set(reflect.ValueOf(i | j).Convert(typ))
660 return next
661 }
662 case c0.rval.IsValid():
663 i := vUint(c0.rval)
664 v1 := genValueUint(c1)
665 n.exec = func(f *frame) bltn {
666 _, j := v1(f)
667 dest(f).SetUint(i | j)
668 return next
669 }
670 case c1.rval.IsValid():
671 j := vUint(c1.rval)
672 v0 := genValueUint(c0)
673 n.exec = func(f *frame) bltn {
674 _, i := v0(f)
675 dest(f).SetUint(i | j)
676 return next
677 }
678 default:
679 v0 := genValueUint(c0)
680 v1 := genValueUint(c1)
681 n.exec = func(f *frame) bltn {
682 _, i := v0(f)
683 _, j := v1(f)
684 dest(f).SetUint(i | j)
685 return next
686 }
687 }
688 }
689 }
690
691 func orConst(n *node) {
692 v0, v1 := n.child[0].rval, n.child[1].rval
693 isConst := (v0.IsValid() && isConstantValue(v0.Type())) && (v1.IsValid() && isConstantValue(v1.Type()))
694 t := n.typ.rtype
695 if isConst {
696 t = constVal
697 }
698 n.rval = reflect.New(t).Elem()
699 switch {
700 case isConst:
701 v := constant.BinaryOp(constant.ToInt(vConstantValue(v0)), token.OR, constant.ToInt(vConstantValue(v1)))
702 n.rval.Set(reflect.ValueOf(v))
703 case isUint(t):
704 n.rval.SetUint(vUint(v0) | vUint(v1))
705 case isInt(t):
706 n.rval.SetInt(vInt(v0) | vInt(v1))
707 }
708 }
709
710 func quo(n *node) {
711 next := getExec(n.tnext)
712 typ := n.typ.concrete().TypeOf()
713 isInterface := n.typ.TypeOf().Kind() == reflect.Interface
714 dest := genValueOutput(n, typ)
715 c0, c1 := n.child[0], n.child[1]
716
717 switch typ.Kind() {
718 case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
719 switch {
720 case isInterface:
721 v0 := genValueInt(c0)
722 v1 := genValueInt(c1)
723 n.exec = func(f *frame) bltn {
724 _, i := v0(f)
725 _, j := v1(f)
726 dest(f).Set(reflect.ValueOf(i / j).Convert(typ))
727 return next
728 }
729 case c0.rval.IsValid():
730 i := vInt(c0.rval)
731 v1 := genValueInt(c1)
732 n.exec = func(f *frame) bltn {
733 _, j := v1(f)
734 dest(f).SetInt(i / j)
735 return next
736 }
737 case c1.rval.IsValid():
738 v0 := genValueInt(c0)
739 j := vInt(c1.rval)
740 n.exec = func(f *frame) bltn {
741 _, i := v0(f)
742 dest(f).SetInt(i / j)
743 return next
744 }
745 default:
746 v0 := genValueInt(c0)
747 v1 := genValueInt(c1)
748 n.exec = func(f *frame) bltn {
749 _, i := v0(f)
750 _, j := v1(f)
751 dest(f).SetInt(i / j)
752 return next
753 }
754 }
755 case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
756 switch {
757 case isInterface:
758 v0 := genValueUint(c0)
759 v1 := genValueUint(c1)
760 n.exec = func(f *frame) bltn {
761 _, i := v0(f)
762 _, j := v1(f)
763 dest(f).Set(reflect.ValueOf(i / j).Convert(typ))
764 return next
765 }
766 case c0.rval.IsValid():
767 i := vUint(c0.rval)
768 v1 := genValueUint(c1)
769 n.exec = func(f *frame) bltn {
770 _, j := v1(f)
771 dest(f).SetUint(i / j)
772 return next
773 }
774 case c1.rval.IsValid():
775 j := vUint(c1.rval)
776 v0 := genValueUint(c0)
777 n.exec = func(f *frame) bltn {
778 _, i := v0(f)
779 dest(f).SetUint(i / j)
780 return next
781 }
782 default:
783 v0 := genValueUint(c0)
784 v1 := genValueUint(c1)
785 n.exec = func(f *frame) bltn {
786 _, i := v0(f)
787 _, j := v1(f)
788 dest(f).SetUint(i / j)
789 return next
790 }
791 }
792 case reflect.Float32, reflect.Float64:
793 switch {
794 case isInterface:
795 v0 := genValueFloat(c0)
796 v1 := genValueFloat(c1)
797 n.exec = func(f *frame) bltn {
798 _, i := v0(f)
799 _, j := v1(f)
800 dest(f).Set(reflect.ValueOf(i / j).Convert(typ))
801 return next
802 }
803 case c0.rval.IsValid():
804 i := vFloat(c0.rval)
805 v1 := genValueFloat(c1)
806 n.exec = func(f *frame) bltn {
807 _, j := v1(f)
808 dest(f).SetFloat(i / j)
809 return next
810 }
811 case c1.rval.IsValid():
812 j := vFloat(c1.rval)
813 v0 := genValueFloat(c0)
814 n.exec = func(f *frame) bltn {
815 _, i := v0(f)
816 dest(f).SetFloat(i / j)
817 return next
818 }
819 default:
820 v0 := genValueFloat(c0)
821 v1 := genValueFloat(c1)
822 n.exec = func(f *frame) bltn {
823 _, i := v0(f)
824 _, j := v1(f)
825 dest(f).SetFloat(i / j)
826 return next
827 }
828 }
829 case reflect.Complex64, reflect.Complex128:
830 switch {
831 case isInterface:
832 v0 := genComplex(c0)
833 v1 := genComplex(c1)
834 n.exec = func(f *frame) bltn {
835 dest(f).Set(reflect.ValueOf(v0(f) / v1(f)).Convert(typ))
836 return next
837 }
838 case c0.rval.IsValid():
839 r0 := vComplex(c0.rval)
840 v1 := genComplex(c1)
841 n.exec = func(f *frame) bltn {
842 dest(f).SetComplex(r0 / v1(f))
843 return next
844 }
845 case c1.rval.IsValid():
846 r1 := vComplex(c1.rval)
847 v0 := genComplex(c0)
848 n.exec = func(f *frame) bltn {
849 dest(f).SetComplex(v0(f) / r1)
850 return next
851 }
852 default:
853 v0 := genComplex(c0)
854 v1 := genComplex(c1)
855 n.exec = func(f *frame) bltn {
856 dest(f).SetComplex(v0(f) / v1(f))
857 return next
858 }
859 }
860 }
861 }
862
863 func quoConst(n *node) {
864 v0, v1 := n.child[0].rval, n.child[1].rval
865 isConst := (v0.IsValid() && isConstantValue(v0.Type())) && (v1.IsValid() && isConstantValue(v1.Type()))
866 t := n.typ.rtype
867 if isConst {
868 t = constVal
869 }
870 n.rval = reflect.New(t).Elem()
871 switch {
872 case isConst:
873 var operator token.Token
874 // When the result of the operation is expected to be an int (because both
875 // operands are ints), we want to force the type of the whole expression to be an
876 // int (and not a float), which is achieved by using the QUO_ASSIGN operator.
877 if n.typ.untyped && isInt(n.typ.rtype) {
878 operator = token.QUO_ASSIGN
879 } else {
880 operator = token.QUO
881 }
882 v := constant.BinaryOp(vConstantValue(v0), operator, vConstantValue(v1))
883 n.rval.Set(reflect.ValueOf(v))
884 case isComplex(t):
885 n.rval.SetComplex(vComplex(v0) / vComplex(v1))
886 case isFloat(t):
887 n.rval.SetFloat(vFloat(v0) / vFloat(v1))
888 case isUint(t):
889 n.rval.SetUint(vUint(v0) / vUint(v1))
890 case isInt(t):
891 n.rval.SetInt(vInt(v0) / vInt(v1))
892 }
893 }
894
895 func rem(n *node) {
896 next := getExec(n.tnext)
897 typ := n.typ.concrete().TypeOf()
898 isInterface := n.typ.TypeOf().Kind() == reflect.Interface
899 dest := genValueOutput(n, typ)
900 c0, c1 := n.child[0], n.child[1]
901
902 switch typ.Kind() {
903 case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
904 switch {
905 case isInterface:
906 v0 := genValueInt(c0)
907 v1 := genValueInt(c1)
908 n.exec = func(f *frame) bltn {
909 _, i := v0(f)
910 _, j := v1(f)
911 dest(f).Set(reflect.ValueOf(i % j).Convert(typ))
912 return next
913 }
914 case c0.rval.IsValid():
915 i := vInt(c0.rval)
916 v1 := genValueInt(c1)
917 n.exec = func(f *frame) bltn {
918 _, j := v1(f)
919 dest(f).SetInt(i % j)
920 return next
921 }
922 case c1.rval.IsValid():
923 v0 := genValueInt(c0)
924 j := vInt(c1.rval)
925 n.exec = func(f *frame) bltn {
926 _, i := v0(f)
927 dest(f).SetInt(i % j)
928 return next
929 }
930 default:
931 v0 := genValueInt(c0)
932 v1 := genValueInt(c1)
933 n.exec = func(f *frame) bltn {
934 _, i := v0(f)
935 _, j := v1(f)
936 dest(f).SetInt(i % j)
937 return next
938 }
939 }
940 case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
941 switch {
942 case isInterface:
943 v0 := genValueUint(c0)
944 v1 := genValueUint(c1)
945 n.exec = func(f *frame) bltn {
946 _, i := v0(f)
947 _, j := v1(f)
948 dest(f).Set(reflect.ValueOf(i % j).Convert(typ))
949 return next
950 }
951 case c0.rval.IsValid():
952 i := vUint(c0.rval)
953 v1 := genValueUint(c1)
954 n.exec = func(f *frame) bltn {
955 _, j := v1(f)
956 dest(f).SetUint(i % j)
957 return next
958 }
959 case c1.rval.IsValid():
960 j := vUint(c1.rval)
961 v0 := genValueUint(c0)
962 n.exec = func(f *frame) bltn {
963 _, i := v0(f)
964 dest(f).SetUint(i % j)
965 return next
966 }
967 default:
968 v0 := genValueUint(c0)
969 v1 := genValueUint(c1)
970 n.exec = func(f *frame) bltn {
971 _, i := v0(f)
972 _, j := v1(f)
973 dest(f).SetUint(i % j)
974 return next
975 }
976 }
977 }
978 }
979
980 func remConst(n *node) {
981 v0, v1 := n.child[0].rval, n.child[1].rval
982 isConst := (v0.IsValid() && isConstantValue(v0.Type())) && (v1.IsValid() && isConstantValue(v1.Type()))
983 t := n.typ.rtype
984 if isConst {
985 t = constVal
986 }
987 n.rval = reflect.New(t).Elem()
988 switch {
989 case isConst:
990 v := constant.BinaryOp(constant.ToInt(vConstantValue(v0)), token.REM, constant.ToInt(vConstantValue(v1)))
991 n.rval.Set(reflect.ValueOf(v))
992 case isUint(t):
993 n.rval.SetUint(vUint(v0) % vUint(v1))
994 case isInt(t):
995 n.rval.SetInt(vInt(v0) % vInt(v1))
996 }
997 }
998
999 func shl(n *node) {
1000 next := getExec(n.tnext)
1001 typ := n.typ.concrete().TypeOf()
1002 isInterface := n.typ.TypeOf().Kind() == reflect.Interface
1003 dest := genValueOutput(n, typ)
1004 c0, c1 := n.child[0], n.child[1]
1005
1006 switch typ.Kind() {
1007 case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
1008 switch {
1009 case isInterface:
1010 v0 := genValueInt(c0)
1011 v1 := genValueUint(c1)
1012 n.exec = func(f *frame) bltn {
1013 _, i := v0(f)
1014 _, j := v1(f)
1015 dest(f).Set(reflect.ValueOf(i << j).Convert(typ))
1016 return next
1017 }
1018 case c0.rval.IsValid():
1019 i := vInt(c0.rval)
1020 v1 := genValueUint(c1)
1021 n.exec = func(f *frame) bltn {
1022 _, j := v1(f)
1023 dest(f).SetInt(i << j)
1024 return next
1025 }
1026 case c1.rval.IsValid():
1027 v0 := genValueInt(c0)
1028 j := vUint(c1.rval)
1029 n.exec = func(f *frame) bltn {
1030 _, i := v0(f)
1031 dest(f).SetInt(i << j)
1032 return next
1033 }
1034 default:
1035 v0 := genValueInt(c0)
1036 v1 := genValueUint(c1)
1037 n.exec = func(f *frame) bltn {
1038 _, i := v0(f)
1039 _, j := v1(f)
1040 dest(f).SetInt(i << j)
1041 return next
1042 }
1043 }
1044 case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
1045 switch {
1046 case isInterface:
1047 v0 := genValueUint(c0)
1048 v1 := genValueUint(c1)
1049 n.exec = func(f *frame) bltn {
1050 _, i := v0(f)
1051 _, j := v1(f)
1052 dest(f).Set(reflect.ValueOf(i << j).Convert(typ))
1053 return next
1054 }
1055 case c0.rval.IsValid():
1056 i := vUint(c0.rval)
1057 v1 := genValueUint(c1)
1058 n.exec = func(f *frame) bltn {
1059 _, j := v1(f)
1060 dest(f).SetUint(i << j)
1061 return next
1062 }
1063 case c1.rval.IsValid():
1064 j := vUint(c1.rval)
1065 v0 := genValueUint(c0)
1066 n.exec = func(f *frame) bltn {
1067 _, i := v0(f)
1068 dest(f).SetUint(i << j)
1069 return next
1070 }
1071 default:
1072 v0 := genValueUint(c0)
1073 v1 := genValueUint(c1)
1074 n.exec = func(f *frame) bltn {
1075 _, i := v0(f)
1076 _, j := v1(f)
1077 dest(f).SetUint(i << j)
1078 return next
1079 }
1080 }
1081 }
1082 }
1083
1084 func shlConst(n *node) {
1085 v0, v1 := n.child[0].rval, n.child[1].rval
1086 isConst := (v0.IsValid() && isConstantValue(v0.Type()))
1087 t := n.typ.rtype
1088 if isConst {
1089 t = constVal
1090 }
1091 n.rval = reflect.New(t).Elem()
1092 switch {
1093 case isConst:
1094 v := constant.Shift(vConstantValue(v0), token.SHL, uint(vUint(v1)))
1095 n.rval.Set(reflect.ValueOf(v))
1096 case isUint(t):
1097 n.rval.SetUint(vUint(v0) << vUint(v1))
1098 case isInt(t):
1099 n.rval.SetInt(vInt(v0) << vUint(v1))
1100 }
1101 }
1102
1103 func shr(n *node) {
1104 next := getExec(n.tnext)
1105 typ := n.typ.concrete().TypeOf()
1106 isInterface := n.typ.TypeOf().Kind() == reflect.Interface
1107 dest := genValueOutput(n, typ)
1108 c0, c1 := n.child[0], n.child[1]
1109
1110 switch typ.Kind() {
1111 case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
1112 switch {
1113 case isInterface:
1114 v0 := genValueInt(c0)
1115 v1 := genValueUint(c1)
1116 n.exec = func(f *frame) bltn {
1117 _, i := v0(f)
1118 _, j := v1(f)
1119 dest(f).Set(reflect.ValueOf(i >> j).Convert(typ))
1120 return next
1121 }
1122 case c0.rval.IsValid():
1123 i := vInt(c0.rval)
1124 v1 := genValueUint(c1)
1125 n.exec = func(f *frame) bltn {
1126 _, j := v1(f)
1127 dest(f).SetInt(i >> j)
1128 return next
1129 }
1130 case c1.rval.IsValid():
1131 v0 := genValueInt(c0)
1132 j := vUint(c1.rval)
1133 n.exec = func(f *frame) bltn {
1134 _, i := v0(f)
1135 dest(f).SetInt(i >> j)
1136 return next
1137 }
1138 default:
1139 v0 := genValueInt(c0)
1140 v1 := genValueUint(c1)
1141 n.exec = func(f *frame) bltn {
1142 _, i := v0(f)
1143 _, j := v1(f)
1144 dest(f).SetInt(i >> j)
1145 return next
1146 }
1147 }
1148 case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
1149 switch {
1150 case isInterface:
1151 v0 := genValueUint(c0)
1152 v1 := genValueUint(c1)
1153 n.exec = func(f *frame) bltn {
1154 _, i := v0(f)
1155 _, j := v1(f)
1156 dest(f).Set(reflect.ValueOf(i >> j).Convert(typ))
1157 return next
1158 }
1159 case c0.rval.IsValid():
1160 i := vUint(c0.rval)
1161 v1 := genValueUint(c1)
1162 n.exec = func(f *frame) bltn {
1163 _, j := v1(f)
1164 dest(f).SetUint(i >> j)
1165 return next
1166 }
1167 case c1.rval.IsValid():
1168 j := vUint(c1.rval)
1169 v0 := genValueUint(c0)
1170 n.exec = func(f *frame) bltn {
1171 _, i := v0(f)
1172 dest(f).SetUint(i >> j)
1173 return next
1174 }
1175 default:
1176 v0 := genValueUint(c0)
1177 v1 := genValueUint(c1)
1178 n.exec = func(f *frame) bltn {
1179 _, i := v0(f)
1180 _, j := v1(f)
1181 dest(f).SetUint(i >> j)
1182 return next
1183 }
1184 }
1185 }
1186 }
1187
1188 func shrConst(n *node) {
1189 v0, v1 := n.child[0].rval, n.child[1].rval
1190 isConst := (v0.IsValid() && isConstantValue(v0.Type()))
1191 t := n.typ.rtype
1192 if isConst {
1193 t = constVal
1194 }
1195 n.rval = reflect.New(t).Elem()
1196 switch {
1197 case isConst:
1198 v := constant.Shift(vConstantValue(v0), token.SHR, uint(vUint(v1)))
1199 n.rval.Set(reflect.ValueOf(v))
1200 case isUint(t):
1201 n.rval.SetUint(vUint(v0) >> vUint(v1))
1202 case isInt(t):
1203 n.rval.SetInt(vInt(v0) >> vUint(v1))
1204 }
1205 }
1206
1207 func sub(n *node) {
1208 next := getExec(n.tnext)
1209 typ := n.typ.concrete().TypeOf()
1210 isInterface := n.typ.TypeOf().Kind() == reflect.Interface
1211 dest := genValueOutput(n, typ)
1212 c0, c1 := n.child[0], n.child[1]
1213
1214 switch typ.Kind() {
1215 case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
1216 switch {
1217 case isInterface:
1218 v0 := genValueInt(c0)
1219 v1 := genValueInt(c1)
1220 n.exec = func(f *frame) bltn {
1221 _, i := v0(f)
1222 _, j := v1(f)
1223 dest(f).Set(reflect.ValueOf(i - j).Convert(typ))
1224 return next
1225 }
1226 case c0.rval.IsValid():
1227 i := vInt(c0.rval)
1228 v1 := genValueInt(c1)
1229 n.exec = func(f *frame) bltn {
1230 _, j := v1(f)
1231 dest(f).SetInt(i - j)
1232 return next
1233 }
1234 case c1.rval.IsValid():
1235 v0 := genValueInt(c0)
1236 j := vInt(c1.rval)
1237 n.exec = func(f *frame) bltn {
1238 _, i := v0(f)
1239 dest(f).SetInt(i - j)
1240 return next
1241 }
1242 default:
1243 v0 := genValueInt(c0)
1244 v1 := genValueInt(c1)
1245 n.exec = func(f *frame) bltn {
1246 _, i := v0(f)
1247 _, j := v1(f)
1248 dest(f).SetInt(i - j)
1249 return next
1250 }
1251 }
1252 case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
1253 switch {
1254 case isInterface:
1255 v0 := genValueUint(c0)
1256 v1 := genValueUint(c1)
1257 n.exec = func(f *frame) bltn {
1258 _, i := v0(f)
1259 _, j := v1(f)
1260 dest(f).Set(reflect.ValueOf(i - j).Convert(typ))
1261 return next
1262 }
1263 case c0.rval.IsValid():
1264 i := vUint(c0.rval)
1265 v1 := genValueUint(c1)
1266 n.exec = func(f *frame) bltn {
1267 _, j := v1(f)
1268 dest(f).SetUint(i - j)
1269 return next
1270 }
1271 case c1.rval.IsValid():
1272 j := vUint(c1.rval)
1273 v0 := genValueUint(c0)
1274 n.exec = func(f *frame) bltn {
1275 _, i := v0(f)
1276 dest(f).SetUint(i - j)
1277 return next
1278 }
1279 default:
1280 v0 := genValueUint(c0)
1281 v1 := genValueUint(c1)
1282 n.exec = func(f *frame) bltn {
1283 _, i := v0(f)
1284 _, j := v1(f)
1285 dest(f).SetUint(i - j)
1286 return next
1287 }
1288 }
1289 case reflect.Float32, reflect.Float64:
1290 switch {
1291 case isInterface:
1292 v0 := genValueFloat(c0)
1293 v1 := genValueFloat(c1)
1294 n.exec = func(f *frame) bltn {
1295 _, i := v0(f)
1296 _, j := v1(f)
1297 dest(f).Set(reflect.ValueOf(i - j).Convert(typ))
1298 return next
1299 }
1300 case c0.rval.IsValid():
1301 i := vFloat(c0.rval)
1302 v1 := genValueFloat(c1)
1303 n.exec = func(f *frame) bltn {
1304 _, j := v1(f)
1305 dest(f).SetFloat(i - j)
1306 return next
1307 }
1308 case c1.rval.IsValid():
1309 j := vFloat(c1.rval)
1310 v0 := genValueFloat(c0)
1311 n.exec = func(f *frame) bltn {
1312 _, i := v0(f)
1313 dest(f).SetFloat(i - j)
1314 return next
1315 }
1316 default:
1317 v0 := genValueFloat(c0)
1318 v1 := genValueFloat(c1)
1319 n.exec = func(f *frame) bltn {
1320 _, i := v0(f)
1321 _, j := v1(f)
1322 dest(f).SetFloat(i - j)
1323 return next
1324 }
1325 }
1326 case reflect.Complex64, reflect.Complex128:
1327 switch {
1328 case isInterface:
1329 v0 := genComplex(c0)
1330 v1 := genComplex(c1)
1331 n.exec = func(f *frame) bltn {
1332 dest(f).Set(reflect.ValueOf(v0(f) - v1(f)).Convert(typ))
1333 return next
1334 }
1335 case c0.rval.IsValid():
1336 r0 := vComplex(c0.rval)
1337 v1 := genComplex(c1)
1338 n.exec = func(f *frame) bltn {
1339 dest(f).SetComplex(r0 - v1(f))
1340 return next
1341 }
1342 case c1.rval.IsValid():
1343 r1 := vComplex(c1.rval)
1344 v0 := genComplex(c0)
1345 n.exec = func(f *frame) bltn {
1346 dest(f).SetComplex(v0(f) - r1)
1347 return next
1348 }
1349 default:
1350 v0 := genComplex(c0)
1351 v1 := genComplex(c1)
1352 n.exec = func(f *frame) bltn {
1353 dest(f).SetComplex(v0(f) - v1(f))
1354 return next
1355 }
1356 }
1357 }
1358 }
1359
1360 func subConst(n *node) {
1361 v0, v1 := n.child[0].rval, n.child[1].rval
1362 isConst := (v0.IsValid() && isConstantValue(v0.Type())) && (v1.IsValid() && isConstantValue(v1.Type()))
1363 t := n.typ.rtype
1364 if isConst {
1365 t = constVal
1366 }
1367 n.rval = reflect.New(t).Elem()
1368 switch {
1369 case isConst:
1370 v := constant.BinaryOp(vConstantValue(v0), token.SUB, vConstantValue(v1))
1371 n.rval.Set(reflect.ValueOf(v))
1372 case isComplex(t):
1373 n.rval.SetComplex(vComplex(v0) - vComplex(v1))
1374 case isFloat(t):
1375 n.rval.SetFloat(vFloat(v0) - vFloat(v1))
1376 case isUint(t):
1377 n.rval.SetUint(vUint(v0) - vUint(v1))
1378 case isInt(t):
1379 n.rval.SetInt(vInt(v0) - vInt(v1))
1380 }
1381 }
1382
1383 func xor(n *node) {
1384 next := getExec(n.tnext)
1385 typ := n.typ.concrete().TypeOf()
1386 isInterface := n.typ.TypeOf().Kind() == reflect.Interface
1387 dest := genValueOutput(n, typ)
1388 c0, c1 := n.child[0], n.child[1]
1389
1390 switch typ.Kind() {
1391 case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
1392 switch {
1393 case isInterface:
1394 v0 := genValueInt(c0)
1395 v1 := genValueInt(c1)
1396 n.exec = func(f *frame) bltn {
1397 _, i := v0(f)
1398 _, j := v1(f)
1399 dest(f).Set(reflect.ValueOf(i ^ j).Convert(typ))
1400 return next
1401 }
1402 case c0.rval.IsValid():
1403 i := vInt(c0.rval)
1404 v1 := genValueInt(c1)
1405 n.exec = func(f *frame) bltn {
1406 _, j := v1(f)
1407 dest(f).SetInt(i ^ j)
1408 return next
1409 }
1410 case c1.rval.IsValid():
1411 v0 := genValueInt(c0)
1412 j := vInt(c1.rval)
1413 n.exec = func(f *frame) bltn {
1414 _, i := v0(f)
1415 dest(f).SetInt(i ^ j)
1416 return next
1417 }
1418 default:
1419 v0 := genValueInt(c0)
1420 v1 := genValueInt(c1)
1421 n.exec = func(f *frame) bltn {
1422 _, i := v0(f)
1423 _, j := v1(f)
1424 dest(f).SetInt(i ^ j)
1425 return next
1426 }
1427 }
1428 case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
1429 switch {
1430 case isInterface:
1431 v0 := genValueUint(c0)
1432 v1 := genValueUint(c1)
1433 n.exec = func(f *frame) bltn {
1434 _, i := v0(f)
1435 _, j := v1(f)
1436 dest(f).Set(reflect.ValueOf(i ^ j).Convert(typ))
1437 return next
1438 }
1439 case c0.rval.IsValid():
1440 i := vUint(c0.rval)
1441 v1 := genValueUint(c1)
1442 n.exec = func(f *frame) bltn {
1443 _, j := v1(f)
1444 dest(f).SetUint(i ^ j)
1445 return next
1446 }
1447 case c1.rval.IsValid():
1448 j := vUint(c1.rval)
1449 v0 := genValueUint(c0)
1450 n.exec = func(f *frame) bltn {
1451 _, i := v0(f)
1452 dest(f).SetUint(i ^ j)
1453 return next
1454 }
1455 default:
1456 v0 := genValueUint(c0)
1457 v1 := genValueUint(c1)
1458 n.exec = func(f *frame) bltn {
1459 _, i := v0(f)
1460 _, j := v1(f)
1461 dest(f).SetUint(i ^ j)
1462 return next
1463 }
1464 }
1465 }
1466 }
1467
1468 func xorConst(n *node) {
1469 v0, v1 := n.child[0].rval, n.child[1].rval
1470 isConst := (v0.IsValid() && isConstantValue(v0.Type())) && (v1.IsValid() && isConstantValue(v1.Type()))
1471 t := n.typ.rtype
1472 if isConst {
1473 t = constVal
1474 }
1475 n.rval = reflect.New(t).Elem()
1476 switch {
1477 case isConst:
1478 v := constant.BinaryOp(constant.ToInt(vConstantValue(v0)), token.XOR, constant.ToInt(vConstantValue(v1)))
1479 n.rval.Set(reflect.ValueOf(v))
1480 case isUint(t):
1481 n.rval.SetUint(vUint(v0) ^ vUint(v1))
1482 case isInt(t):
1483 n.rval.SetInt(vInt(v0) ^ vInt(v1))
1484 }
1485 }
1486
1487 // Assign operators
1488
1489 func addAssign(n *node) {
1490 next := getExec(n.tnext)
1491 typ := n.typ.TypeOf()
1492 c0, c1 := n.child[0], n.child[1]
1493 setMap := isMapEntry(c0)
1494 var mapValue, indexValue func(*frame) reflect.Value
1495
1496 if setMap {
1497 mapValue = genValue(c0.child[0])
1498 indexValue = genValue(c0.child[1])
1499 }
1500
1501 if c1.rval.IsValid() {
1502 switch typ.Kind() {
1503 case reflect.String:
1504 v0 := genValueString(c0)
1505 v1 := vString(c1.rval)
1506 n.exec = func(f *frame) bltn {
1507 v, s := v0(f)
1508 v.SetString(s + v1)
1509 if setMap {
1510 mapValue(f).SetMapIndex(indexValue(f), v)
1511 }
1512 return next
1513 }
1514 case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
1515 v0 := genValueInt(c0)
1516 j := vInt(c1.rval)
1517 n.exec = func(f *frame) bltn {
1518 v, i := v0(f)
1519 v.SetInt(i + j)
1520 if setMap {
1521 mapValue(f).SetMapIndex(indexValue(f), v)
1522 }
1523 return next
1524 }
1525 case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
1526 v0 := genValueUint(c0)
1527 j := vUint(c1.rval)
1528 n.exec = func(f *frame) bltn {
1529 v, i := v0(f)
1530 v.SetUint(i + j)
1531 if setMap {
1532 mapValue(f).SetMapIndex(indexValue(f), v)
1533 }
1534 return next
1535 }
1536 case reflect.Float32, reflect.Float64:
1537 v0 := genValueFloat(c0)
1538 j := vFloat(c1.rval)
1539 n.exec = func(f *frame) bltn {
1540 v, i := v0(f)
1541 v.SetFloat(i + j)
1542 if setMap {
1543 mapValue(f).SetMapIndex(indexValue(f), v)
1544 }
1545 return next
1546 }
1547 case reflect.Complex64, reflect.Complex128:
1548 v0 := genValue(c0)
1549 v1 := vComplex(c1.rval)
1550 n.exec = func(f *frame) bltn {
1551 v := v0(f)
1552 v.SetComplex(v.Complex() + v1)
1553 if setMap {
1554 mapValue(f).SetMapIndex(indexValue(f), v)
1555 }
1556 return next
1557 }
1558 }
1559 } else {
1560 switch typ.Kind() {
1561 case reflect.String:
1562 v0 := genValueString(c0)
1563 v1 := genValue(c1)
1564 n.exec = func(f *frame) bltn {
1565 v, s := v0(f)
1566 v.SetString(s + v1(f).String())
1567 if setMap {
1568 mapValue(f).SetMapIndex(indexValue(f), v)
1569 }
1570 return next
1571 }
1572 case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
1573 v0 := genValueInt(c0)
1574 v1 := genValueInt(c1)
1575 n.exec = func(f *frame) bltn {
1576 v, i := v0(f)
1577 _, j := v1(f)
1578 v.SetInt(i + j)
1579 if setMap {
1580 mapValue(f).SetMapIndex(indexValue(f), v)
1581 }
1582 return next
1583 }
1584 case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
1585 v0 := genValueUint(c0)
1586 v1 := genValueUint(c1)
1587 n.exec = func(f *frame) bltn {
1588 v, i := v0(f)
1589 _, j := v1(f)
1590 v.SetUint(i + j)
1591 if setMap {
1592 mapValue(f).SetMapIndex(indexValue(f), v)
1593 }
1594 return next
1595 }
1596 case reflect.Float32, reflect.Float64:
1597 v0 := genValueFloat(c0)
1598 v1 := genValueFloat(c1)
1599 n.exec = func(f *frame) bltn {
1600 v, i := v0(f)
1601 _, j := v1(f)
1602 v.SetFloat(i + j)
1603 if setMap {
1604 mapValue(f).SetMapIndex(indexValue(f), v)
1605 }
1606 return next
1607 }
1608 case reflect.Complex64, reflect.Complex128:
1609 v0 := genValue(c0)
1610 v1 := genValue(c1)
1611 n.exec = func(f *frame) bltn {
1612 v := v0(f)
1613 v.SetComplex(v.Complex() + v1(f).Complex())
1614 if setMap {
1615 mapValue(f).SetMapIndex(indexValue(f), v)
1616 }
1617 return next
1618 }
1619 }
1620 }
1621 }
1622
1623 func andAssign(n *node) {
1624 next := getExec(n.tnext)
1625 typ := n.typ.TypeOf()
1626 c0, c1 := n.child[0], n.child[1]
1627 setMap := isMapEntry(c0)
1628 var mapValue, indexValue func(*frame) reflect.Value
1629
1630 if setMap {
1631 mapValue = genValue(c0.child[0])
1632 indexValue = genValue(c0.child[1])
1633 }
1634
1635 if c1.rval.IsValid() {
1636 switch typ.Kind() {
1637 case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
1638 v0 := genValueInt(c0)
1639 j := vInt(c1.rval)
1640 n.exec = func(f *frame) bltn {
1641 v, i := v0(f)
1642 v.SetInt(i & j)
1643 if setMap {
1644 mapValue(f).SetMapIndex(indexValue(f), v)
1645 }
1646 return next
1647 }
1648 case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
1649 v0 := genValueUint(c0)
1650 j := vUint(c1.rval)
1651 n.exec = func(f *frame) bltn {
1652 v, i := v0(f)
1653 v.SetUint(i & j)
1654 if setMap {
1655 mapValue(f).SetMapIndex(indexValue(f), v)
1656 }
1657 return next
1658 }
1659 }
1660 } else {
1661 switch typ.Kind() {
1662 case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
1663 v0 := genValueInt(c0)
1664 v1 := genValueInt(c1)
1665 n.exec = func(f *frame) bltn {
1666 v, i := v0(f)
1667 _, j := v1(f)
1668 v.SetInt(i & j)
1669 if setMap {
1670 mapValue(f).SetMapIndex(indexValue(f), v)
1671 }
1672 return next
1673 }
1674 case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
1675 v0 := genValueUint(c0)
1676 v1 := genValueUint(c1)
1677 n.exec = func(f *frame) bltn {
1678 v, i := v0(f)
1679 _, j := v1(f)
1680 v.SetUint(i & j)
1681 if setMap {
1682 mapValue(f).SetMapIndex(indexValue(f), v)
1683 }
1684 return next
1685 }
1686 }
1687 }
1688 }
1689
1690 func andNotAssign(n *node) {
1691 next := getExec(n.tnext)
1692 typ := n.typ.TypeOf()
1693 c0, c1 := n.child[0], n.child[1]
1694 setMap := isMapEntry(c0)
1695 var mapValue, indexValue func(*frame) reflect.Value
1696
1697 if setMap {
1698 mapValue = genValue(c0.child[0])
1699 indexValue = genValue(c0.child[1])
1700 }
1701
1702 if c1.rval.IsValid() {
1703 switch typ.Kind() {
1704 case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
1705 v0 := genValueInt(c0)
1706 j := vInt(c1.rval)
1707 n.exec = func(f *frame) bltn {
1708 v, i := v0(f)
1709 v.SetInt(i &^ j)
1710 if setMap {
1711 mapValue(f).SetMapIndex(indexValue(f), v)
1712 }
1713 return next
1714 }
1715 case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
1716 v0 := genValueUint(c0)
1717 j := vUint(c1.rval)
1718 n.exec = func(f *frame) bltn {
1719 v, i := v0(f)
1720 v.SetUint(i &^ j)
1721 if setMap {
1722 mapValue(f).SetMapIndex(indexValue(f), v)
1723 }
1724 return next
1725 }
1726 }
1727 } else {
1728 switch typ.Kind() {
1729 case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
1730 v0 := genValueInt(c0)
1731 v1 := genValueInt(c1)
1732 n.exec = func(f *frame) bltn {
1733 v, i := v0(f)
1734 _, j := v1(f)
1735 v.SetInt(i &^ j)
1736 if setMap {
1737 mapValue(f).SetMapIndex(indexValue(f), v)
1738 }
1739 return next
1740 }
1741 case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
1742 v0 := genValueUint(c0)
1743 v1 := genValueUint(c1)
1744 n.exec = func(f *frame) bltn {
1745 v, i := v0(f)
1746 _, j := v1(f)
1747 v.SetUint(i &^ j)
1748 if setMap {
1749 mapValue(f).SetMapIndex(indexValue(f), v)
1750 }
1751 return next
1752 }
1753 }
1754 }
1755 }
1756
1757 func mulAssign(n *node) {
1758 next := getExec(n.tnext)
1759 typ := n.typ.TypeOf()
1760 c0, c1 := n.child[0], n.child[1]
1761 setMap := isMapEntry(c0)
1762 var mapValue, indexValue func(*frame) reflect.Value
1763
1764 if setMap {
1765 mapValue = genValue(c0.child[0])
1766 indexValue = genValue(c0.child[1])
1767 }
1768
1769 if c1.rval.IsValid() {
1770 switch typ.Kind() {
1771 case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
1772 v0 := genValueInt(c0)
1773 j := vInt(c1.rval)
1774 n.exec = func(f *frame) bltn {
1775 v, i := v0(f)
1776 v.SetInt(i * j)
1777 if setMap {
1778 mapValue(f).SetMapIndex(indexValue(f), v)
1779 }
1780 return next
1781 }
1782 case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
1783 v0 := genValueUint(c0)
1784 j := vUint(c1.rval)
1785 n.exec = func(f *frame) bltn {
1786 v, i := v0(f)
1787 v.SetUint(i * j)
1788 if setMap {
1789 mapValue(f).SetMapIndex(indexValue(f), v)
1790 }
1791 return next
1792 }
1793 case reflect.Float32, reflect.Float64:
1794 v0 := genValueFloat(c0)
1795 j := vFloat(c1.rval)
1796 n.exec = func(f *frame) bltn {
1797 v, i := v0(f)
1798 v.SetFloat(i * j)
1799 if setMap {
1800 mapValue(f).SetMapIndex(indexValue(f), v)
1801 }
1802 return next
1803 }
1804 case reflect.Complex64, reflect.Complex128:
1805 v0 := genValue(c0)
1806 v1 := vComplex(c1.rval)
1807 n.exec = func(f *frame) bltn {
1808 v := v0(f)
1809 v.SetComplex(v.Complex() * v1)
1810 if setMap {
1811 mapValue(f).SetMapIndex(indexValue(f), v)
1812 }
1813 return next
1814 }
1815 }
1816 } else {
1817 switch typ.Kind() {
1818 case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
1819 v0 := genValueInt(c0)
1820 v1 := genValueInt(c1)
1821 n.exec = func(f *frame) bltn {
1822 v, i := v0(f)
1823 _, j := v1(f)
1824 v.SetInt(i * j)
1825 if setMap {
1826 mapValue(f).SetMapIndex(indexValue(f), v)
1827 }
1828 return next
1829 }
1830 case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
1831 v0 := genValueUint(c0)
1832 v1 := genValueUint(c1)
1833 n.exec = func(f *frame) bltn {
1834 v, i := v0(f)
1835 _, j := v1(f)
1836 v.SetUint(i * j)
1837 if setMap {
1838 mapValue(f).SetMapIndex(indexValue(f), v)
1839 }
1840 return next
1841 }
1842 case reflect.Float32, reflect.Float64:
1843 v0 := genValueFloat(c0)
1844 v1 := genValueFloat(c1)
1845 n.exec = func(f *frame) bltn {
1846 v, i := v0(f)
1847 _, j := v1(f)
1848 v.SetFloat(i * j)
1849 if setMap {
1850 mapValue(f).SetMapIndex(indexValue(f), v)
1851 }
1852 return next
1853 }
1854 case reflect.Complex64, reflect.Complex128:
1855 v0 := genValue(c0)
1856 v1 := genValue(c1)
1857 n.exec = func(f *frame) bltn {
1858 v := v0(f)
1859 v.SetComplex(v.Complex() * v1(f).Complex())
1860 if setMap {
1861 mapValue(f).SetMapIndex(indexValue(f), v)
1862 }
1863 return next
1864 }
1865 }
1866 }
1867 }
1868
1869 func orAssign(n *node) {
1870 next := getExec(n.tnext)
1871 typ := n.typ.TypeOf()
1872 c0, c1 := n.child[0], n.child[1]
1873 setMap := isMapEntry(c0)
1874 var mapValue, indexValue func(*frame) reflect.Value
1875
1876 if setMap {
1877 mapValue = genValue(c0.child[0])
1878 indexValue = genValue(c0.child[1])
1879 }
1880
1881 if c1.rval.IsValid() {
1882 switch typ.Kind() {
1883 case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
1884 v0 := genValueInt(c0)
1885 j := vInt(c1.rval)
1886 n.exec = func(f *frame) bltn {
1887 v, i := v0(f)
1888 v.SetInt(i | j)
1889 if setMap {
1890 mapValue(f).SetMapIndex(indexValue(f), v)
1891 }
1892 return next
1893 }
1894 case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
1895 v0 := genValueUint(c0)
1896 j := vUint(c1.rval)
1897 n.exec = func(f *frame) bltn {
1898 v, i := v0(f)
1899 v.SetUint(i | j)
1900 if setMap {
1901 mapValue(f).SetMapIndex(indexValue(f), v)
1902 }
1903 return next
1904 }
1905 }
1906 } else {
1907 switch typ.Kind() {
1908 case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
1909 v0 := genValueInt(c0)
1910 v1 := genValueInt(c1)
1911 n.exec = func(f *frame) bltn {
1912 v, i := v0(f)
1913 _, j := v1(f)
1914 v.SetInt(i | j)
1915 if setMap {
1916 mapValue(f).SetMapIndex(indexValue(f), v)
1917 }
1918 return next
1919 }
1920 case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
1921 v0 := genValueUint(c0)
1922 v1 := genValueUint(c1)
1923 n.exec = func(f *frame) bltn {
1924 v, i := v0(f)
1925 _, j := v1(f)
1926 v.SetUint(i | j)
1927 if setMap {
1928 mapValue(f).SetMapIndex(indexValue(f), v)
1929 }
1930 return next
1931 }
1932 }
1933 }
1934 }
1935
1936 func quoAssign(n *node) {
1937 next := getExec(n.tnext)
1938 typ := n.typ.TypeOf()
1939 c0, c1 := n.child[0], n.child[1]
1940 setMap := isMapEntry(c0)
1941 var mapValue, indexValue func(*frame) reflect.Value
1942
1943 if setMap {
1944 mapValue = genValue(c0.child[0])
1945 indexValue = genValue(c0.child[1])
1946 }
1947
1948 if c1.rval.IsValid() {
1949 switch typ.Kind() {
1950 case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
1951 v0 := genValueInt(c0)
1952 j := vInt(c1.rval)
1953 n.exec = func(f *frame) bltn {
1954 v, i := v0(f)
1955 v.SetInt(i / j)
1956 if setMap {
1957 mapValue(f).SetMapIndex(indexValue(f), v)
1958 }
1959 return next
1960 }
1961 case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
1962 v0 := genValueUint(c0)
1963 j := vUint(c1.rval)
1964 n.exec = func(f *frame) bltn {
1965 v, i := v0(f)
1966 v.SetUint(i / j)
1967 if setMap {
1968 mapValue(f).SetMapIndex(indexValue(f), v)
1969 }
1970 return next
1971 }
1972 case reflect.Float32, reflect.Float64:
1973 v0 := genValueFloat(c0)
1974 j := vFloat(c1.rval)
1975 n.exec = func(f *frame) bltn {
1976 v, i := v0(f)
1977 v.SetFloat(i / j)
1978 if setMap {
1979 mapValue(f).SetMapIndex(indexValue(f), v)
1980 }
1981 return next
1982 }
1983 case reflect.Complex64, reflect.Complex128:
1984 v0 := genValue(c0)
1985 v1 := vComplex(c1.rval)
1986 n.exec = func(f *frame) bltn {
1987 v := v0(f)
1988 v.SetComplex(v.Complex() / v1)
1989 if setMap {
1990 mapValue(f).SetMapIndex(indexValue(f), v)
1991 }
1992 return next
1993 }
1994 }
1995 } else {
1996 switch typ.Kind() {
1997 case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
1998 v0 := genValueInt(c0)
1999 v1 := genValueInt(c1)
2000 n.exec = func(f *frame) bltn {
2001 v, i := v0(f)
2002 _, j := v1(f)
2003 v.SetInt(i / j)
2004 if setMap {
2005 mapValue(f).SetMapIndex(indexValue(f), v)
2006 }
2007 return next
2008 }
2009 case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
2010 v0 := genValueUint(c0)
2011 v1 := genValueUint(c1)
2012 n.exec = func(f *frame) bltn {
2013 v, i := v0(f)
2014 _, j := v1(f)
2015 v.SetUint(i / j)
2016 if setMap {
2017 mapValue(f).SetMapIndex(indexValue(f), v)
2018 }
2019 return next
2020 }
2021 case reflect.Float32, reflect.Float64:
2022 v0 := genValueFloat(c0)
2023 v1 := genValueFloat(c1)
2024 n.exec = func(f *frame) bltn {
2025 v, i := v0(f)
2026 _, j := v1(f)
2027 v.SetFloat(i / j)
2028 if setMap {
2029 mapValue(f).SetMapIndex(indexValue(f), v)
2030 }
2031 return next
2032 }
2033 case reflect.Complex64, reflect.Complex128:
2034 v0 := genValue(c0)
2035 v1 := genValue(c1)
2036 n.exec = func(f *frame) bltn {
2037 v := v0(f)
2038 v.SetComplex(v.Complex() / v1(f).Complex())
2039 if setMap {
2040 mapValue(f).SetMapIndex(indexValue(f), v)
2041 }
2042 return next
2043 }
2044 }
2045 }
2046 }
2047
2048 func remAssign(n *node) {
2049 next := getExec(n.tnext)
2050 typ := n.typ.TypeOf()
2051 c0, c1 := n.child[0], n.child[1]
2052 setMap := isMapEntry(c0)
2053 var mapValue, indexValue func(*frame) reflect.Value
2054
2055 if setMap {
2056 mapValue = genValue(c0.child[0])
2057 indexValue = genValue(c0.child[1])
2058 }
2059
2060 if c1.rval.IsValid() {
2061 switch typ.Kind() {
2062 case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
2063 v0 := genValueInt(c0)
2064 j := vInt(c1.rval)
2065 n.exec = func(f *frame) bltn {
2066 v, i := v0(f)
2067 v.SetInt(i % j)
2068 if setMap {
2069 mapValue(f).SetMapIndex(indexValue(f), v)
2070 }
2071 return next
2072 }
2073 case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
2074 v0 := genValueUint(c0)
2075 j := vUint(c1.rval)
2076 n.exec = func(f *frame) bltn {
2077 v, i := v0(f)
2078 v.SetUint(i % j)
2079 if setMap {
2080 mapValue(f).SetMapIndex(indexValue(f), v)
2081 }
2082 return next
2083 }
2084 }
2085 } else {
2086 switch typ.Kind() {
2087 case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
2088 v0 := genValueInt(c0)
2089 v1 := genValueInt(c1)
2090 n.exec = func(f *frame) bltn {
2091 v, i := v0(f)
2092 _, j := v1(f)
2093 v.SetInt(i % j)
2094 if setMap {
2095 mapValue(f).SetMapIndex(indexValue(f), v)
2096 }
2097 return next
2098 }
2099 case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
2100 v0 := genValueUint(c0)
2101 v1 := genValueUint(c1)
2102 n.exec = func(f *frame) bltn {
2103 v, i := v0(f)
2104 _, j := v1(f)
2105 v.SetUint(i % j)
2106 if setMap {
2107 mapValue(f).SetMapIndex(indexValue(f), v)
2108 }
2109 return next
2110 }
2111 }
2112 }
2113 }
2114
2115 func shlAssign(n *node) {
2116 next := getExec(n.tnext)
2117 typ := n.typ.TypeOf()
2118 c0, c1 := n.child[0], n.child[1]
2119 setMap := isMapEntry(c0)
2120 var mapValue, indexValue func(*frame) reflect.Value
2121
2122 if setMap {
2123 mapValue = genValue(c0.child[0])
2124 indexValue = genValue(c0.child[1])
2125 }
2126
2127 if c1.rval.IsValid() {
2128 switch typ.Kind() {
2129 case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
2130 v0 := genValueInt(c0)
2131 j := vUint(c1.rval)
2132 n.exec = func(f *frame) bltn {
2133 v, i := v0(f)
2134 v.SetInt(i << j)
2135 if setMap {
2136 mapValue(f).SetMapIndex(indexValue(f), v)
2137 }
2138 return next
2139 }
2140 case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
2141 v0 := genValueUint(c0)
2142 j := vUint(c1.rval)
2143 n.exec = func(f *frame) bltn {
2144 v, i := v0(f)
2145 v.SetUint(i << j)
2146 if setMap {
2147 mapValue(f).SetMapIndex(indexValue(f), v)
2148 }
2149 return next
2150 }
2151 }
2152 } else {
2153 switch typ.Kind() {
2154 case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
2155 v0 := genValueInt(c0)
2156 v1 := genValueUint(c1)
2157 n.exec = func(f *frame) bltn {
2158 v, i := v0(f)
2159 _, j := v1(f)
2160 v.SetInt(i << j)
2161 if setMap {
2162 mapValue(f).SetMapIndex(indexValue(f), v)
2163 }
2164 return next
2165 }
2166 case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
2167 v0 := genValueUint(c0)
2168 v1 := genValueUint(c1)
2169 n.exec = func(f *frame) bltn {
2170 v, i := v0(f)
2171 _, j := v1(f)
2172 v.SetUint(i << j)
2173 if setMap {
2174 mapValue(f).SetMapIndex(indexValue(f), v)
2175 }
2176 return next
2177 }
2178 }
2179 }
2180 }
2181
2182 func shrAssign(n *node) {
2183 next := getExec(n.tnext)
2184 typ := n.typ.TypeOf()
2185 c0, c1 := n.child[0], n.child[1]
2186 setMap := isMapEntry(c0)
2187 var mapValue, indexValue func(*frame) reflect.Value
2188
2189 if setMap {
2190 mapValue = genValue(c0.child[0])
2191 indexValue = genValue(c0.child[1])
2192 }
2193
2194 if c1.rval.IsValid() {
2195 switch typ.Kind() {
2196 case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
2197 v0 := genValueInt(c0)
2198 j := vUint(c1.rval)
2199 n.exec = func(f *frame) bltn {
2200 v, i := v0(f)
2201 v.SetInt(i >> j)
2202 if setMap {
2203 mapValue(f).SetMapIndex(indexValue(f), v)
2204 }
2205 return next
2206 }
2207 case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
2208 v0 := genValueUint(c0)
2209 j := vUint(c1.rval)
2210 n.exec = func(f *frame) bltn {
2211 v, i := v0(f)
2212 v.SetUint(i >> j)
2213 if setMap {
2214 mapValue(f).SetMapIndex(indexValue(f), v)
2215 }
2216 return next
2217 }
2218 }
2219 } else {
2220 switch typ.Kind() {
2221 case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
2222 v0 := genValueInt(c0)
2223 v1 := genValueUint(c1)
2224 n.exec = func(f *frame) bltn {
2225 v, i := v0(f)
2226 _, j := v1(f)
2227 v.SetInt(i >> j)
2228 if setMap {
2229 mapValue(f).SetMapIndex(indexValue(f), v)
2230 }
2231 return next
2232 }
2233 case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
2234 v0 := genValueUint(c0)
2235 v1 := genValueUint(c1)
2236 n.exec = func(f *frame) bltn {
2237 v, i := v0(f)
2238 _, j := v1(f)
2239 v.SetUint(i >> j)
2240 if setMap {
2241 mapValue(f).SetMapIndex(indexValue(f), v)
2242 }
2243 return next
2244 }
2245 }
2246 }
2247 }
2248
2249 func subAssign(n *node) {
2250 next := getExec(n.tnext)
2251 typ := n.typ.TypeOf()
2252 c0, c1 := n.child[0], n.child[1]
2253 setMap := isMapEntry(c0)
2254 var mapValue, indexValue func(*frame) reflect.Value
2255
2256 if setMap {
2257 mapValue = genValue(c0.child[0])
2258 indexValue = genValue(c0.child[1])
2259 }
2260
2261 if c1.rval.IsValid() {
2262 switch typ.Kind() {
2263 case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
2264 v0 := genValueInt(c0)
2265 j := vInt(c1.rval)
2266 n.exec = func(f *frame) bltn {
2267 v, i := v0(f)
2268 v.SetInt(i - j)
2269 if setMap {
2270 mapValue(f).SetMapIndex(indexValue(f), v)
2271 }
2272 return next
2273 }
2274 case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
2275 v0 := genValueUint(c0)
2276 j := vUint(c1.rval)
2277 n.exec = func(f *frame) bltn {
2278 v, i := v0(f)
2279 v.SetUint(i - j)
2280 if setMap {
2281 mapValue(f).SetMapIndex(indexValue(f), v)
2282 }
2283 return next
2284 }
2285 case reflect.Float32, reflect.Float64:
2286 v0 := genValueFloat(c0)
2287 j := vFloat(c1.rval)
2288 n.exec = func(f *frame) bltn {
2289 v, i := v0(f)
2290 v.SetFloat(i - j)
2291 if setMap {
2292 mapValue(f).SetMapIndex(indexValue(f), v)
2293 }
2294 return next
2295 }
2296 case reflect.Complex64, reflect.Complex128:
2297 v0 := genValue(c0)
2298 v1 := vComplex(c1.rval)
2299 n.exec = func(f *frame) bltn {
2300 v := v0(f)
2301 v.SetComplex(v.Complex() - v1)
2302 if setMap {
2303 mapValue(f).SetMapIndex(indexValue(f), v)
2304 }
2305 return next
2306 }
2307 }
2308 } else {
2309 switch typ.Kind() {
2310 case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
2311 v0 := genValueInt(c0)
2312 v1 := genValueInt(c1)
2313 n.exec = func(f *frame) bltn {
2314 v, i := v0(f)
2315 _, j := v1(f)
2316 v.SetInt(i - j)
2317 if setMap {
2318 mapValue(f).SetMapIndex(indexValue(f), v)
2319 }
2320 return next
2321 }
2322 case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
2323 v0 := genValueUint(c0)
2324 v1 := genValueUint(c1)
2325 n.exec = func(f *frame) bltn {
2326 v, i := v0(f)
2327 _, j := v1(f)
2328 v.SetUint(i - j)
2329 if setMap {
2330 mapValue(f).SetMapIndex(indexValue(f), v)
2331 }
2332 return next
2333 }
2334 case reflect.Float32, reflect.Float64:
2335 v0 := genValueFloat(c0)
2336 v1 := genValueFloat(c1)
2337 n.exec = func(f *frame) bltn {
2338 v, i := v0(f)
2339 _, j := v1(f)
2340 v.SetFloat(i - j)
2341 if setMap {
2342 mapValue(f).SetMapIndex(indexValue(f), v)
2343 }
2344 return next
2345 }
2346 case reflect.Complex64, reflect.Complex128:
2347 v0 := genValue(c0)
2348 v1 := genValue(c1)
2349 n.exec = func(f *frame) bltn {
2350 v := v0(f)
2351 v.SetComplex(v.Complex() - v1(f).Complex())
2352 if setMap {
2353 mapValue(f).SetMapIndex(indexValue(f), v)
2354 }
2355 return next
2356 }
2357 }
2358 }
2359 }
2360
2361 func xorAssign(n *node) {
2362 next := getExec(n.tnext)
2363 typ := n.typ.TypeOf()
2364 c0, c1 := n.child[0], n.child[1]
2365 setMap := isMapEntry(c0)
2366 var mapValue, indexValue func(*frame) reflect.Value
2367
2368 if setMap {
2369 mapValue = genValue(c0.child[0])
2370 indexValue = genValue(c0.child[1])
2371 }
2372
2373 if c1.rval.IsValid() {
2374 switch typ.Kind() {
2375 case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
2376 v0 := genValueInt(c0)
2377 j := vInt(c1.rval)
2378 n.exec = func(f *frame) bltn {
2379 v, i := v0(f)
2380 v.SetInt(i ^ j)
2381 if setMap {
2382 mapValue(f).SetMapIndex(indexValue(f), v)
2383 }
2384 return next
2385 }
2386 case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
2387 v0 := genValueUint(c0)
2388 j := vUint(c1.rval)
2389 n.exec = func(f *frame) bltn {
2390 v, i := v0(f)
2391 v.SetUint(i ^ j)
2392 if setMap {
2393 mapValue(f).SetMapIndex(indexValue(f), v)
2394 }
2395 return next
2396 }
2397 }
2398 } else {
2399 switch typ.Kind() {
2400 case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
2401 v0 := genValueInt(c0)
2402 v1 := genValueInt(c1)
2403 n.exec = func(f *frame) bltn {
2404 v, i := v0(f)
2405 _, j := v1(f)
2406 v.SetInt(i ^ j)
2407 if setMap {
2408 mapValue(f).SetMapIndex(indexValue(f), v)
2409 }
2410 return next
2411 }
2412 case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
2413 v0 := genValueUint(c0)
2414 v1 := genValueUint(c1)
2415 n.exec = func(f *frame) bltn {
2416 v, i := v0(f)
2417 _, j := v1(f)
2418 v.SetUint(i ^ j)
2419 if setMap {
2420 mapValue(f).SetMapIndex(indexValue(f), v)
2421 }
2422 return next
2423 }
2424 }
2425 }
2426 }
2427
2428 func dec(n *node) {
2429 next := getExec(n.tnext)
2430 typ := n.typ.TypeOf()
2431 c0 := n.child[0]
2432 setMap := isMapEntry(c0)
2433 var mapValue, indexValue func(*frame) reflect.Value
2434
2435 if setMap {
2436 mapValue = genValue(c0.child[0])
2437 indexValue = genValue(c0.child[1])
2438 }
2439
2440 switch typ.Kind() {
2441 case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
2442 v0 := genValueInt(c0)
2443 n.exec = func(f *frame) bltn {
2444 v, i := v0(f)
2445 v.SetInt(i - 1)
2446 if setMap {
2447 mapValue(f).SetMapIndex(indexValue(f), v)
2448 }
2449 return next
2450 }
2451 case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
2452 v0 := genValueUint(c0)
2453 n.exec = func(f *frame) bltn {
2454 v, i := v0(f)
2455 v.SetUint(i - 1)
2456 if setMap {
2457 mapValue(f).SetMapIndex(indexValue(f), v)
2458 }
2459 return next
2460 }
2461 case reflect.Float32, reflect.Float64:
2462 v0 := genValueFloat(c0)
2463 n.exec = func(f *frame) bltn {
2464 v, i := v0(f)
2465 v.SetFloat(i - 1)
2466 if setMap {
2467 mapValue(f).SetMapIndex(indexValue(f), v)
2468 }
2469 return next
2470 }
2471 case reflect.Complex64, reflect.Complex128:
2472 v0 := genValue(c0)
2473 n.exec = func(f *frame) bltn {
2474 v := v0(f)
2475 v.SetComplex(v.Complex() - 1)
2476 if setMap {
2477 mapValue(f).SetMapIndex(indexValue(f), v)
2478 }
2479 return next
2480 }
2481 }
2482 }
2483
2484 func inc(n *node) {
2485 next := getExec(n.tnext)
2486 typ := n.typ.TypeOf()
2487 c0 := n.child[0]
2488 setMap := isMapEntry(c0)
2489 var mapValue, indexValue func(*frame) reflect.Value
2490
2491 if setMap {
2492 mapValue = genValue(c0.child[0])
2493 indexValue = genValue(c0.child[1])
2494 }
2495
2496 switch typ.Kind() {
2497 case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
2498 v0 := genValueInt(c0)
2499 n.exec = func(f *frame) bltn {
2500 v, i := v0(f)
2501 v.SetInt(i + 1)
2502 if setMap {
2503 mapValue(f).SetMapIndex(indexValue(f), v)
2504 }
2505 return next
2506 }
2507 case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
2508 v0 := genValueUint(c0)
2509 n.exec = func(f *frame) bltn {
2510 v, i := v0(f)
2511 v.SetUint(i + 1)
2512 if setMap {
2513 mapValue(f).SetMapIndex(indexValue(f), v)
2514 }
2515 return next
2516 }
2517 case reflect.Float32, reflect.Float64:
2518 v0 := genValueFloat(c0)
2519 n.exec = func(f *frame) bltn {
2520 v, i := v0(f)
2521 v.SetFloat(i + 1)
2522 if setMap {
2523 mapValue(f).SetMapIndex(indexValue(f), v)
2524 }
2525 return next
2526 }
2527 case reflect.Complex64, reflect.Complex128:
2528 v0 := genValue(c0)
2529 n.exec = func(f *frame) bltn {
2530 v := v0(f)
2531 v.SetComplex(v.Complex() + 1)
2532 if setMap {
2533 mapValue(f).SetMapIndex(indexValue(f), v)
2534 }
2535 return next
2536 }
2537 }
2538 }
2539
2540 func bitNotConst(n *node) {
2541 v0 := n.child[0].rval
2542 isConst := v0.IsValid() && isConstantValue(v0.Type())
2543 t := n.typ.rtype
2544 if isConst {
2545 t = constVal
2546 }
2547 n.rval = reflect.New(t).Elem()
2548 switch {
2549 case isConst:
2550 v := constant.UnaryOp(token.XOR, vConstantValue(v0), 0)
2551 n.rval.Set(reflect.ValueOf(v))
2552 case isUint(t):
2553 n.rval.SetUint(^v0.Uint())
2554 case isInt(t):
2555 n.rval.SetInt(^v0.Int())
2556 }
2557 }
2558
2559 func negConst(n *node) {
2560 v0 := n.child[0].rval
2561 isConst := v0.IsValid() && isConstantValue(v0.Type())
2562 t := n.typ.rtype
2563 if isConst {
2564 t = constVal
2565 }
2566 n.rval = reflect.New(t).Elem()
2567 switch {
2568 case isConst:
2569 v := constant.UnaryOp(token.SUB, vConstantValue(v0), 0)
2570 n.rval.Set(reflect.ValueOf(v))
2571 case isUint(t):
2572 n.rval.SetUint(-v0.Uint())
2573 case isInt(t):
2574 n.rval.SetInt(-v0.Int())
2575 case isFloat(t):
2576 n.rval.SetFloat(-v0.Float())
2577 case isComplex(t):
2578 n.rval.SetComplex(-v0.Complex())
2579 }
2580 }
2581
2582 func notConst(n *node) {
2583 v0 := n.child[0].rval
2584 isConst := v0.IsValid() && isConstantValue(v0.Type())
2585 t := n.typ.rtype
2586 if isConst {
2587 t = constVal
2588 }
2589 n.rval = reflect.New(t).Elem()
2590 if isConst {
2591 v := constant.UnaryOp(token.NOT, vConstantValue(v0), 0)
2592 n.rval.Set(reflect.ValueOf(v))
2593 } else {
2594 n.rval.SetBool(!v0.Bool())
2595 }
2596 }
2597
2598 func posConst(n *node) {
2599 v0 := n.child[0].rval
2600 isConst := v0.IsValid() && isConstantValue(v0.Type())
2601 t := n.typ.rtype
2602 if isConst {
2603 t = constVal
2604 }
2605 n.rval = reflect.New(t).Elem()
2606 switch {
2607 case isConst:
2608 v := constant.UnaryOp(token.ADD, vConstantValue(v0), 0)
2609 n.rval.Set(reflect.ValueOf(v))
2610 case isUint(t):
2611 n.rval.SetUint(+v0.Uint())
2612 case isInt(t):
2613 n.rval.SetInt(+v0.Int())
2614 case isFloat(t):
2615 n.rval.SetFloat(+v0.Float())
2616 case isComplex(t):
2617 n.rval.SetComplex(+v0.Complex())
2618 }
2619 }
2620
2621 func equal(n *node) {
2622 tnext := getExec(n.tnext)
2623 dest := genValueOutput(n, reflect.TypeOf(true))
2624 typ := n.typ.concrete().TypeOf()
2625 isInterface := n.typ.TypeOf().Kind() == reflect.Interface
2626 c0, c1 := n.child[0], n.child[1]
2627 t0, t1 := c0.typ.TypeOf(), c1.typ.TypeOf()
2628
2629 if c0.typ.cat == linkedT || c1.typ.cat == linkedT {
2630 switch {
2631 case isInterface:
2632 v0 := genValue(c0)
2633 v1 := genValue(c1)
2634 dest := genValue(n)
2635 n.exec = func(f *frame) bltn {
2636 i0 := v0(f).Interface()
2637 i1 := v1(f).Interface()
2638 dest(f).Set(reflect.ValueOf(i0 == i1).Convert(typ))
2639 return tnext
2640 }
2641 case c0.rval.IsValid():
2642 i0 := c0.rval.Interface()
2643 v1 := genValue(c1)
2644 if n.fnext != nil {
2645 fnext := getExec(n.fnext)
2646 n.exec = func(f *frame) bltn {
2647 i1 := v1(f).Interface()
2648 if i0 == i1 {
2649 dest(f).SetBool(true)
2650 return tnext
2651 }
2652 dest(f).SetBool(false)
2653 return fnext
2654 }
2655 } else {
2656 dest := genValue(n)
2657 n.exec = func(f *frame) bltn {
2658 i1 := v1(f).Interface()
2659 dest(f).SetBool(i0 == i1)
2660 return tnext
2661 }
2662 }
2663 case c1.rval.IsValid():
2664 i1 := c1.rval.Interface()
2665 v0 := genValue(c0)
2666 if n.fnext != nil {
2667 fnext := getExec(n.fnext)
2668 n.exec = func(f *frame) bltn {
2669 i0 := v0(f).Interface()
2670 if i0 == i1 {
2671 dest(f).SetBool(true)
2672 return tnext
2673 }
2674 dest(f).SetBool(false)
2675 return fnext
2676 }
2677 } else {
2678 dest := genValue(n)
2679 n.exec = func(f *frame) bltn {
2680 i0 := v0(f).Interface()
2681 dest(f).SetBool(i0 == i1)
2682 return tnext
2683 }
2684 }
2685 default:
2686 v0 := genValue(c0)
2687 v1 := genValue(c1)
2688 if n.fnext != nil {
2689 fnext := getExec(n.fnext)
2690 n.exec = func(f *frame) bltn {
2691 i0 := v0(f).Interface()
2692 i1 := v1(f).Interface()
2693 if i0 == i1 {
2694 dest(f).SetBool(true)
2695 return tnext
2696 }
2697 dest(f).SetBool(false)
2698 return fnext
2699 }
2700 } else {
2701 dest := genValue(n)
2702 n.exec = func(f *frame) bltn {
2703 i0 := v0(f).Interface()
2704 i1 := v1(f).Interface()
2705 dest(f).SetBool(i0 == i1)
2706 return tnext
2707 }
2708 }
2709 }
2710 return
2711 }
2712
2713 // Do not attempt to optimize '==' or '!=' if an operand is an interface.
2714 // This will preserve proper dynamic type checking at runtime. For static types,
2715 // type checks are already performed, so bypass them if possible.
2716 if t0.Kind() == reflect.Interface || t1.Kind() == reflect.Interface {
2717 v0 := genValue(c0)
2718 v1 := genValue(c1)
2719 if n.fnext != nil {
2720 fnext := getExec(n.fnext)
2721 n.exec = func(f *frame) bltn {
2722 i0 := v0(f).Interface()
2723 i1 := v1(f).Interface()
2724 if i0 == i1 {
2725 dest(f).SetBool(true)
2726 return tnext
2727 }
2728 dest(f).SetBool(false)
2729 return fnext
2730 }
2731 } else {
2732 dest := genValue(n)
2733 n.exec = func(f *frame) bltn {
2734 i0 := v0(f).Interface()
2735 i1 := v1(f).Interface()
2736 dest(f).SetBool(i0 == i1)
2737 return tnext
2738 }
2739 }
2740 return
2741 }
2742
2743 switch {
2744 case isString(t0) || isString(t1):
2745 switch {
2746 case isInterface:
2747 v0 := genValueString(c0)
2748 v1 := genValueString(c1)
2749 n.exec = func(f *frame) bltn {
2750 _, s0 := v0(f)
2751 _, s1 := v1(f)
2752 dest(f).Set(reflect.ValueOf(s0 == s1).Convert(typ))
2753 return tnext
2754 }
2755 case c0.rval.IsValid():
2756 s0 := vString(c0.rval)
2757 v1 := genValueString(c1)
2758 if n.fnext != nil {
2759 fnext := getExec(n.fnext)
2760 n.exec = func(f *frame) bltn {
2761 _, s1 := v1(f)
2762 if s0 == s1 {
2763 dest(f).SetBool(true)
2764 return tnext
2765 }
2766 dest(f).SetBool(false)
2767 return fnext
2768 }
2769 } else {
2770 n.exec = func(f *frame) bltn {
2771 _, s1 := v1(f)
2772 dest(f).SetBool(s0 == s1)
2773 return tnext
2774 }
2775 }
2776 case c1.rval.IsValid():
2777 s1 := vString(c1.rval)
2778 v0 := genValueString(c0)
2779 if n.fnext != nil {
2780 fnext := getExec(n.fnext)
2781 n.exec = func(f *frame) bltn {
2782 _, s0 := v0(f)
2783 if s0 == s1 {
2784 dest(f).SetBool(true)
2785 return tnext
2786 }
2787 dest(f).SetBool(false)
2788 return fnext
2789 }
2790 } else {
2791 n.exec = func(f *frame) bltn {
2792 _, s0 := v0(f)
2793 dest(f).SetBool(s0 == s1)
2794 return tnext
2795 }
2796 }
2797 default:
2798 v0 := genValueString(c0)
2799 v1 := genValueString(c1)
2800 if n.fnext != nil {
2801 fnext := getExec(n.fnext)
2802 n.exec = func(f *frame) bltn {
2803 _, s0 := v0(f)
2804 _, s1 := v1(f)
2805 if s0 == s1 {
2806 dest(f).SetBool(true)
2807 return tnext
2808 }
2809 dest(f).SetBool(false)
2810 return fnext
2811 }
2812 } else {
2813 n.exec = func(f *frame) bltn {
2814 _, s0 := v0(f)
2815 _, s1 := v1(f)
2816 dest(f).SetBool(s0 == s1)
2817 return tnext
2818 }
2819 }
2820 }
2821 case isFloat(t0) || isFloat(t1):
2822 switch {
2823 case isInterface:
2824 v0 := genValueFloat(c0)
2825 v1 := genValueFloat(c1)
2826 n.exec = func(f *frame) bltn {
2827 _, s0 := v0(f)
2828 _, s1 := v1(f)
2829 dest(f).Set(reflect.ValueOf(s0 == s1).Convert(typ))
2830 return tnext
2831 }
2832 case c0.rval.IsValid():
2833 s0 := vFloat(c0.rval)
2834 v1 := genValueFloat(c1)
2835 if n.fnext != nil {
2836 fnext := getExec(n.fnext)
2837 n.exec = func(f *frame) bltn {
2838 _, s1 := v1(f)
2839 if s0 == s1 {
2840 dest(f).SetBool(true)
2841 return tnext
2842 }
2843 dest(f).SetBool(false)
2844 return fnext
2845 }
2846 } else {
2847 n.exec = func(f *frame) bltn {
2848 _, s1 := v1(f)
2849 dest(f).SetBool(s0 == s1)
2850 return tnext
2851 }
2852 }
2853 case c1.rval.IsValid():
2854 s1 := vFloat(c1.rval)
2855 v0 := genValueFloat(c0)
2856 if n.fnext != nil {
2857 fnext := getExec(n.fnext)
2858 n.exec = func(f *frame) bltn {
2859 _, s0 := v0(f)
2860 if s0 == s1 {
2861 dest(f).SetBool(true)
2862 return tnext
2863 }
2864 dest(f).SetBool(false)
2865 return fnext
2866 }
2867 } else {
2868 dest := genValue(n)
2869 n.exec = func(f *frame) bltn {
2870 _, s0 := v0(f)
2871 dest(f).SetBool(s0 == s1)
2872 return tnext
2873 }
2874 }
2875 default:
2876 v0 := genValueFloat(c0)
2877 v1 := genValueFloat(c1)
2878 if n.fnext != nil {
2879 fnext := getExec(n.fnext)
2880 n.exec = func(f *frame) bltn {
2881 _, s0 := v0(f)
2882 _, s1 := v1(f)
2883 if s0 == s1 {
2884 dest(f).SetBool(true)
2885 return tnext
2886 }
2887 dest(f).SetBool(false)
2888 return fnext
2889 }
2890 } else {
2891 dest := genValue(n)
2892 n.exec = func(f *frame) bltn {
2893 _, s0 := v0(f)
2894 _, s1 := v1(f)
2895 dest(f).SetBool(s0 == s1)
2896 return tnext
2897 }
2898 }
2899 }
2900 case isUint(t0) || isUint(t1):
2901 switch {
2902 case isInterface:
2903 v0 := genValueUint(c0)
2904 v1 := genValueUint(c1)
2905 n.exec = func(f *frame) bltn {
2906 _, s0 := v0(f)
2907 _, s1 := v1(f)
2908 dest(f).Set(reflect.ValueOf(s0 == s1).Convert(typ))
2909 return tnext
2910 }
2911 case c0.rval.IsValid():
2912 s0 := vUint(c0.rval)
2913 v1 := genValueUint(c1)
2914 if n.fnext != nil {
2915 fnext := getExec(n.fnext)
2916 n.exec = func(f *frame) bltn {
2917 _, s1 := v1(f)
2918 if s0 == s1 {
2919 dest(f).SetBool(true)
2920 return tnext
2921 }
2922 dest(f).SetBool(false)
2923 return fnext
2924 }
2925 } else {
2926 dest := genValue(n)
2927 n.exec = func(f *frame) bltn {
2928 _, s1 := v1(f)
2929 dest(f).SetBool(s0 == s1)
2930 return tnext
2931 }
2932 }
2933 case c1.rval.IsValid():
2934 s1 := vUint(c1.rval)
2935 v0 := genValueUint(c0)
2936 if n.fnext != nil {
2937 fnext := getExec(n.fnext)
2938 n.exec = func(f *frame) bltn {
2939 _, s0 := v0(f)
2940 if s0 == s1 {
2941 dest(f).SetBool(true)
2942 return tnext
2943 }
2944 dest(f).SetBool(false)
2945 return fnext
2946 }
2947 } else {
2948 dest := genValue(n)
2949 n.exec = func(f *frame) bltn {
2950 _, s0 := v0(f)
2951 dest(f).SetBool(s0 == s1)
2952 return tnext
2953 }
2954 }
2955 default:
2956 v0 := genValueUint(c0)
2957 v1 := genValueUint(c1)
2958 if n.fnext != nil {
2959 fnext := getExec(n.fnext)
2960 n.exec = func(f *frame) bltn {
2961 _, s0 := v0(f)
2962 _, s1 := v1(f)
2963 if s0 == s1 {
2964 dest(f).SetBool(true)
2965 return tnext
2966 }
2967 dest(f).SetBool(false)
2968 return fnext
2969 }
2970 } else {
2971 dest := genValue(n)
2972 n.exec = func(f *frame) bltn {
2973 _, s0 := v0(f)
2974 _, s1 := v1(f)
2975 dest(f).SetBool(s0 == s1)
2976 return tnext
2977 }
2978 }
2979 }
2980 case isInt(t0) || isInt(t1):
2981 switch {
2982 case isInterface:
2983 v0 := genValueInt(c0)
2984 v1 := genValueInt(c1)
2985 n.exec = func(f *frame) bltn {
2986 _, s0 := v0(f)
2987 _, s1 := v1(f)
2988 dest(f).Set(reflect.ValueOf(s0 == s1).Convert(typ))
2989 return tnext
2990 }
2991 case c0.rval.IsValid():
2992 s0 := vInt(c0.rval)
2993 v1 := genValueInt(c1)
2994 if n.fnext != nil {
2995 fnext := getExec(n.fnext)
2996 n.exec = func(f *frame) bltn {
2997 _, s1 := v1(f)
2998 if s0 == s1 {
2999 dest(f).SetBool(true)
3000 return tnext
3001 }
3002 dest(f).SetBool(false)
3003 return fnext
3004 }
3005 } else {
3006 dest := genValue(n)
3007 n.exec = func(f *frame) bltn {
3008 _, s1 := v1(f)
3009 dest(f).SetBool(s0 == s1)
3010 return tnext
3011 }
3012 }
3013 case c1.rval.IsValid():
3014 s1 := vInt(c1.rval)
3015 v0 := genValueInt(c0)
3016 if n.fnext != nil {
3017 fnext := getExec(n.fnext)
3018 n.exec = func(f *frame) bltn {
3019 _, s0 := v0(f)
3020 if s0 == s1 {
3021 dest(f).SetBool(true)
3022 return tnext
3023 }
3024 dest(f).SetBool(false)
3025 return fnext
3026 }
3027 } else {
3028 dest := genValue(n)
3029 n.exec = func(f *frame) bltn {
3030 _, s0 := v0(f)
3031 dest(f).SetBool(s0 == s1)
3032 return tnext
3033 }
3034 }
3035 default:
3036 v0 := genValueInt(c0)
3037 v1 := genValueInt(c1)
3038 if n.fnext != nil {
3039 fnext := getExec(n.fnext)
3040 n.exec = func(f *frame) bltn {
3041 _, s0 := v0(f)
3042 _, s1 := v1(f)
3043 if s0 == s1 {
3044 dest(f).SetBool(true)
3045 return tnext
3046 }
3047 dest(f).SetBool(false)
3048 return fnext
3049 }
3050 } else {
3051 dest := genValue(n)
3052 n.exec = func(f *frame) bltn {
3053 _, s0 := v0(f)
3054 _, s1 := v1(f)
3055 dest(f).SetBool(s0 == s1)
3056 return tnext
3057 }
3058 }
3059 }
3060 case isComplex(t0) || isComplex(t1):
3061 switch {
3062 case isInterface:
3063 v0 := genComplex(c0)
3064 v1 := genComplex(c1)
3065 n.exec = func(f *frame) bltn {
3066 s0 := v0(f)
3067 s1 := v1(f)
3068 dest(f).Set(reflect.ValueOf(s0 == s1).Convert(typ))
3069 return tnext
3070 }
3071 case c0.rval.IsValid():
3072 s0 := vComplex(c0.rval)
3073 v1 := genComplex(c1)
3074 if n.fnext != nil {
3075 fnext := getExec(n.fnext)
3076 n.exec = func(f *frame) bltn {
3077 s1 := v1(f)
3078 if s0 == s1 {
3079 dest(f).SetBool(true)
3080 return tnext
3081 }
3082 dest(f).SetBool(false)
3083 return fnext
3084 }
3085 } else {
3086 n.exec = func(f *frame) bltn {
3087 s1 := v1(f)
3088 dest(f).SetBool(s0 == s1)
3089 return tnext
3090 }
3091 }
3092 case c1.rval.IsValid():
3093 s1 := vComplex(c1.rval)
3094 v0 := genComplex(c0)
3095 if n.fnext != nil {
3096 fnext := getExec(n.fnext)
3097 n.exec = func(f *frame) bltn {
3098 s0 := v0(f)
3099 if s0 == s1 {
3100 dest(f).SetBool(true)
3101 return tnext
3102 }
3103 dest(f).SetBool(false)
3104 return fnext
3105 }
3106 } else {
3107 dest := genValue(n)
3108 n.exec = func(f *frame) bltn {
3109 s0 := v0(f)
3110 dest(f).SetBool(s0 == s1)
3111 return tnext
3112 }
3113 }
3114 default:
3115 v0 := genComplex(c0)
3116 v1 := genComplex(c1)
3117 if n.fnext != nil {
3118 fnext := getExec(n.fnext)
3119 n.exec = func(f *frame) bltn {
3120 s0 := v0(f)
3121 s1 := v1(f)
3122 if s0 == s1 {
3123 dest(f).SetBool(true)
3124 return tnext
3125 }
3126 dest(f).SetBool(false)
3127 return fnext
3128 }
3129 } else {
3130 n.exec = func(f *frame) bltn {
3131 s0 := v0(f)
3132 s1 := v1(f)
3133 dest(f).SetBool(s0 == s1)
3134 return tnext
3135 }
3136 }
3137 }
3138 default:
3139 switch {
3140 case isInterface:
3141 v0 := genValue(c0)
3142 v1 := genValue(c1)
3143 n.exec = func(f *frame) bltn {
3144 i0 := v0(f).Interface()
3145 i1 := v1(f).Interface()
3146 dest(f).Set(reflect.ValueOf(i0 == i1).Convert(typ))
3147 return tnext
3148 }
3149 case c0.rval.IsValid():
3150 i0 := c0.rval.Interface()
3151 v1 := genValue(c1)
3152 if n.fnext != nil {
3153 fnext := getExec(n.fnext)
3154 n.exec = func(f *frame) bltn {
3155 i1 := v1(f).Interface()
3156 if i0 == i1 {
3157 dest(f).SetBool(true)
3158 return tnext
3159 }
3160 dest(f).SetBool(false)
3161 return fnext
3162 }
3163 } else {
3164 dest := genValue(n)
3165 n.exec = func(f *frame) bltn {
3166 i1 := v1(f).Interface()
3167 dest(f).SetBool(i0 == i1)
3168 return tnext
3169 }
3170 }
3171 case c1.rval.IsValid():
3172 i1 := c1.rval.Interface()
3173 v0 := genValue(c0)
3174 if n.fnext != nil {
3175 fnext := getExec(n.fnext)
3176 n.exec = func(f *frame) bltn {
3177 i0 := v0(f).Interface()
3178 if i0 == i1 {
3179 dest(f).SetBool(true)
3180 return tnext
3181 }
3182 dest(f).SetBool(false)
3183 return fnext
3184 }
3185 } else {
3186 dest := genValue(n)
3187 n.exec = func(f *frame) bltn {
3188 i0 := v0(f).Interface()
3189 dest(f).SetBool(i0 == i1)
3190 return tnext
3191 }
3192 }
3193 default:
3194 v0 := genValue(c0)
3195 v1 := genValue(c1)
3196 if n.fnext != nil {
3197 fnext := getExec(n.fnext)
3198 n.exec = func(f *frame) bltn {
3199 i0 := v0(f).Interface()
3200 i1 := v1(f).Interface()
3201 if i0 == i1 {
3202 dest(f).SetBool(true)
3203 return tnext
3204 }
3205 dest(f).SetBool(false)
3206 return fnext
3207 }
3208 } else {
3209 dest := genValue(n)
3210 n.exec = func(f *frame) bltn {
3211 i0 := v0(f).Interface()
3212 i1 := v1(f).Interface()
3213 dest(f).SetBool(i0 == i1)
3214 return tnext
3215 }
3216 }
3217 }
3218 }
3219 }
3220
3221 func greater(n *node) {
3222 tnext := getExec(n.tnext)
3223 dest := genValueOutput(n, reflect.TypeOf(true))
3224 typ := n.typ.concrete().TypeOf()
3225 isInterface := n.typ.TypeOf().Kind() == reflect.Interface
3226 c0, c1 := n.child[0], n.child[1]
3227 t0, t1 := c0.typ.TypeOf(), c1.typ.TypeOf()
3228
3229 switch {
3230 case isString(t0) || isString(t1):
3231 switch {
3232 case isInterface:
3233 v0 := genValueString(c0)
3234 v1 := genValueString(c1)
3235 n.exec = func(f *frame) bltn {
3236 _, s0 := v0(f)
3237 _, s1 := v1(f)
3238 dest(f).Set(reflect.ValueOf(s0 > s1).Convert(typ))
3239 return tnext
3240 }
3241 case c0.rval.IsValid():
3242 s0 := vString(c0.rval)
3243 v1 := genValueString(c1)
3244 if n.fnext != nil {
3245 fnext := getExec(n.fnext)
3246 n.exec = func(f *frame) bltn {
3247 _, s1 := v1(f)
3248 if s0 > s1 {
3249 dest(f).SetBool(true)
3250 return tnext
3251 }
3252 dest(f).SetBool(false)
3253 return fnext
3254 }
3255 } else {
3256 n.exec = func(f *frame) bltn {
3257 _, s1 := v1(f)
3258 dest(f).SetBool(s0 > s1)
3259 return tnext
3260 }
3261 }
3262 case c1.rval.IsValid():
3263 s1 := vString(c1.rval)
3264 v0 := genValueString(c0)
3265 if n.fnext != nil {
3266 fnext := getExec(n.fnext)
3267 n.exec = func(f *frame) bltn {
3268 _, s0 := v0(f)
3269 if s0 > s1 {
3270 dest(f).SetBool(true)
3271 return tnext
3272 }
3273 dest(f).SetBool(false)
3274 return fnext
3275 }
3276 } else {
3277 n.exec = func(f *frame) bltn {
3278 _, s0 := v0(f)
3279 dest(f).SetBool(s0 > s1)
3280 return tnext
3281 }
3282 }
3283 default:
3284 v0 := genValueString(c0)
3285 v1 := genValueString(c1)
3286 if n.fnext != nil {
3287 fnext := getExec(n.fnext)
3288 n.exec = func(f *frame) bltn {
3289 _, s0 := v0(f)
3290 _, s1 := v1(f)
3291 if s0 > s1 {
3292 dest(f).SetBool(true)
3293 return tnext
3294 }
3295 dest(f).SetBool(false)
3296 return fnext
3297 }
3298 } else {
3299 n.exec = func(f *frame) bltn {
3300 _, s0 := v0(f)
3301 _, s1 := v1(f)
3302 dest(f).SetBool(s0 > s1)
3303 return tnext
3304 }
3305 }
3306 }
3307 case isFloat(t0) || isFloat(t1):
3308 switch {
3309 case isInterface:
3310 v0 := genValueFloat(c0)
3311 v1 := genValueFloat(c1)
3312 n.exec = func(f *frame) bltn {
3313 _, s0 := v0(f)
3314 _, s1 := v1(f)
3315 dest(f).Set(reflect.ValueOf(s0 > s1).Convert(typ))
3316 return tnext
3317 }
3318 case c0.rval.IsValid():
3319 s0 := vFloat(c0.rval)
3320 v1 := genValueFloat(c1)
3321 if n.fnext != nil {
3322 fnext := getExec(n.fnext)
3323 n.exec = func(f *frame) bltn {
3324 _, s1 := v1(f)
3325 if s0 > s1 {
3326 dest(f).SetBool(true)
3327 return tnext
3328 }
3329 dest(f).SetBool(false)
3330 return fnext
3331 }
3332 } else {
3333 n.exec = func(f *frame) bltn {
3334 _, s1 := v1(f)
3335 dest(f).SetBool(s0 > s1)
3336 return tnext
3337 }
3338 }
3339 case c1.rval.IsValid():
3340 s1 := vFloat(c1.rval)
3341 v0 := genValueFloat(c0)
3342 if n.fnext != nil {
3343 fnext := getExec(n.fnext)
3344 n.exec = func(f *frame) bltn {
3345 _, s0 := v0(f)
3346 if s0 > s1 {
3347 dest(f).SetBool(true)
3348 return tnext
3349 }
3350 dest(f).SetBool(false)
3351 return fnext
3352 }
3353 } else {
3354 dest := genValue(n)
3355 n.exec = func(f *frame) bltn {
3356 _, s0 := v0(f)
3357 dest(f).SetBool(s0 > s1)
3358 return tnext
3359 }
3360 }
3361 default:
3362 v0 := genValueFloat(c0)
3363 v1 := genValueFloat(c1)
3364 if n.fnext != nil {
3365 fnext := getExec(n.fnext)
3366 n.exec = func(f *frame) bltn {
3367 _, s0 := v0(f)
3368 _, s1 := v1(f)
3369 if s0 > s1 {
3370 dest(f).SetBool(true)
3371 return tnext
3372 }
3373 dest(f).SetBool(false)
3374 return fnext
3375 }
3376 } else {
3377 dest := genValue(n)
3378 n.exec = func(f *frame) bltn {
3379 _, s0 := v0(f)
3380 _, s1 := v1(f)
3381 dest(f).SetBool(s0 > s1)
3382 return tnext
3383 }
3384 }
3385 }
3386 case isUint(t0) || isUint(t1):
3387 switch {
3388 case isInterface:
3389 v0 := genValueUint(c0)
3390 v1 := genValueUint(c1)
3391 n.exec = func(f *frame) bltn {
3392 _, s0 := v0(f)
3393 _, s1 := v1(f)
3394 dest(f).Set(reflect.ValueOf(s0 > s1).Convert(typ))
3395 return tnext
3396 }
3397 case c0.rval.IsValid():
3398 s0 := vUint(c0.rval)
3399 v1 := genValueUint(c1)
3400 if n.fnext != nil {
3401 fnext := getExec(n.fnext)
3402 n.exec = func(f *frame) bltn {
3403 _, s1 := v1(f)
3404 if s0 > s1 {
3405 dest(f).SetBool(true)
3406 return tnext
3407 }
3408 dest(f).SetBool(false)
3409 return fnext
3410 }
3411 } else {
3412 dest := genValue(n)
3413 n.exec = func(f *frame) bltn {
3414 _, s1 := v1(f)
3415 dest(f).SetBool(s0 > s1)
3416 return tnext
3417 }
3418 }
3419 case c1.rval.IsValid():
3420 s1 := vUint(c1.rval)
3421 v0 := genValueUint(c0)
3422 if n.fnext != nil {
3423 fnext := getExec(n.fnext)
3424 n.exec = func(f *frame) bltn {
3425 _, s0 := v0(f)
3426 if s0 > s1 {
3427 dest(f).SetBool(true)
3428 return tnext
3429 }
3430 dest(f).SetBool(false)
3431 return fnext
3432 }
3433 } else {
3434 dest := genValue(n)
3435 n.exec = func(f *frame) bltn {
3436 _, s0 := v0(f)
3437 dest(f).SetBool(s0 > s1)
3438 return tnext
3439 }
3440 }
3441 default:
3442 v0 := genValueUint(c0)
3443 v1 := genValueUint(c1)
3444 if n.fnext != nil {
3445 fnext := getExec(n.fnext)
3446 n.exec = func(f *frame) bltn {
3447 _, s0 := v0(f)
3448 _, s1 := v1(f)
3449 if s0 > s1 {
3450 dest(f).SetBool(true)
3451 return tnext
3452 }
3453 dest(f).SetBool(false)
3454 return fnext
3455 }
3456 } else {
3457 dest := genValue(n)
3458 n.exec = func(f *frame) bltn {
3459 _, s0 := v0(f)
3460 _, s1 := v1(f)
3461 dest(f).SetBool(s0 > s1)
3462 return tnext
3463 }
3464 }
3465 }
3466 case isInt(t0) || isInt(t1):
3467 switch {
3468 case isInterface:
3469 v0 := genValueInt(c0)
3470 v1 := genValueInt(c1)
3471 n.exec = func(f *frame) bltn {
3472 _, s0 := v0(f)
3473 _, s1 := v1(f)
3474 dest(f).Set(reflect.ValueOf(s0 > s1).Convert(typ))
3475 return tnext
3476 }
3477 case c0.rval.IsValid():
3478 s0 := vInt(c0.rval)
3479 v1 := genValueInt(c1)
3480 if n.fnext != nil {
3481 fnext := getExec(n.fnext)
3482 n.exec = func(f *frame) bltn {
3483 _, s1 := v1(f)
3484 if s0 > s1 {
3485 dest(f).SetBool(true)
3486 return tnext
3487 }
3488 dest(f).SetBool(false)
3489 return fnext
3490 }
3491 } else {
3492 dest := genValue(n)
3493 n.exec = func(f *frame) bltn {
3494 _, s1 := v1(f)
3495 dest(f).SetBool(s0 > s1)
3496 return tnext
3497 }
3498 }
3499 case c1.rval.IsValid():
3500 s1 := vInt(c1.rval)
3501 v0 := genValueInt(c0)
3502 if n.fnext != nil {
3503 fnext := getExec(n.fnext)
3504 n.exec = func(f *frame) bltn {
3505 _, s0 := v0(f)
3506 if s0 > s1 {
3507 dest(f).SetBool(true)
3508 return tnext
3509 }
3510 dest(f).SetBool(false)
3511 return fnext
3512 }
3513 } else {
3514 dest := genValue(n)
3515 n.exec = func(f *frame) bltn {
3516 _, s0 := v0(f)
3517 dest(f).SetBool(s0 > s1)
3518 return tnext
3519 }
3520 }
3521 default:
3522 v0 := genValueInt(c0)
3523 v1 := genValueInt(c1)
3524 if n.fnext != nil {
3525 fnext := getExec(n.fnext)
3526 n.exec = func(f *frame) bltn {
3527 _, s0 := v0(f)
3528 _, s1 := v1(f)
3529 if s0 > s1 {
3530 dest(f).SetBool(true)
3531 return tnext
3532 }
3533 dest(f).SetBool(false)
3534 return fnext
3535 }
3536 } else {
3537 dest := genValue(n)
3538 n.exec = func(f *frame) bltn {
3539 _, s0 := v0(f)
3540 _, s1 := v1(f)
3541 dest(f).SetBool(s0 > s1)
3542 return tnext
3543 }
3544 }
3545 }
3546 }
3547 }
3548
3549 func greaterEqual(n *node) {
3550 tnext := getExec(n.tnext)
3551 dest := genValueOutput(n, reflect.TypeOf(true))
3552 typ := n.typ.concrete().TypeOf()
3553 isInterface := n.typ.TypeOf().Kind() == reflect.Interface
3554 c0, c1 := n.child[0], n.child[1]
3555 t0, t1 := c0.typ.TypeOf(), c1.typ.TypeOf()
3556
3557 switch {
3558 case isString(t0) || isString(t1):
3559 switch {
3560 case isInterface:
3561 v0 := genValueString(c0)
3562 v1 := genValueString(c1)
3563 n.exec = func(f *frame) bltn {
3564 _, s0 := v0(f)
3565 _, s1 := v1(f)
3566 dest(f).Set(reflect.ValueOf(s0 >= s1).Convert(typ))
3567 return tnext
3568 }
3569 case c0.rval.IsValid():
3570 s0 := vString(c0.rval)
3571 v1 := genValueString(c1)
3572 if n.fnext != nil {
3573 fnext := getExec(n.fnext)
3574 n.exec = func(f *frame) bltn {
3575 _, s1 := v1(f)
3576 if s0 >= s1 {
3577 dest(f).SetBool(true)
3578 return tnext
3579 }
3580 dest(f).SetBool(false)
3581 return fnext
3582 }
3583 } else {
3584 n.exec = func(f *frame) bltn {
3585 _, s1 := v1(f)
3586 dest(f).SetBool(s0 >= s1)
3587 return tnext
3588 }
3589 }
3590 case c1.rval.IsValid():
3591 s1 := vString(c1.rval)
3592 v0 := genValueString(c0)
3593 if n.fnext != nil {
3594 fnext := getExec(n.fnext)
3595 n.exec = func(f *frame) bltn {
3596 _, s0 := v0(f)
3597 if s0 >= s1 {
3598 dest(f).SetBool(true)
3599 return tnext
3600 }
3601 dest(f).SetBool(false)
3602 return fnext
3603 }
3604 } else {
3605 n.exec = func(f *frame) bltn {
3606 _, s0 := v0(f)
3607 dest(f).SetBool(s0 >= s1)
3608 return tnext
3609 }
3610 }
3611 default:
3612 v0 := genValueString(c0)
3613 v1 := genValueString(c1)
3614 if n.fnext != nil {
3615 fnext := getExec(n.fnext)
3616 n.exec = func(f *frame) bltn {
3617 _, s0 := v0(f)
3618 _, s1 := v1(f)
3619 if s0 >= s1 {
3620 dest(f).SetBool(true)
3621 return tnext
3622 }
3623 dest(f).SetBool(false)
3624 return fnext
3625 }
3626 } else {
3627 n.exec = func(f *frame) bltn {
3628 _, s0 := v0(f)
3629 _, s1 := v1(f)
3630 dest(f).SetBool(s0 >= s1)
3631 return tnext
3632 }
3633 }
3634 }
3635 case isFloat(t0) || isFloat(t1):
3636 switch {
3637 case isInterface:
3638 v0 := genValueFloat(c0)
3639 v1 := genValueFloat(c1)
3640 n.exec = func(f *frame) bltn {
3641 _, s0 := v0(f)
3642 _, s1 := v1(f)
3643 dest(f).Set(reflect.ValueOf(s0 >= s1).Convert(typ))
3644 return tnext
3645 }
3646 case c0.rval.IsValid():
3647 s0 := vFloat(c0.rval)
3648 v1 := genValueFloat(c1)
3649 if n.fnext != nil {
3650 fnext := getExec(n.fnext)
3651 n.exec = func(f *frame) bltn {
3652 _, s1 := v1(f)
3653 if s0 >= s1 {
3654 dest(f).SetBool(true)
3655 return tnext
3656 }
3657 dest(f).SetBool(false)
3658 return fnext
3659 }
3660 } else {
3661 n.exec = func(f *frame) bltn {
3662 _, s1 := v1(f)
3663 dest(f).SetBool(s0 >= s1)
3664 return tnext
3665 }
3666 }
3667 case c1.rval.IsValid():
3668 s1 := vFloat(c1.rval)
3669 v0 := genValueFloat(c0)
3670 if n.fnext != nil {
3671 fnext := getExec(n.fnext)
3672 n.exec = func(f *frame) bltn {
3673 _, s0 := v0(f)
3674 if s0 >= s1 {
3675 dest(f).SetBool(true)
3676 return tnext
3677 }
3678 dest(f).SetBool(false)
3679 return fnext
3680 }
3681 } else {
3682 dest := genValue(n)
3683 n.exec = func(f *frame) bltn {
3684 _, s0 := v0(f)
3685 dest(f).SetBool(s0 >= s1)
3686 return tnext
3687 }
3688 }
3689 default:
3690 v0 := genValueFloat(c0)
3691 v1 := genValueFloat(c1)
3692 if n.fnext != nil {
3693 fnext := getExec(n.fnext)
3694 n.exec = func(f *frame) bltn {
3695 _, s0 := v0(f)
3696 _, s1 := v1(f)
3697 if s0 >= s1 {
3698 dest(f).SetBool(true)
3699 return tnext
3700 }
3701 dest(f).SetBool(false)
3702 return fnext
3703 }
3704 } else {
3705 dest := genValue(n)
3706 n.exec = func(f *frame) bltn {
3707 _, s0 := v0(f)
3708 _, s1 := v1(f)
3709 dest(f).SetBool(s0 >= s1)
3710 return tnext
3711 }
3712 }
3713 }
3714 case isUint(t0) || isUint(t1):
3715 switch {
3716 case isInterface:
3717 v0 := genValueUint(c0)
3718 v1 := genValueUint(c1)
3719 n.exec = func(f *frame) bltn {
3720 _, s0 := v0(f)
3721 _, s1 := v1(f)
3722 dest(f).Set(reflect.ValueOf(s0 >= s1).Convert(typ))
3723 return tnext
3724 }
3725 case c0.rval.IsValid():
3726 s0 := vUint(c0.rval)
3727 v1 := genValueUint(c1)
3728 if n.fnext != nil {
3729 fnext := getExec(n.fnext)
3730 n.exec = func(f *frame) bltn {
3731 _, s1 := v1(f)
3732 if s0 >= s1 {
3733 dest(f).SetBool(true)
3734 return tnext
3735 }
3736 dest(f).SetBool(false)
3737 return fnext
3738 }
3739 } else {
3740 dest := genValue(n)
3741 n.exec = func(f *frame) bltn {
3742 _, s1 := v1(f)
3743 dest(f).SetBool(s0 >= s1)
3744 return tnext
3745 }
3746 }
3747 case c1.rval.IsValid():
3748 s1 := vUint(c1.rval)
3749 v0 := genValueUint(c0)
3750 if n.fnext != nil {
3751 fnext := getExec(n.fnext)
3752 n.exec = func(f *frame) bltn {
3753 _, s0 := v0(f)
3754 if s0 >= s1 {
3755 dest(f).SetBool(true)
3756 return tnext
3757 }
3758 dest(f).SetBool(false)
3759 return fnext
3760 }
3761 } else {
3762 dest := genValue(n)
3763 n.exec = func(f *frame) bltn {
3764 _, s0 := v0(f)
3765 dest(f).SetBool(s0 >= s1)
3766 return tnext
3767 }
3768 }
3769 default:
3770 v0 := genValueUint(c0)
3771 v1 := genValueUint(c1)
3772 if n.fnext != nil {
3773 fnext := getExec(n.fnext)
3774 n.exec = func(f *frame) bltn {
3775 _, s0 := v0(f)
3776 _, s1 := v1(f)
3777 if s0 >= s1 {
3778 dest(f).SetBool(true)
3779 return tnext
3780 }
3781 dest(f).SetBool(false)
3782 return fnext
3783 }
3784 } else {
3785 dest := genValue(n)
3786 n.exec = func(f *frame) bltn {
3787 _, s0 := v0(f)
3788 _, s1 := v1(f)
3789 dest(f).SetBool(s0 >= s1)
3790 return tnext
3791 }
3792 }
3793 }
3794 case isInt(t0) || isInt(t1):
3795 switch {
3796 case isInterface:
3797 v0 := genValueInt(c0)
3798 v1 := genValueInt(c1)
3799 n.exec = func(f *frame) bltn {
3800 _, s0 := v0(f)
3801 _, s1 := v1(f)
3802 dest(f).Set(reflect.ValueOf(s0 >= s1).Convert(typ))
3803 return tnext
3804 }
3805 case c0.rval.IsValid():
3806 s0 := vInt(c0.rval)
3807 v1 := genValueInt(c1)
3808 if n.fnext != nil {
3809 fnext := getExec(n.fnext)
3810 n.exec = func(f *frame) bltn {
3811 _, s1 := v1(f)
3812 if s0 >= s1 {
3813 dest(f).SetBool(true)
3814 return tnext
3815 }
3816 dest(f).SetBool(false)
3817 return fnext
3818 }
3819 } else {
3820 dest := genValue(n)
3821 n.exec = func(f *frame) bltn {
3822 _, s1 := v1(f)
3823 dest(f).SetBool(s0 >= s1)
3824 return tnext
3825 }
3826 }
3827 case c1.rval.IsValid():
3828 s1 := vInt(c1.rval)
3829 v0 := genValueInt(c0)
3830 if n.fnext != nil {
3831 fnext := getExec(n.fnext)
3832 n.exec = func(f *frame) bltn {
3833 _, s0 := v0(f)
3834 if s0 >= s1 {
3835 dest(f).SetBool(true)
3836 return tnext
3837 }
3838 dest(f).SetBool(false)
3839 return fnext
3840 }
3841 } else {
3842 dest := genValue(n)
3843 n.exec = func(f *frame) bltn {
3844 _, s0 := v0(f)
3845 dest(f).SetBool(s0 >= s1)
3846 return tnext
3847 }
3848 }
3849 default:
3850 v0 := genValueInt(c0)
3851 v1 := genValueInt(c1)
3852 if n.fnext != nil {
3853 fnext := getExec(n.fnext)
3854 n.exec = func(f *frame) bltn {
3855 _, s0 := v0(f)
3856 _, s1 := v1(f)
3857 if s0 >= s1 {
3858 dest(f).SetBool(true)
3859 return tnext
3860 }
3861 dest(f).SetBool(false)
3862 return fnext
3863 }
3864 } else {
3865 dest := genValue(n)
3866 n.exec = func(f *frame) bltn {
3867 _, s0 := v0(f)
3868 _, s1 := v1(f)
3869 dest(f).SetBool(s0 >= s1)
3870 return tnext
3871 }
3872 }
3873 }
3874 }
3875 }
3876
3877 func lower(n *node) {
3878 tnext := getExec(n.tnext)
3879 dest := genValueOutput(n, reflect.TypeOf(true))
3880 typ := n.typ.concrete().TypeOf()
3881 isInterface := n.typ.TypeOf().Kind() == reflect.Interface
3882 c0, c1 := n.child[0], n.child[1]
3883 t0, t1 := c0.typ.TypeOf(), c1.typ.TypeOf()
3884
3885 switch {
3886 case isString(t0) || isString(t1):
3887 switch {
3888 case isInterface:
3889 v0 := genValueString(c0)
3890 v1 := genValueString(c1)
3891 n.exec = func(f *frame) bltn {
3892 _, s0 := v0(f)
3893 _, s1 := v1(f)
3894 dest(f).Set(reflect.ValueOf(s0 < s1).Convert(typ))
3895 return tnext
3896 }
3897 case c0.rval.IsValid():
3898 s0 := vString(c0.rval)
3899 v1 := genValueString(c1)
3900 if n.fnext != nil {
3901 fnext := getExec(n.fnext)
3902 n.exec = func(f *frame) bltn {
3903 _, s1 := v1(f)
3904 if s0 < s1 {
3905 dest(f).SetBool(true)
3906 return tnext
3907 }
3908 dest(f).SetBool(false)
3909 return fnext
3910 }
3911 } else {
3912 n.exec = func(f *frame) bltn {
3913 _, s1 := v1(f)
3914 dest(f).SetBool(s0 < s1)
3915 return tnext
3916 }
3917 }
3918 case c1.rval.IsValid():
3919 s1 := vString(c1.rval)
3920 v0 := genValueString(c0)
3921 if n.fnext != nil {
3922 fnext := getExec(n.fnext)
3923 n.exec = func(f *frame) bltn {
3924 _, s0 := v0(f)
3925 if s0 < s1 {
3926 dest(f).SetBool(true)
3927 return tnext
3928 }
3929 dest(f).SetBool(false)
3930 return fnext
3931 }
3932 } else {
3933 n.exec = func(f *frame) bltn {
3934 _, s0 := v0(f)
3935 dest(f).SetBool(s0 < s1)
3936 return tnext
3937 }
3938 }
3939 default:
3940 v0 := genValueString(c0)
3941 v1 := genValueString(c1)
3942 if n.fnext != nil {
3943 fnext := getExec(n.fnext)
3944 n.exec = func(f *frame) bltn {
3945 _, s0 := v0(f)
3946 _, s1 := v1(f)
3947 if s0 < s1 {
3948 dest(f).SetBool(true)
3949 return tnext
3950 }
3951 dest(f).SetBool(false)
3952 return fnext
3953 }
3954 } else {
3955 n.exec = func(f *frame) bltn {
3956 _, s0 := v0(f)
3957 _, s1 := v1(f)
3958 dest(f).SetBool(s0 < s1)
3959 return tnext
3960 }
3961 }
3962 }
3963 case isFloat(t0) || isFloat(t1):
3964 switch {
3965 case isInterface:
3966 v0 := genValueFloat(c0)
3967 v1 := genValueFloat(c1)
3968 n.exec = func(f *frame) bltn {
3969 _, s0 := v0(f)
3970 _, s1 := v1(f)
3971 dest(f).Set(reflect.ValueOf(s0 < s1).Convert(typ))
3972 return tnext
3973 }
3974 case c0.rval.IsValid():
3975 s0 := vFloat(c0.rval)
3976 v1 := genValueFloat(c1)
3977 if n.fnext != nil {
3978 fnext := getExec(n.fnext)
3979 n.exec = func(f *frame) bltn {
3980 _, s1 := v1(f)
3981 if s0 < s1 {
3982 dest(f).SetBool(true)
3983 return tnext
3984 }
3985 dest(f).SetBool(false)
3986 return fnext
3987 }
3988 } else {
3989 n.exec = func(f *frame) bltn {
3990 _, s1 := v1(f)
3991 dest(f).SetBool(s0 < s1)
3992 return tnext
3993 }
3994 }
3995 case c1.rval.IsValid():
3996 s1 := vFloat(c1.rval)
3997 v0 := genValueFloat(c0)
3998 if n.fnext != nil {
3999 fnext := getExec(n.fnext)
4000 n.exec = func(f *frame) bltn {
4001 _, s0 := v0(f)
4002 if s0 < s1 {
4003 dest(f).SetBool(true)
4004 return tnext
4005 }
4006 dest(f).SetBool(false)
4007 return fnext
4008 }
4009 } else {
4010 dest := genValue(n)
4011 n.exec = func(f *frame) bltn {
4012 _, s0 := v0(f)
4013 dest(f).SetBool(s0 < s1)
4014 return tnext
4015 }
4016 }
4017 default:
4018 v0 := genValueFloat(c0)
4019 v1 := genValueFloat(c1)
4020 if n.fnext != nil {
4021 fnext := getExec(n.fnext)
4022 n.exec = func(f *frame) bltn {
4023 _, s0 := v0(f)
4024 _, s1 := v1(f)
4025 if s0 < s1 {
4026 dest(f).SetBool(true)
4027 return tnext
4028 }
4029 dest(f).SetBool(false)
4030 return fnext
4031 }
4032 } else {
4033 dest := genValue(n)
4034 n.exec = func(f *frame) bltn {
4035 _, s0 := v0(f)
4036 _, s1 := v1(f)
4037 dest(f).SetBool(s0 < s1)
4038 return tnext
4039 }
4040 }
4041 }
4042 case isUint(t0) || isUint(t1):
4043 switch {
4044 case isInterface:
4045 v0 := genValueUint(c0)
4046 v1 := genValueUint(c1)
4047 n.exec = func(f *frame) bltn {
4048 _, s0 := v0(f)
4049 _, s1 := v1(f)
4050 dest(f).Set(reflect.ValueOf(s0 < s1).Convert(typ))
4051 return tnext
4052 }
4053 case c0.rval.IsValid():
4054 s0 := vUint(c0.rval)
4055 v1 := genValueUint(c1)
4056 if n.fnext != nil {
4057 fnext := getExec(n.fnext)
4058 n.exec = func(f *frame) bltn {
4059 _, s1 := v1(f)
4060 if s0 < s1 {
4061 dest(f).SetBool(true)
4062 return tnext
4063 }
4064 dest(f).SetBool(false)
4065 return fnext
4066 }
4067 } else {
4068 dest := genValue(n)
4069 n.exec = func(f *frame) bltn {
4070 _, s1 := v1(f)
4071 dest(f).SetBool(s0 < s1)
4072 return tnext
4073 }
4074 }
4075 case c1.rval.IsValid():
4076 s1 := vUint(c1.rval)
4077 v0 := genValueUint(c0)
4078 if n.fnext != nil {
4079 fnext := getExec(n.fnext)
4080 n.exec = func(f *frame) bltn {
4081 _, s0 := v0(f)
4082 if s0 < s1 {
4083 dest(f).SetBool(true)
4084 return tnext
4085 }
4086 dest(f).SetBool(false)
4087 return fnext
4088 }
4089 } else {
4090 dest := genValue(n)
4091 n.exec = func(f *frame) bltn {
4092 _, s0 := v0(f)
4093 dest(f).SetBool(s0 < s1)
4094 return tnext
4095 }
4096 }
4097 default:
4098 v0 := genValueUint(c0)
4099 v1 := genValueUint(c1)
4100 if n.fnext != nil {
4101 fnext := getExec(n.fnext)
4102 n.exec = func(f *frame) bltn {
4103 _, s0 := v0(f)
4104 _, s1 := v1(f)
4105 if s0 < s1 {
4106 dest(f).SetBool(true)
4107 return tnext
4108 }
4109 dest(f).SetBool(false)
4110 return fnext
4111 }
4112 } else {
4113 dest := genValue(n)
4114 n.exec = func(f *frame) bltn {
4115 _, s0 := v0(f)
4116 _, s1 := v1(f)
4117 dest(f).SetBool(s0 < s1)
4118 return tnext
4119 }
4120 }
4121 }
4122 case isInt(t0) || isInt(t1):
4123 switch {
4124 case isInterface:
4125 v0 := genValueInt(c0)
4126 v1 := genValueInt(c1)
4127 n.exec = func(f *frame) bltn {
4128 _, s0 := v0(f)
4129 _, s1 := v1(f)
4130 dest(f).Set(reflect.ValueOf(s0 < s1).Convert(typ))
4131 return tnext
4132 }
4133 case c0.rval.IsValid():
4134 s0 := vInt(c0.rval)
4135 v1 := genValueInt(c1)
4136 if n.fnext != nil {
4137 fnext := getExec(n.fnext)
4138 n.exec = func(f *frame) bltn {
4139 _, s1 := v1(f)
4140 if s0 < s1 {
4141 dest(f).SetBool(true)
4142 return tnext
4143 }
4144 dest(f).SetBool(false)
4145 return fnext
4146 }
4147 } else {
4148 dest := genValue(n)
4149 n.exec = func(f *frame) bltn {
4150 _, s1 := v1(f)
4151 dest(f).SetBool(s0 < s1)
4152 return tnext
4153 }
4154 }
4155 case c1.rval.IsValid():
4156 s1 := vInt(c1.rval)
4157 v0 := genValueInt(c0)
4158 if n.fnext != nil {
4159 fnext := getExec(n.fnext)
4160 n.exec = func(f *frame) bltn {
4161 _, s0 := v0(f)
4162 if s0 < s1 {
4163 dest(f).SetBool(true)
4164 return tnext
4165 }
4166 dest(f).SetBool(false)
4167 return fnext
4168 }
4169 } else {
4170 dest := genValue(n)
4171 n.exec = func(f *frame) bltn {
4172 _, s0 := v0(f)
4173 dest(f).SetBool(s0 < s1)
4174 return tnext
4175 }
4176 }
4177 default:
4178 v0 := genValueInt(c0)
4179 v1 := genValueInt(c1)
4180 if n.fnext != nil {
4181 fnext := getExec(n.fnext)
4182 n.exec = func(f *frame) bltn {
4183 _, s0 := v0(f)
4184 _, s1 := v1(f)
4185 if s0 < s1 {
4186 dest(f).SetBool(true)
4187 return tnext
4188 }
4189 dest(f).SetBool(false)
4190 return fnext
4191 }
4192 } else {
4193 dest := genValue(n)
4194 n.exec = func(f *frame) bltn {
4195 _, s0 := v0(f)
4196 _, s1 := v1(f)
4197 dest(f).SetBool(s0 < s1)
4198 return tnext
4199 }
4200 }
4201 }
4202 }
4203 }
4204
4205 func lowerEqual(n *node) {
4206 tnext := getExec(n.tnext)
4207 dest := genValueOutput(n, reflect.TypeOf(true))
4208 typ := n.typ.concrete().TypeOf()
4209 isInterface := n.typ.TypeOf().Kind() == reflect.Interface
4210 c0, c1 := n.child[0], n.child[1]
4211 t0, t1 := c0.typ.TypeOf(), c1.typ.TypeOf()
4212
4213 switch {
4214 case isString(t0) || isString(t1):
4215 switch {
4216 case isInterface:
4217 v0 := genValueString(c0)
4218 v1 := genValueString(c1)
4219 n.exec = func(f *frame) bltn {
4220 _, s0 := v0(f)
4221 _, s1 := v1(f)
4222 dest(f).Set(reflect.ValueOf(s0 <= s1).Convert(typ))
4223 return tnext
4224 }
4225 case c0.rval.IsValid():
4226 s0 := vString(c0.rval)
4227 v1 := genValueString(c1)
4228 if n.fnext != nil {
4229 fnext := getExec(n.fnext)
4230 n.exec = func(f *frame) bltn {
4231 _, s1 := v1(f)
4232 if s0 <= s1 {
4233 dest(f).SetBool(true)
4234 return tnext
4235 }
4236 dest(f).SetBool(false)
4237 return fnext
4238 }
4239 } else {
4240 n.exec = func(f *frame) bltn {
4241 _, s1 := v1(f)
4242 dest(f).SetBool(s0 <= s1)
4243 return tnext
4244 }
4245 }
4246 case c1.rval.IsValid():
4247 s1 := vString(c1.rval)
4248 v0 := genValueString(c0)
4249 if n.fnext != nil {
4250 fnext := getExec(n.fnext)
4251 n.exec = func(f *frame) bltn {
4252 _, s0 := v0(f)
4253 if s0 <= s1 {
4254 dest(f).SetBool(true)
4255 return tnext
4256 }
4257 dest(f).SetBool(false)
4258 return fnext
4259 }
4260 } else {
4261 n.exec = func(f *frame) bltn {
4262 _, s0 := v0(f)
4263 dest(f).SetBool(s0 <= s1)
4264 return tnext
4265 }
4266 }
4267 default:
4268 v0 := genValueString(c0)
4269 v1 := genValueString(c1)
4270 if n.fnext != nil {
4271 fnext := getExec(n.fnext)
4272 n.exec = func(f *frame) bltn {
4273 _, s0 := v0(f)
4274 _, s1 := v1(f)
4275 if s0 <= s1 {
4276 dest(f).SetBool(true)
4277 return tnext
4278 }
4279 dest(f).SetBool(false)
4280 return fnext
4281 }
4282 } else {
4283 n.exec = func(f *frame) bltn {
4284 _, s0 := v0(f)
4285 _, s1 := v1(f)
4286 dest(f).SetBool(s0 <= s1)
4287 return tnext
4288 }
4289 }
4290 }
4291 case isFloat(t0) || isFloat(t1):
4292 switch {
4293 case isInterface:
4294 v0 := genValueFloat(c0)
4295 v1 := genValueFloat(c1)
4296 n.exec = func(f *frame) bltn {
4297 _, s0 := v0(f)
4298 _, s1 := v1(f)
4299 dest(f).Set(reflect.ValueOf(s0 <= s1).Convert(typ))
4300 return tnext
4301 }
4302 case c0.rval.IsValid():
4303 s0 := vFloat(c0.rval)
4304 v1 := genValueFloat(c1)
4305 if n.fnext != nil {
4306 fnext := getExec(n.fnext)
4307 n.exec = func(f *frame) bltn {
4308 _, s1 := v1(f)
4309 if s0 <= s1 {
4310 dest(f).SetBool(true)
4311 return tnext
4312 }
4313 dest(f).SetBool(false)
4314 return fnext
4315 }
4316 } else {
4317 n.exec = func(f *frame) bltn {
4318 _, s1 := v1(f)
4319 dest(f).SetBool(s0 <= s1)
4320 return tnext
4321 }
4322 }
4323 case c1.rval.IsValid():
4324 s1 := vFloat(c1.rval)
4325 v0 := genValueFloat(c0)
4326 if n.fnext != nil {
4327 fnext := getExec(n.fnext)
4328 n.exec = func(f *frame) bltn {
4329 _, s0 := v0(f)
4330 if s0 <= s1 {
4331 dest(f).SetBool(true)
4332 return tnext
4333 }
4334 dest(f).SetBool(false)
4335 return fnext
4336 }
4337 } else {
4338 dest := genValue(n)
4339 n.exec = func(f *frame) bltn {
4340 _, s0 := v0(f)
4341 dest(f).SetBool(s0 <= s1)
4342 return tnext
4343 }
4344 }
4345 default:
4346 v0 := genValueFloat(c0)
4347 v1 := genValueFloat(c1)
4348 if n.fnext != nil {
4349 fnext := getExec(n.fnext)
4350 n.exec = func(f *frame) bltn {
4351 _, s0 := v0(f)
4352 _, s1 := v1(f)
4353 if s0 <= s1 {
4354 dest(f).SetBool(true)
4355 return tnext
4356 }
4357 dest(f).SetBool(false)
4358 return fnext
4359 }
4360 } else {
4361 dest := genValue(n)
4362 n.exec = func(f *frame) bltn {
4363 _, s0 := v0(f)
4364 _, s1 := v1(f)
4365 dest(f).SetBool(s0 <= s1)
4366 return tnext
4367 }
4368 }
4369 }
4370 case isUint(t0) || isUint(t1):
4371 switch {
4372 case isInterface:
4373 v0 := genValueUint(c0)
4374 v1 := genValueUint(c1)
4375 n.exec = func(f *frame) bltn {
4376 _, s0 := v0(f)
4377 _, s1 := v1(f)
4378 dest(f).Set(reflect.ValueOf(s0 <= s1).Convert(typ))
4379 return tnext
4380 }
4381 case c0.rval.IsValid():
4382 s0 := vUint(c0.rval)
4383 v1 := genValueUint(c1)
4384 if n.fnext != nil {
4385 fnext := getExec(n.fnext)
4386 n.exec = func(f *frame) bltn {
4387 _, s1 := v1(f)
4388 if s0 <= s1 {
4389 dest(f).SetBool(true)
4390 return tnext
4391 }
4392 dest(f).SetBool(false)
4393 return fnext
4394 }
4395 } else {
4396 dest := genValue(n)
4397 n.exec = func(f *frame) bltn {
4398 _, s1 := v1(f)
4399 dest(f).SetBool(s0 <= s1)
4400 return tnext
4401 }
4402 }
4403 case c1.rval.IsValid():
4404 s1 := vUint(c1.rval)
4405 v0 := genValueUint(c0)
4406 if n.fnext != nil {
4407 fnext := getExec(n.fnext)
4408 n.exec = func(f *frame) bltn {
4409 _, s0 := v0(f)
4410 if s0 <= s1 {
4411 dest(f).SetBool(true)
4412 return tnext
4413 }
4414 dest(f).SetBool(false)
4415 return fnext
4416 }
4417 } else {
4418 dest := genValue(n)
4419 n.exec = func(f *frame) bltn {
4420 _, s0 := v0(f)
4421 dest(f).SetBool(s0 <= s1)
4422 return tnext
4423 }
4424 }
4425 default:
4426 v0 := genValueUint(c0)
4427 v1 := genValueUint(c1)
4428 if n.fnext != nil {
4429 fnext := getExec(n.fnext)
4430 n.exec = func(f *frame) bltn {
4431 _, s0 := v0(f)
4432 _, s1 := v1(f)
4433 if s0 <= s1 {
4434 dest(f).SetBool(true)
4435 return tnext
4436 }
4437 dest(f).SetBool(false)
4438 return fnext
4439 }
4440 } else {
4441 dest := genValue(n)
4442 n.exec = func(f *frame) bltn {
4443 _, s0 := v0(f)
4444 _, s1 := v1(f)
4445 dest(f).SetBool(s0 <= s1)
4446 return tnext
4447 }
4448 }
4449 }
4450 case isInt(t0) || isInt(t1):
4451 switch {
4452 case isInterface:
4453 v0 := genValueInt(c0)
4454 v1 := genValueInt(c1)
4455 n.exec = func(f *frame) bltn {
4456 _, s0 := v0(f)
4457 _, s1 := v1(f)
4458 dest(f).Set(reflect.ValueOf(s0 <= s1).Convert(typ))
4459 return tnext
4460 }
4461 case c0.rval.IsValid():
4462 s0 := vInt(c0.rval)
4463 v1 := genValueInt(c1)
4464 if n.fnext != nil {
4465 fnext := getExec(n.fnext)
4466 n.exec = func(f *frame) bltn {
4467 _, s1 := v1(f)
4468 if s0 <= s1 {
4469 dest(f).SetBool(true)
4470 return tnext
4471 }
4472 dest(f).SetBool(false)
4473 return fnext
4474 }
4475 } else {
4476 dest := genValue(n)
4477 n.exec = func(f *frame) bltn {
4478 _, s1 := v1(f)
4479 dest(f).SetBool(s0 <= s1)
4480 return tnext
4481 }
4482 }
4483 case c1.rval.IsValid():
4484 s1 := vInt(c1.rval)
4485 v0 := genValueInt(c0)
4486 if n.fnext != nil {
4487 fnext := getExec(n.fnext)
4488 n.exec = func(f *frame) bltn {
4489 _, s0 := v0(f)
4490 if s0 <= s1 {
4491 dest(f).SetBool(true)
4492 return tnext
4493 }
4494 dest(f).SetBool(false)
4495 return fnext
4496 }
4497 } else {
4498 dest := genValue(n)
4499 n.exec = func(f *frame) bltn {
4500 _, s0 := v0(f)
4501 dest(f).SetBool(s0 <= s1)
4502 return tnext
4503 }
4504 }
4505 default:
4506 v0 := genValueInt(c0)
4507 v1 := genValueInt(c1)
4508 if n.fnext != nil {
4509 fnext := getExec(n.fnext)
4510 n.exec = func(f *frame) bltn {
4511 _, s0 := v0(f)
4512 _, s1 := v1(f)
4513 if s0 <= s1 {
4514 dest(f).SetBool(true)
4515 return tnext
4516 }
4517 dest(f).SetBool(false)
4518 return fnext
4519 }
4520 } else {
4521 dest := genValue(n)
4522 n.exec = func(f *frame) bltn {
4523 _, s0 := v0(f)
4524 _, s1 := v1(f)
4525 dest(f).SetBool(s0 <= s1)
4526 return tnext
4527 }
4528 }
4529 }
4530 }
4531 }
4532
4533 func notEqual(n *node) {
4534 tnext := getExec(n.tnext)
4535 dest := genValueOutput(n, reflect.TypeOf(true))
4536 typ := n.typ.concrete().TypeOf()
4537 isInterface := n.typ.TypeOf().Kind() == reflect.Interface
4538 c0, c1 := n.child[0], n.child[1]
4539 t0, t1 := c0.typ.TypeOf(), c1.typ.TypeOf()
4540
4541 if c0.typ.cat == linkedT || c1.typ.cat == linkedT {
4542 switch {
4543 case isInterface:
4544 v0 := genValue(c0)
4545 v1 := genValue(c1)
4546 dest := genValue(n)
4547 n.exec = func(f *frame) bltn {
4548 i0 := v0(f).Interface()
4549 i1 := v1(f).Interface()
4550 dest(f).Set(reflect.ValueOf(i0 != i1).Convert(typ))
4551 return tnext
4552 }
4553 case c0.rval.IsValid():
4554 i0 := c0.rval.Interface()
4555 v1 := genValue(c1)
4556 if n.fnext != nil {
4557 fnext := getExec(n.fnext)
4558 n.exec = func(f *frame) bltn {
4559 i1 := v1(f).Interface()
4560 if i0 != i1 {
4561 dest(f).SetBool(true)
4562 return tnext
4563 }
4564 dest(f).SetBool(false)
4565 return fnext
4566 }
4567 } else {
4568 dest := genValue(n)
4569 n.exec = func(f *frame) bltn {
4570 i1 := v1(f).Interface()
4571 dest(f).SetBool(i0 != i1)
4572 return tnext
4573 }
4574 }
4575 case c1.rval.IsValid():
4576 i1 := c1.rval.Interface()
4577 v0 := genValue(c0)
4578 if n.fnext != nil {
4579 fnext := getExec(n.fnext)
4580 n.exec = func(f *frame) bltn {
4581 i0 := v0(f).Interface()
4582 if i0 != i1 {
4583 dest(f).SetBool(true)
4584 return tnext
4585 }
4586 dest(f).SetBool(false)
4587 return fnext
4588 }
4589 } else {
4590 dest := genValue(n)
4591 n.exec = func(f *frame) bltn {
4592 i0 := v0(f).Interface()
4593 dest(f).SetBool(i0 != i1)
4594 return tnext
4595 }
4596 }
4597 default:
4598 v0 := genValue(c0)
4599 v1 := genValue(c1)
4600 if n.fnext != nil {
4601 fnext := getExec(n.fnext)
4602 n.exec = func(f *frame) bltn {
4603 i0 := v0(f).Interface()
4604 i1 := v1(f).Interface()
4605 if i0 != i1 {
4606 dest(f).SetBool(true)
4607 return tnext
4608 }
4609 dest(f).SetBool(false)
4610 return fnext
4611 }
4612 } else {
4613 dest := genValue(n)
4614 n.exec = func(f *frame) bltn {
4615 i0 := v0(f).Interface()
4616 i1 := v1(f).Interface()
4617 dest(f).SetBool(i0 != i1)
4618 return tnext
4619 }
4620 }
4621 }
4622 return
4623 }
4624
4625 // Do not attempt to optimize '==' or '!=' if an operand is an interface.
4626 // This will preserve proper dynamic type checking at runtime. For static types,
4627 // type checks are already performed, so bypass them if possible.
4628 if t0.Kind() == reflect.Interface || t1.Kind() == reflect.Interface {
4629 v0 := genValue(c0)
4630 v1 := genValue(c1)
4631 if n.fnext != nil {
4632 fnext := getExec(n.fnext)
4633 n.exec = func(f *frame) bltn {
4634 i0 := v0(f).Interface()
4635 i1 := v1(f).Interface()
4636 if i0 != i1 {
4637 dest(f).SetBool(true)
4638 return tnext
4639 }
4640 dest(f).SetBool(false)
4641 return fnext
4642 }
4643 } else {
4644 dest := genValue(n)
4645 n.exec = func(f *frame) bltn {
4646 i0 := v0(f).Interface()
4647 i1 := v1(f).Interface()
4648 dest(f).SetBool(i0 != i1)
4649 return tnext
4650 }
4651 }
4652 return
4653 }
4654
4655 switch {
4656 case isString(t0) || isString(t1):
4657 switch {
4658 case isInterface:
4659 v0 := genValueString(c0)
4660 v1 := genValueString(c1)
4661 n.exec = func(f *frame) bltn {
4662 _, s0 := v0(f)
4663 _, s1 := v1(f)
4664 dest(f).Set(reflect.ValueOf(s0 != s1).Convert(typ))
4665 return tnext
4666 }
4667 case c0.rval.IsValid():
4668 s0 := vString(c0.rval)
4669 v1 := genValueString(c1)
4670 if n.fnext != nil {
4671 fnext := getExec(n.fnext)
4672 n.exec = func(f *frame) bltn {
4673 _, s1 := v1(f)
4674 if s0 != s1 {
4675 dest(f).SetBool(true)
4676 return tnext
4677 }
4678 dest(f).SetBool(false)
4679 return fnext
4680 }
4681 } else {
4682 n.exec = func(f *frame) bltn {
4683 _, s1 := v1(f)
4684 dest(f).SetBool(s0 != s1)
4685 return tnext
4686 }
4687 }
4688 case c1.rval.IsValid():
4689 s1 := vString(c1.rval)
4690 v0 := genValueString(c0)
4691 if n.fnext != nil {
4692 fnext := getExec(n.fnext)
4693 n.exec = func(f *frame) bltn {
4694 _, s0 := v0(f)
4695 if s0 != s1 {
4696 dest(f).SetBool(true)
4697 return tnext
4698 }
4699 dest(f).SetBool(false)
4700 return fnext
4701 }
4702 } else {
4703 n.exec = func(f *frame) bltn {
4704 _, s0 := v0(f)
4705 dest(f).SetBool(s0 != s1)
4706 return tnext
4707 }
4708 }
4709 default:
4710 v0 := genValueString(c0)
4711 v1 := genValueString(c1)
4712 if n.fnext != nil {
4713 fnext := getExec(n.fnext)
4714 n.exec = func(f *frame) bltn {
4715 _, s0 := v0(f)
4716 _, s1 := v1(f)
4717 if s0 != s1 {
4718 dest(f).SetBool(true)
4719 return tnext
4720 }
4721 dest(f).SetBool(false)
4722 return fnext
4723 }
4724 } else {
4725 n.exec = func(f *frame) bltn {
4726 _, s0 := v0(f)
4727 _, s1 := v1(f)
4728 dest(f).SetBool(s0 != s1)
4729 return tnext
4730 }
4731 }
4732 }
4733 case isFloat(t0) || isFloat(t1):
4734 switch {
4735 case isInterface:
4736 v0 := genValueFloat(c0)
4737 v1 := genValueFloat(c1)
4738 n.exec = func(f *frame) bltn {
4739 _, s0 := v0(f)
4740 _, s1 := v1(f)
4741 dest(f).Set(reflect.ValueOf(s0 != s1).Convert(typ))
4742 return tnext
4743 }
4744 case c0.rval.IsValid():
4745 s0 := vFloat(c0.rval)
4746 v1 := genValueFloat(c1)
4747 if n.fnext != nil {
4748 fnext := getExec(n.fnext)
4749 n.exec = func(f *frame) bltn {
4750 _, s1 := v1(f)
4751 if s0 != s1 {
4752 dest(f).SetBool(true)
4753 return tnext
4754 }
4755 dest(f).SetBool(false)
4756 return fnext
4757 }
4758 } else {
4759 n.exec = func(f *frame) bltn {
4760 _, s1 := v1(f)
4761 dest(f).SetBool(s0 != s1)
4762 return tnext
4763 }
4764 }
4765 case c1.rval.IsValid():
4766 s1 := vFloat(c1.rval)
4767 v0 := genValueFloat(c0)
4768 if n.fnext != nil {
4769 fnext := getExec(n.fnext)
4770 n.exec = func(f *frame) bltn {
4771 _, s0 := v0(f)
4772 if s0 != s1 {
4773 dest(f).SetBool(true)
4774 return tnext
4775 }
4776 dest(f).SetBool(false)
4777 return fnext
4778 }
4779 } else {
4780 dest := genValue(n)
4781 n.exec = func(f *frame) bltn {
4782 _, s0 := v0(f)
4783 dest(f).SetBool(s0 != s1)
4784 return tnext
4785 }
4786 }
4787 default:
4788 v0 := genValueFloat(c0)
4789 v1 := genValueFloat(c1)
4790 if n.fnext != nil {
4791 fnext := getExec(n.fnext)
4792 n.exec = func(f *frame) bltn {
4793 _, s0 := v0(f)
4794 _, s1 := v1(f)
4795 if s0 != s1 {
4796 dest(f).SetBool(true)
4797 return tnext
4798 }
4799 dest(f).SetBool(false)
4800 return fnext
4801 }
4802 } else {
4803 dest := genValue(n)
4804 n.exec = func(f *frame) bltn {
4805 _, s0 := v0(f)
4806 _, s1 := v1(f)
4807 dest(f).SetBool(s0 != s1)
4808 return tnext
4809 }
4810 }
4811 }
4812 case isUint(t0) || isUint(t1):
4813 switch {
4814 case isInterface:
4815 v0 := genValueUint(c0)
4816 v1 := genValueUint(c1)
4817 n.exec = func(f *frame) bltn {
4818 _, s0 := v0(f)
4819 _, s1 := v1(f)
4820 dest(f).Set(reflect.ValueOf(s0 != s1).Convert(typ))
4821 return tnext
4822 }
4823 case c0.rval.IsValid():
4824 s0 := vUint(c0.rval)
4825 v1 := genValueUint(c1)
4826 if n.fnext != nil {
4827 fnext := getExec(n.fnext)
4828 n.exec = func(f *frame) bltn {
4829 _, s1 := v1(f)
4830 if s0 != s1 {
4831 dest(f).SetBool(true)
4832 return tnext
4833 }
4834 dest(f).SetBool(false)
4835 return fnext
4836 }
4837 } else {
4838 dest := genValue(n)
4839 n.exec = func(f *frame) bltn {
4840 _, s1 := v1(f)
4841 dest(f).SetBool(s0 != s1)
4842 return tnext
4843 }
4844 }
4845 case c1.rval.IsValid():
4846 s1 := vUint(c1.rval)
4847 v0 := genValueUint(c0)
4848 if n.fnext != nil {
4849 fnext := getExec(n.fnext)
4850 n.exec = func(f *frame) bltn {
4851 _, s0 := v0(f)
4852 if s0 != s1 {
4853 dest(f).SetBool(true)
4854 return tnext
4855 }
4856 dest(f).SetBool(false)
4857 return fnext
4858 }
4859 } else {
4860 dest := genValue(n)
4861 n.exec = func(f *frame) bltn {
4862 _, s0 := v0(f)
4863 dest(f).SetBool(s0 != s1)
4864 return tnext
4865 }
4866 }
4867 default:
4868 v0 := genValueUint(c0)
4869 v1 := genValueUint(c1)
4870 if n.fnext != nil {
4871 fnext := getExec(n.fnext)
4872 n.exec = func(f *frame) bltn {
4873 _, s0 := v0(f)
4874 _, s1 := v1(f)
4875 if s0 != s1 {
4876 dest(f).SetBool(true)
4877 return tnext
4878 }
4879 dest(f).SetBool(false)
4880 return fnext
4881 }
4882 } else {
4883 dest := genValue(n)
4884 n.exec = func(f *frame) bltn {
4885 _, s0 := v0(f)
4886 _, s1 := v1(f)
4887 dest(f).SetBool(s0 != s1)
4888 return tnext
4889 }
4890 }
4891 }
4892 case isInt(t0) || isInt(t1):
4893 switch {
4894 case isInterface:
4895 v0 := genValueInt(c0)
4896 v1 := genValueInt(c1)
4897 n.exec = func(f *frame) bltn {
4898 _, s0 := v0(f)
4899 _, s1 := v1(f)
4900 dest(f).Set(reflect.ValueOf(s0 != s1).Convert(typ))
4901 return tnext
4902 }
4903 case c0.rval.IsValid():
4904 s0 := vInt(c0.rval)
4905 v1 := genValueInt(c1)
4906 if n.fnext != nil {
4907 fnext := getExec(n.fnext)
4908 n.exec = func(f *frame) bltn {
4909 _, s1 := v1(f)
4910 if s0 != s1 {
4911 dest(f).SetBool(true)
4912 return tnext
4913 }
4914 dest(f).SetBool(false)
4915 return fnext
4916 }
4917 } else {
4918 dest := genValue(n)
4919 n.exec = func(f *frame) bltn {
4920 _, s1 := v1(f)
4921 dest(f).SetBool(s0 != s1)
4922 return tnext
4923 }
4924 }
4925 case c1.rval.IsValid():
4926 s1 := vInt(c1.rval)
4927 v0 := genValueInt(c0)
4928 if n.fnext != nil {
4929 fnext := getExec(n.fnext)
4930 n.exec = func(f *frame) bltn {
4931 _, s0 := v0(f)
4932 if s0 != s1 {
4933 dest(f).SetBool(true)
4934 return tnext
4935 }
4936 dest(f).SetBool(false)
4937 return fnext
4938 }
4939 } else {
4940 dest := genValue(n)
4941 n.exec = func(f *frame) bltn {
4942 _, s0 := v0(f)
4943 dest(f).SetBool(s0 != s1)
4944 return tnext
4945 }
4946 }
4947 default:
4948 v0 := genValueInt(c0)
4949 v1 := genValueInt(c1)
4950 if n.fnext != nil {
4951 fnext := getExec(n.fnext)
4952 n.exec = func(f *frame) bltn {
4953 _, s0 := v0(f)
4954 _, s1 := v1(f)
4955 if s0 != s1 {
4956 dest(f).SetBool(true)
4957 return tnext
4958 }
4959 dest(f).SetBool(false)
4960 return fnext
4961 }
4962 } else {
4963 dest := genValue(n)
4964 n.exec = func(f *frame) bltn {
4965 _, s0 := v0(f)
4966 _, s1 := v1(f)
4967 dest(f).SetBool(s0 != s1)
4968 return tnext
4969 }
4970 }
4971 }
4972 case isComplex(t0) || isComplex(t1):
4973 switch {
4974 case isInterface:
4975 v0 := genComplex(c0)
4976 v1 := genComplex(c1)
4977 n.exec = func(f *frame) bltn {
4978 s0 := v0(f)
4979 s1 := v1(f)
4980 dest(f).Set(reflect.ValueOf(s0 != s1).Convert(typ))
4981 return tnext
4982 }
4983 case c0.rval.IsValid():
4984 s0 := vComplex(c0.rval)
4985 v1 := genComplex(c1)
4986 if n.fnext != nil {
4987 fnext := getExec(n.fnext)
4988 n.exec = func(f *frame) bltn {
4989 s1 := v1(f)
4990 if s0 != s1 {
4991 dest(f).SetBool(true)
4992 return tnext
4993 }
4994 dest(f).SetBool(false)
4995 return fnext
4996 }
4997 } else {
4998 n.exec = func(f *frame) bltn {
4999 s1 := v1(f)
5000 dest(f).SetBool(s0 != s1)
5001 return tnext
5002 }
5003 }
5004 case c1.rval.IsValid():
5005 s1 := vComplex(c1.rval)
5006 v0 := genComplex(c0)
5007 if n.fnext != nil {
5008 fnext := getExec(n.fnext)
5009 n.exec = func(f *frame) bltn {
5010 s0 := v0(f)
5011 if s0 != s1 {
5012 dest(f).SetBool(true)
5013 return tnext
5014 }
5015 dest(f).SetBool(false)
5016 return fnext
5017 }
5018 } else {
5019 dest := genValue(n)
5020 n.exec = func(f *frame) bltn {
5021 s0 := v0(f)
5022 dest(f).SetBool(s0 != s1)
5023 return tnext
5024 }
5025 }
5026 default:
5027 v0 := genComplex(c0)
5028 v1 := genComplex(c1)
5029 if n.fnext != nil {
5030 fnext := getExec(n.fnext)
5031 n.exec = func(f *frame) bltn {
5032 s0 := v0(f)
5033 s1 := v1(f)
5034 if s0 != s1 {
5035 dest(f).SetBool(true)
5036 return tnext
5037 }
5038 dest(f).SetBool(false)
5039 return fnext
5040 }
5041 } else {
5042 n.exec = func(f *frame) bltn {
5043 s0 := v0(f)
5044 s1 := v1(f)
5045 dest(f).SetBool(s0 != s1)
5046 return tnext
5047 }
5048 }
5049 }
5050 default:
5051 switch {
5052 case isInterface:
5053 v0 := genValue(c0)
5054 v1 := genValue(c1)
5055 n.exec = func(f *frame) bltn {
5056 i0 := v0(f).Interface()
5057 i1 := v1(f).Interface()
5058 dest(f).Set(reflect.ValueOf(i0 != i1).Convert(typ))
5059 return tnext
5060 }
5061 case c0.rval.IsValid():
5062 i0 := c0.rval.Interface()
5063 v1 := genValue(c1)
5064 if n.fnext != nil {
5065 fnext := getExec(n.fnext)
5066 n.exec = func(f *frame) bltn {
5067 i1 := v1(f).Interface()
5068 if i0 != i1 {
5069 dest(f).SetBool(true)
5070 return tnext
5071 }
5072 dest(f).SetBool(false)
5073 return fnext
5074 }
5075 } else {
5076 dest := genValue(n)
5077 n.exec = func(f *frame) bltn {
5078 i1 := v1(f).Interface()
5079 dest(f).SetBool(i0 != i1)
5080 return tnext
5081 }
5082 }
5083 case c1.rval.IsValid():
5084 i1 := c1.rval.Interface()
5085 v0 := genValue(c0)
5086 if n.fnext != nil {
5087 fnext := getExec(n.fnext)
5088 n.exec = func(f *frame) bltn {
5089 i0 := v0(f).Interface()
5090 if i0 != i1 {
5091 dest(f).SetBool(true)
5092 return tnext
5093 }
5094 dest(f).SetBool(false)
5095 return fnext
5096 }
5097 } else {
5098 dest := genValue(n)
5099 n.exec = func(f *frame) bltn {
5100 i0 := v0(f).Interface()
5101 dest(f).SetBool(i0 != i1)
5102 return tnext
5103 }
5104 }
5105 default:
5106 v0 := genValue(c0)
5107 v1 := genValue(c1)
5108 if n.fnext != nil {
5109 fnext := getExec(n.fnext)
5110 n.exec = func(f *frame) bltn {
5111 i0 := v0(f).Interface()
5112 i1 := v1(f).Interface()
5113 if i0 != i1 {
5114 dest(f).SetBool(true)
5115 return tnext
5116 }
5117 dest(f).SetBool(false)
5118 return fnext
5119 }
5120 } else {
5121 dest := genValue(n)
5122 n.exec = func(f *frame) bltn {
5123 i0 := v0(f).Interface()
5124 i1 := v1(f).Interface()
5125 dest(f).SetBool(i0 != i1)
5126 return tnext
5127 }
5128 }
5129 }
5130 }
5131 }