public void Weave(ILGenerator ilGenerator) { var methodImplParameters = methodInfoImpl.GetParameters(); Type aspectArgsType = methodInfoImpl.ToAspectArgumentContract(); ilGenerator.EmitLoadArg(1); ilGenerator.Emit(OpCodes.Ldind_Ref); methodImplParameters.ForEach((param) => { int argPosition = param.Position + 1; if (byRefArgumentsStoreWeaver.Contains(argPosition)) { byRefArgumentsStoreWeaver.EmitLoadLocalAddress(ilGenerator, argPosition); } else { var property = aspectArgsType.GetProperty("Arg{0}".Fmt(argPosition)); ilGenerator.EmitLoadArg(2); ilGenerator.Emit(OpCodes.Callvirt, property.GetGetMethod()); } }); }
public override void Weave(ILGenerator ilGenerator) { var argsLocalBuilder = LocalBuilderRepository.Get(previousAspectArgType); var methodImplParameters = WeavingSettings.MethodInfoImpl.GetParameters(); ilGenerator.EmitLoadArg(1); ilGenerator.Emit(OpCodes.Ldind_Ref); methodImplParameters.ForEach(param => { int argPosition = param.Position + 1; if (byRefArgumentStoreWeaver.Contains(argPosition)) { byRefArgumentStoreWeaver.EmitLoadLocalAddress(ilGenerator, argPosition); } else { var property = previousAspectArgType.GetProperty("Arg{0}".Fmt(argPosition)); ilGenerator.EmitLoadLocal(argsLocalBuilder); ilGenerator.Emit(OpCodes.Callvirt, property.GetGetMethod()); } }); }