MCPcopy Create free account
hub / github.com/akyoto/q / loopNext

Method loopNext

src/core/loopNext.go:9–24  ·  view source on GitHub ↗

loopNext starts the next iteration of the loop.

(loop *Loop)

Source from the content-addressed store, hash-verified

7
8// loopNext starts the next iteration of the loop.
9func (f *Function) loopNext(loop *Loop) {
10 if loop.IteratorName != "" {
11 endOfLoopValue, _, _ := f.findIdentifier(loop.IteratorName)
12 one := f.Append(&ssa.Int{Int: 1})
13
14 nextIteration := &ssa.BinaryOp{
15 Op: token.Add,
16 Left: endOfLoopValue,
17 Right: one,
18 }
19
20 f.Block().Append(nextIteration)
21 f.Block().Identify(loop.IteratorName, nextIteration)
22 }
23
24 f.jump(loop.Head)
25}

Callers 2

compileLoopMethod · 0.95
compileLoopControlMethod · 0.95

Calls 5

jumpMethod · 0.95
FindIdentifierMethod · 0.80
BlockMethod · 0.80
IdentifyMethod · 0.80
AppendMethod · 0.45

Tested by

no test coverage detected