protected AbstractAdviceWeaver(IAdviceWeavingSettings adviceWeavingSettings) { aspectType = adviceWeavingSettings.AspectType; aspectRepository = adviceWeavingSettings.AspectRepository; localBuilderRepository = adviceWeavingSettings.LocalBuilderRepository; argumentsWeavingSettings = adviceWeavingSettings.ArgumentsWeavingSettings; }
internal MethodInvokerAspectWeaver(Type topAspectInScopeArgType, IMethodAspectDefinition aspectDefinition, IAspectWeavingSettings aspectWeavingSettings, IArgumentsWeavingSettings argumentsWeavingSettings) : base(aspectDefinition.Member, aspectWeavingSettings.WeavingSettings) { this.topAspectInScopeArgType = topAspectInScopeArgType; this.argumentsWeavingSettings = argumentsWeavingSettings; localBuilderRepository = aspectWeavingSettings.LocalBuilderRepository; byRefArgumentStoreWeaver = aspectWeavingSettings.ByRefArgumentsStoreWeaver; argumentsWeaver = new MethodInvokerArgumentsWeaver(aspectDefinition.Member, topAspectInScopeArgType, aspectWeavingSettings, argumentsWeavingSettings, byRefArgumentStoreWeaver); }
internal MethodInvokerAspectWeaver(Type previousAspectArgsType, IAspectDefinition aspectDefinition, IAspectWeavingSettings aspectWeavingSettings, IArgumentsWeavingSettings argumentsWeavingSettings) : base(aspectWeavingSettings.WeavingSettings) { var methodInfoImpl = aspectWeavingSettings.WeavingSettings.MethodInfoImpl; this.previousAspectArgsType = previousAspectArgsType; this.argumentsWeavingSettings = argumentsWeavingSettings; localBuilderRepository = aspectWeavingSettings.LocalBuilderRepository; byRefArgumentStoreWeaver = new MethodInvokerByRefArgumentsWeaver(previousAspectArgsType, methodInfoImpl, localBuilderRepository); argumentsWeaver = new MethodInvokerArgumentsWeaver(previousAspectArgsType, aspectWeavingSettings, argumentsWeavingSettings, byRefArgumentStoreWeaver); }
internal AbstractAspectArgsMappingWeaver(IAspectWeavingSettings aspectWeavingSettings, IArgumentsSettings argumentsSettings) { Type[] @params = null; this.argumentsSettings = argumentsSettings; this.aspectWeavingSettings = aspectWeavingSettings; aspectArgumentType = argumentsSettings.ArgumentType; weavingSettings = aspectWeavingSettings.WeavingSettings; localBuilderRepository = aspectWeavingSettings.LocalBuilderRepository; @params = argumentsSettings.ArgumentType.GetGenericArguments(); parameters = argumentsSettings.Parameters; mappingParameters = @params.Skip(1).ToArray(); }
internal AbstractMethodInterceptionAspectWeaver(IAspectDefinition aspectDefinition, IAspectWeavingSettings aspectWeavingSettings, FieldInfo weavedType) : base(aspectDefinition, aspectWeavingSettings) { IAdviceExpression selectedExpression = null; var argumentsWeavingSettings = aspectDefinition.ToArgumentsWeavingSettings(); var aspectSettings = new AdviceWeavingSettings(aspectWeavingSettings, argumentsWeavingSettings); bindingDependency = weavedType; selectedExpression = ResolveOnMethodInvokeAdvice(); methodScopeWeavers = new List <IMethodScopeWeaver>(); methodScopeWeavers.Add(selectedExpression.Reduce(aspectSettings)); localBuilderRepository = aspectWeavingSettings.LocalBuilderRepository; }
internal AbstractInterceptionAspectWeaver(IAspectDefinition aspectDefinition, IAspectWeavingSettings aspectWeavingSettings, FieldInfo weavedType) : base(aspectDefinition, aspectWeavingSettings) { IAdviceExpression selectedExpression = null; AdviceWeavingSettings adviceWeavingSettings = null; bindingDependency = weavedType; argumentsWeavingSettings = aspectDefinition.ToArgumentsWeavingSettings(); adviceWeavingSettings = new AdviceWeavingSettings(aspectWeavingSettings, argumentsWeavingSettings); selectedExpression = ResolveInterceptionAdviceExpression(); methodScopeWeavers = new List<IMethodScopeWeaver> { selectedExpression.Reduce(adviceWeavingSettings) }; localBuilderRepository = aspectWeavingSettings.LocalBuilderRepository; }
internal AbstractByRefArgumentsStoreWeaver(MethodInfo method, ILocalBuilderRepository localBuilderRepository) { this.localBuilderRepository = localBuilderRepository; parameters = method.GetParameters().ToArray(param => param.ParameterType.IsByRef); }
internal AbstractGetReturnValueWeaver(IAspectWeavingSettings aspectWeavingSettings, IArgumentsWeavingSettings argumentsWeavingSetings) { this.aspectWeavingSettings = aspectWeavingSettings; this.argumentsWeavingSetings = argumentsWeavingSetings; localBuilderRepository = aspectWeavingSettings.LocalBuilderRepository; }
public TryCatchFinallySettings(Type aspectArgumentType, ILocalBuilderRepository localBuilderRepository) { AspectArgumentType = aspectArgumentType; LocalBuilderRepository = localBuilderRepository; }
internal AbstractOnMethodBoundaryAspectWeaver(IAspectWeaver nestedAspect, IAspectDefinition aspectDefinition, IAspectWeavingSettings aspectWeavingSettings) : base(aspectDefinition, aspectWeavingSettings) { IMethodScopeWeaver entryWeaver = null; IMethodScopeWeaver catchWeaver = null; Action <ILGenerator> storeArgsAction = null; IAdviceExpression selectedExpression = null; IMethodScopeWeaver storeArgsArgsWeaver = null; var finallyWeavers = new List <IMethodScopeWeaver>(); var adviceWeavingSettings = new AdviceWeavingSettings(aspectWeavingSettings, argumentsWeavingSetings); ArgumentType = argumentsWeavingSetings.ArgumentType; byRefArgumentsStoreWeaver = aspectWeavingSettings.ByRefArgumentsStoreWeaver; storeArgsAction = byRefArgumentsStoreWeaver.StoreArgsIfNeeded; storeArgsArgsWeaver = storeArgsAction.ToMethodScopeWeaver(); tryWeavers = new List <IMethodScopeWeaver>() { nestedAspect }; localBuilderRepository = aspectWeavingSettings.LocalBuilderRepository; if (adviceDiscoveryVistor.HasOnMethodEntryAdvice) { selectedExpression = ResolveOnMethodEntryAdvice(); entryWeaver = selectedExpression.Reduce(adviceWeavingSettings); } if (adviceDiscoveryVistor.HasOnMethodSuccessAdvice) { selectedExpression = ResolveOnMethodSuccessAdvice(); tryWeavers.Add(selectedExpression.Reduce(adviceWeavingSettings)); } if (argumentsWeavingSetings.IsFunction) { OnFunctionWeavingDetected(); } if (adviceDiscoveryVistor.HasFinallyAdvice) { selectedExpression = ResolveFinallyAdvice(); finallyWeavers.Add(selectedExpression.Reduce(adviceWeavingSettings)); finallyWeavers.Add(storeArgsArgsWeaver); if (adviceDiscoveryVistor.HasOnMethodExceptionAdvice) { var aspectMember = aspectRepository.GetAspectFieldByType(aspectDefinition.Aspect.AspectType); var settings = new TryCatchFinallySettings(ArgumentType, aspectMember, localBuilderRepository); selectedExpression = ResolveOnMethodExceptionAdvice(); catchWeaver = selectedExpression.Reduce(adviceWeavingSettings); weaver = new TryCatchFinallyAspectWeaver(settings, entryWeaver, tryWeavers, catchWeaver, finallyWeavers, returnValueWeaver); } else { weaver = new OnMethodBoundaryTryFinallyAspectWeaver(entryWeaver, tryWeavers, finallyWeavers, returnValueWeaver); } } else { var weavers = new List <IMethodScopeWeaver> { entryWeaver }; if (!byRefArgumentsStoreWeaver.ContainsByRefParams) { weavers.AddRange(tryWeavers); if (returnValueWeaver.IsNotNull()) { weavers.Add(returnValueWeaver); } weaver = new MethodScopeWeaversQueue(weavers); } else { finallyWeavers.Add(storeArgsArgsWeaver); weaver = new OnMethodBoundaryTryFinallyAspectWeaver(entryWeaver, weavers, finallyWeavers, returnValueWeaver); } } }
internal BindingByRefArgumentsWeaverImpl(Type topAspectInScopeArgType, MethodInfo method, ILocalBuilderRepository localBuilderRepository) : base(topAspectInScopeArgType, method, localBuilderRepository) { }
internal MethodDecoratorByRefArgumentsStoreWeaver(Type aspectArgumentType, MethodInfo methodInfoImpl, ILocalBuilderRepository localBuilderRepository) : base(methodInfoImpl, localBuilderRepository) { this.aspectArgumentType = aspectArgumentType; byRefParamslocalBuilderMap = new Dictionary <int, LocalBuilder>(); }
internal AbstractBindingByRefArgumentsWeaver(Type aspectArgumentType, MethodInfo method, ILocalBuilderRepository localBuilderRepository) : base(method, localBuilderRepository) { this.aspectArgumentType = aspectArgumentType; byRefParamslocalBuilderMap = new Dictionary <int, LocalBuilder>(); }
internal AbstractOnMethodBoundaryAspectWeaver(IAspectWeaver nestedAspect, IAspectDefinition aspectDefinition, IAspectWeavingSettings aspectWeavingSettings) : base(aspectDefinition, aspectWeavingSettings) { IAdviceExpression selectedExpression = null; var catchWeavers = new List<IMethodScopeWeaver>(); var entryWeavers = new List<IMethodScopeWeaver>(); var finallyWeavers = new List<IMethodScopeWeaver>(); Action<ILGenerator> restoreArgsIfNeededAction = null; IMethodScopeWeaver restoreArgsIfNeededScopeWeaver = null; var adviceWeavingSettings = new AdviceWeavingSettings(aspectWeavingSettings, argumentsWeavingSettings); ArgumentType = argumentsWeavingSettings.ArgumentType; tryWeavers = new List<IMethodScopeWeaver>() { nestedAspect }; localBuilderRepository = aspectWeavingSettings.LocalBuilderRepository; byRefArgumentsStoreWeaver = aspectWeavingSettings.ByRefArgumentsStoreWeaver; restoreArgsIfNeededAction = byRefArgumentsStoreWeaver.RestoreArgsIfNeeded; restoreArgsIfNeededScopeWeaver = restoreArgsIfNeededAction.ToMethodScopeWeaver(); if (adviceDiscoveryVistor.HasOnMethodEntryAdvice) { selectedExpression = ResolveOnMethodEntryAdvice(); entryWeavers.Add(selectedExpression.Reduce(adviceWeavingSettings)); } AddEntryScopeWeavers(entryWeavers); if (adviceDiscoveryVistor.HasOnMethodSuccessAdvice) { selectedExpression = ResolveOnMethodSuccessAdvice(); tryWeavers.Add(selectedExpression.Reduce(adviceWeavingSettings)); } if (argumentsWeavingSettings.IsFunction()) { OnFunctionWeavingDetected(); } if (adviceDiscoveryVistor.HasFinallyAdvice) { selectedExpression = ResolveFinallyAdvice(); finallyWeavers.Add(selectedExpression.Reduce(adviceWeavingSettings)); AddFinallyScopeWeavers(finallyWeavers); if (adviceDiscoveryVistor.HasOnMethodExceptionAdvice) { var aspectMember = aspectRepository.GetAspectFieldByType(aspectDefinition.Aspect.AspectType); var settings = new TryCatchFinallySettings(ArgumentType, localBuilderRepository); selectedExpression = ResolveOnMethodExceptionAdvice(); catchWeavers.Add(restoreArgsIfNeededScopeWeaver); catchWeavers.Add(selectedExpression.Reduce(adviceWeavingSettings)); weaver = new TryCatchFinallyAspectWeaver(settings, entryWeavers, tryWeavers, catchWeavers, finallyWeavers, returnValueWeaver); } else { finallyWeavers.Insert(0, restoreArgsIfNeededScopeWeaver); weaver = new OnMethodBoundaryTryFinallyAspectWeaver(entryWeavers, tryWeavers, finallyWeavers, returnValueWeaver); } } else { if (!byRefArgumentsStoreWeaver.ContainsByRefParams) { var weavers = entryWeavers; weavers.AddRange(tryWeavers); if (returnValueWeaver.IsNotNull()) { weavers.Add(returnValueWeaver); } weaver = new MethodScopeWeaversQueue(weavers); } else { AddFinallyScopeWeavers(finallyWeavers); finallyWeavers.Insert(0, restoreArgsIfNeededScopeWeaver); weaver = new OnMethodBoundaryTryFinallyAspectWeaver(entryWeavers, tryWeavers, finallyWeavers, returnValueWeaver); } } }
internal BeginCatchBlockMethodScopeWeaver(IEnumerable <IMethodScopeWeaver> catchWeavers, TryCatchFinallySettings tryCatchFinallySettings) { this.catchWeavers = catchWeavers; aspectArgumentType = tryCatchFinallySettings.AspectArgumentType; localBuilderRepository = tryCatchFinallySettings.LocalBuilderRepository; }
public TryCatchFinallySettings(Type aspectArgumentType, FieldInfo aspectMember, ILocalBuilderRepository localBuilderRepository) { AspectMember = aspectMember; AspectArgumentType = aspectArgumentType; LocalBuilderRepository = localBuilderRepository; }
internal OnMethodInterceptionBindingWeaver(Type aspectType, BindingSettings bindingSettings, IAspectWeavingSettings aspectWeavingSettings, IAspectWeaver methodScopeWeaver) : base(bindingSettings, aspectWeavingSettings, methodScopeWeaver) { localBuilderRepository = bindingSettings.LocalBuilderRepository; }
internal MethodDecoratorByRefArgumentsStoreWeaver(Type aspectArgumentType, MethodInfo method, ILocalBuilderRepository localBuilderRepository) : base(aspectArgumentType, method, localBuilderRepository) { }
internal BeginCatchBlockMethodScopeWeaver(IEnumerable<IMethodScopeWeaver> catchWeavers, TryCatchFinallySettings tryCatchFinallySettings) { this.catchWeavers = catchWeavers; aspectArgumentType = tryCatchFinallySettings.AspectArgumentType; localBuilderRepository = tryCatchFinallySettings.LocalBuilderRepository; }
internal MethodInvokerByRefArgumentsWeaver(Type previousAspectArgType, MethodInfo methodInfoImpl, ILocalBuilderRepository localBuilderRepository) : base(methodInfoImpl, localBuilderRepository) { this.previousAspectArgType = previousAspectArgType; byRefParamslocalBuilderMap = new Dictionary <int, LocalBuilder>(); }
internal TopAspectByRefArgumentsStoreWeaver(Type previousAspectArgType, MethodInfo method, ILocalBuilderRepository localBuilderRepository) : base(method, localBuilderRepository) { this.previousAspectArgType = previousAspectArgType; byRefParamslocalBuilderMap = new HashSet <int>(); }
internal BeginCatchBlockMethodScopeWeaver(TryCatchFinallySettings tryCatchFinallySettings) { aspectMember = tryCatchFinallySettings.AspectMember; aspectArgumentType = tryCatchFinallySettings.AspectArgumentType; localBuilderRepository = tryCatchFinallySettings.LocalBuilderRepository; }
internal TopAspectByRefArgumentsStoreWeaver(Type previousAspectArgType, MethodInfo method, ILocalBuilderRepository localBuilderRepository) : base(method, localBuilderRepository) { this.previousAspectArgType = previousAspectArgType; byRefParamslocalBuilderMap = new HashSet<int>(); }
internal AbstractByRefArgumentsStoreWeaver(MethodInfo methodInfoImpl, ILocalBuilderRepository localBuilderRepository) { this.localBuilderRepository = localBuilderRepository; parameters = methodInfoImpl.GetParameters().ToArray(param => param.ParameterType.IsByRef); }
internal AbstractBindingByRefArgumentsWeaver(Type aspectArgumentType, MethodInfo method, ILocalBuilderRepository localBuilderRepository) : base(method, localBuilderRepository) { this.aspectArgumentType = aspectArgumentType; byRefParamslocalBuilderMap = new Dictionary<int, LocalBuilder>(); }