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

Function compileWhileStmt

compile.go:980–994  ·  view source on GitHub ↗

}}}

(context *funcContext, stmt *ast.WhileStmt)

Source from the content-addressed store, hash-verified

978} // }}}
979
980func compileWhileStmt(context *funcContext, stmt *ast.WhileStmt) { // {{{
981 thenlabel := context.NewLabel()
982 elselabel := context.NewLabel()
983 condlabel := context.NewLabel()
984
985 context.SetLabelPc(condlabel, context.Code.LastPC())
986 compileBranchCondition(context, context.RegTop(), stmt.Condition, thenlabel, elselabel, false)
987 context.SetLabelPc(thenlabel, context.Code.LastPC())
988 context.EnterBlock(elselabel, stmt)
989 compileChunk(context, stmt.Stmts, false)
990 context.CloseUpvalues()
991 context.Code.AddASbx(OP_JMP, 0, condlabel, eline(stmt))
992 context.LeaveBlock()
993 context.SetLabelPc(elselabel, context.Code.LastPC())
994} // }}}
995
996func compileRepeatStmt(context *funcContext, stmt *ast.RepeatStmt) { // {{{
997 initlabel := context.NewLabel()

Callers 1

compileStmtFunction · 0.85

Calls 11

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

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…