MCPcopy Create free account
hub / github.com/dispatchrun/coroutine / RangeSliceIndexGenerator

Function RangeSliceIndexGenerator

compiler/testdata/coroutine_durable.go:746–786  ·  view source on GitHub ↗

go:noinline

(_ int)

Source from the content-addressed store, hash-verified

744
745//go:noinline
746func RangeSliceIndexGenerator(_ int) {
747 _c := coroutine.LoadContext[int, any]()
748 var _f0 *struct {
749 IP int
750 X0 []int
751 X1 int
752 } = coroutine.Push[struct {
753 IP int
754 X0 []int
755 X1 int
756 }](&_c.Stack)
757 if _f0.IP == 0 {
758 *_f0 = struct {
759 IP int
760 X0 []int
761 X1 int
762 }{}
763 }
764 defer func() {
765 if !_c.Unwinding() {
766 coroutine.Pop(&_c.Stack)
767 }
768 }()
769 switch {
770 case _f0.IP < 2:
771 _f0.X0 = []int{10, 20, 30}
772 _f0.IP = 2
773 fallthrough
774 case _f0.IP < 4:
775 switch {
776 case _f0.IP < 3:
777 _f0.X1 = 0
778 _f0.IP = 3
779 fallthrough
780 case _f0.IP < 4:
781 for ; _f0.X1 < len(_f0.X0); _f0.X1, _f0.IP = _f0.X1+1, 3 {
782 coroutine.Yield[int, any](_f0.X1)
783 }
784 }
785 }
786}
787
788//go:noinline
789func RangeArrayIndexValueGenerator(_ int) {

Callers

nothing calls this directly

Calls 3

LoadContextFunction · 0.92
PopFunction · 0.92
UnwindingMethod · 0.80

Tested by

no test coverage detected