MCPcopy Index your code
hub / github.com/yuin/gopher-lua / compileRepeatStmt

Function compileRepeatStmt

compile.go:996–1019  ·  view source on GitHub ↗

}}}

(context *funcContext, stmt *ast.RepeatStmt)

Source from the content-addressed store, hash-verified

994} // }}}
995
996func compileRepeatStmt(context *funcContext, stmt *ast.RepeatStmt) { // {{{
997 initlabel := context.NewLabel()
998 thenlabel := context.NewLabel()
999 elselabel := context.NewLabel()
1000
1001 context.SetLabelPc(initlabel, context.Code.LastPC())
1002 context.SetLabelPc(elselabel, context.Code.LastPC())
1003 context.EnterBlock(thenlabel, stmt)
1004 compileChunk(context, stmt.Stmts, true)
1005 compileBranchCondition(context, context.RegTop(), stmt.Condition, thenlabel, elselabel, false)
1006
1007 context.SetLabelPc(thenlabel, context.Code.LastPC())
1008 n := context.LeaveBlock()
1009
1010 if n > -1 {
1011 label := context.NewLabel()
1012 context.Code.AddASbx(OP_JMP, 0, label, eline(stmt))
1013 context.SetLabelPc(elselabel, context.Code.LastPC())
1014 context.Code.AddABC(OP_CLOSE, n, 0, 0, eline(stmt))
1015 context.Code.AddASbx(OP_JMP, 0, initlabel, eline(stmt))
1016 context.SetLabelPc(label, context.Code.LastPC())
1017 }
1018
1019} // }}}
1020
1021func compileBreakStmt(context *funcContext, stmt *ast.BreakStmt) { // {{{
1022 for block := context.Block; block != nil; block = block.Parent {

Callers 1

compileStmtFunction · 0.85

Calls 11

compileChunkFunction · 0.85
compileBranchConditionFunction · 0.85
elineFunction · 0.85
NewLabelMethod · 0.80
SetLabelPcMethod · 0.80
LastPCMethod · 0.80
EnterBlockMethod · 0.80
RegTopMethod · 0.80
LeaveBlockMethod · 0.80
AddASbxMethod · 0.80
AddABCMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…