private static void PatchBaseConstructorInvocationOrder(MethodDefinition method) { Instruction ctorInvocation = (Instruction)Iterators.Next(InstrumentationUtil.Where(method.Body, IsBaseConstructorInvocation).GetEnumerator()); Instruction loadThis = GetLoadThisReferenceFor(method.Body, ctorInvocation); MoveInstructions(loadThis, ctorInvocation, method.Body.Instructions[0], method.Body.GetILProcessor()); }
private static IEnumerable <Instruction> BaseConstructorInvocationOrFieldAccesses(MethodDefinition ctor) { return(InstrumentationUtil.Where( ctor.Body, delegate(Instruction instruction) { return IsFieldAccess(instruction) || IsBaseConstructorInvocation(instruction); })); }
private IEnumerable <Instruction> CastsToSupportedCollections(MethodBody body) { return(InstrumentationUtil.Where(body, delegate(Instruction candidate) { if (candidate.OpCode != OpCodes.Castclass) { return false; } GenericInstanceType target = candidate.Operand as GenericInstanceType; return target != null && HasReplacement(target.Resolve().FullName); })); }
private static IEnumerable <Instruction> TAEnabledCollectionInstantiations(MethodBody methodBody) { return(InstrumentationUtil.Where(methodBody, delegate(Instruction candidate) { if (candidate.OpCode != OpCodes.Newobj) { return false; } MethodReference ctor = (MethodReference)candidate.Operand; TypeDefinition declaringType = ctor.DeclaringType.Resolve(); return declaringType.HasGenericParameters && _collectionReplacements.ContainsKey(declaringType.FullName); })); }
private IEnumerable <Instruction> FieldAccesses(MethodBody body) { return(InstrumentationUtil.Where(body, IsActivatableFieldAccess)); }