public void RevertContextualsIn(FrameScope fs, CodeGen cg) { foreach (var varname in MangledContextuals.Values) { if (fs.AssignedContextuals.Contains(varname)) { if (cg.This().Type.Name != "TopLevelFrame") { cg.If(cg.This().Field("_assigned_" + fs.ID + "_" + varname) > 0); { cg.Assign(cg.This().Field("TopLevelFrame").Field("_ctxl_" + varname), cg.This().Field("TopLevelFrame").Field("_stack_" + varname).Invoke("Pop")); cg.Assign(cg.This().Field("_assigned_" + fs.ID + "_" + varname), 0); } cg.End(); } else { cg.If(cg.This().Field("_assigned_" + fs.ID + "_" + varname) > 0); { cg.Assign(cg.This().Field("_ctxl_" + varname), cg.This().Field("_stack_" + varname).Invoke("Pop")); cg.Assign(cg.This().Field("_assigned_" + fs.ID + "_" + varname), 0); } cg.End(); } } } }