private static void CgForInStat(FuncInfo fi, ForInStat node) { fi.EnterScope(true); CgLocalVarDeclStat(fi, new LocalVarDeclStat { NameList = new List <string> { "(for generator)", "(for state)", "(for control)" }, ExpList = node.ExpList }); foreach (var name in node.NameList) { fi.AddLocVar(name); } var pcJmpToTfc = fi.EmitJmp(0, 0); CgBlock(fi, node.Block); fi.CloseOpenUpvals(); fi.FixsBx(pcJmpToTfc, fi.PC() - pcJmpToTfc); var rGenerator = fi.SlotOfLocVar("(for generator)"); fi.EmitTForCall(rGenerator, node.NameList.Count); fi.EmitTForLoop(rGenerator + 2, pcJmpToTfc - fi.PC() - 1); fi.ExitScope(); }