}}}
(context *funcContext, stmt *ast.GenericForStmt)
| 1090 | } // }}} |
| 1091 | |
| 1092 | func compileGenericForStmt(context *funcContext, stmt *ast.GenericForStmt) { // {{{ |
| 1093 | code := context.Code |
| 1094 | endlabel := context.NewLabel() |
| 1095 | bodylabel := context.NewLabel() |
| 1096 | fllabel := context.NewLabel() |
| 1097 | nnames := len(stmt.Names) |
| 1098 | |
| 1099 | context.EnterBlock(endlabel, stmt) |
| 1100 | rgen := context.RegisterLocalVar("(for generator)") |
| 1101 | context.RegisterLocalVar("(for state)") |
| 1102 | context.RegisterLocalVar("(for control)") |
| 1103 | |
| 1104 | compileRegAssignment(context, stmt.Names, stmt.Exprs, context.RegTop()-3, 3, sline(stmt)) |
| 1105 | |
| 1106 | code.AddASbx(OP_JMP, 0, fllabel, sline(stmt)) |
| 1107 | |
| 1108 | for _, name := range stmt.Names { |
| 1109 | context.RegisterLocalVar(name) |
| 1110 | } |
| 1111 | |
| 1112 | context.SetLabelPc(bodylabel, code.LastPC()) |
| 1113 | compileChunk(context, stmt.Stmts, false) |
| 1114 | |
| 1115 | context.LeaveBlock() |
| 1116 | |
| 1117 | context.SetLabelPc(fllabel, code.LastPC()) |
| 1118 | code.AddABC(OP_TFORLOOP, rgen, 0, nnames, sline(stmt)) |
| 1119 | code.AddASbx(OP_JMP, 0, bodylabel, sline(stmt)) |
| 1120 | |
| 1121 | context.SetLabelPc(endlabel, code.LastPC()) |
| 1122 | } // }}} |
| 1123 | |
| 1124 | func compileLabelStmt(context *funcContext, stmt *ast.LabelStmt, isLastStmt bool) { // {{{ |
| 1125 | labelId := context.NewLabel() |
no test coverage detected
searching dependent graphs…