void fixFieldCtorCalls(Blocks blocks) { if (blocks.Method.Name != ".ctor") { return; } var instrsToRemove = new List <int>(); foreach (var block in blocks.MethodBlocks.getAllBlocks()) { var instrs = block.Instructions; for (int i = 0; i < instrs.Count; i++) { var stfld = instrs[i]; if (stfld.OpCode.Code != Code.Stfld) { continue; } var field = stfld.Operand as IField; if (field == null) { continue; } if (!structFieldsToFix.find(field)) { continue; } var instrs2 = toInstructionList(instrs); var instrPushes = DotNetUtils.getArgPushes(instrs2, i); if (instrPushes == null || instrPushes.Count != 2) { continue; } block.remove(i, 1); block.remove(instrs2.IndexOf(instrPushes[1]), 1); block.remove(instrs2.IndexOf(instrPushes[0]), 1); i -= 3; } } }
public static IList <object> getArgValues(IList <Instruction> instrs, int index) { return(getArgValues(DotNetUtils.getArgPushes(instrs, index))); }