MCPcopy
hub / github.com/expr-lang/expr / emitLoop

Method emitLoop

compiler/compiler.go:1195–1204  ·  view source on GitHub ↗
(body func())

Source from the content-addressed store, hash-verified

1193}
1194
1195func (c *compiler) emitLoop(body func()) {
1196 begin := len(c.bytecode)
1197 end := c.emit(OpJumpIfEnd, placeholder)
1198
1199 body()
1200
1201 c.emit(OpIncrementIndex)
1202 c.emit(OpJumpBackward, c.calcBackwardJump(begin))
1203 c.patchJump(end)
1204}
1205
1206func (c *compiler) emitLoopBackwards(body func()) {
1207 c.emit(OpGetLen)

Callers 1

BuiltinNodeMethod · 0.95

Calls 3

emitMethod · 0.95
calcBackwardJumpMethod · 0.95
patchJumpMethod · 0.95

Tested by

no test coverage detected