private static void InitFields( ref SettableValueForEnums <ParameterAttributes> paramAttributes, ref Int32 position, ref SettableValueForClasses <String> name, ref Lazy <CILMethodBase> method, ref ResettableLazy <CILTypeBase> parameterType, ref SettableLazy <Object> defaultValue, ref LazyWithLock <ListProxy <CILCustomModifier> > customMods, ref SettableLazy <MarshalingInfo> marshalInfo, SettableValueForEnums <ParameterAttributes> aParameterAttributes, Int32 aPosition, SettableValueForClasses <String> aName, Func <CILMethodBase> methodFunc, Func <CILTypeBase> parameterTypeFunc, SettableLazy <Object> aDefaultValue, LazyWithLock <ListProxy <CILCustomModifier> > theCustomMods, SettableLazy <MarshalingInfo> marshalInfoVal, Boolean resettablesAreSettable ) { paramAttributes = aParameterAttributes; position = aPosition; name = aName; method = new Lazy <CILMethodBase>(methodFunc, LazyThreadSafetyMode.ExecutionAndPublication); parameterType = resettablesAreSettable ? new ResettableAndSettableLazy <CILTypeBase>(parameterTypeFunc) : new ResettableLazy <CILTypeBase>(parameterTypeFunc); defaultValue = aDefaultValue; customMods = theCustomMods; marshalInfo = marshalInfoVal; }
private static void InitFields( ref SettableValueForClasses <String> name, ref SettableValueForEnums <EventAttributes> eventAttributes, ref ResettableLazy <CILTypeBase> eventType, ref ResettableLazy <CILMethod> addMethod, ref ResettableLazy <CILMethod> removeMethod, ref ResettableLazy <CILMethod> raiseMethod, ref ResettableLazy <ListProxy <CILMethod> > otherMethods, ref Lazy <CILType> declaringType, SettableValueForClasses <String> aName, SettableValueForEnums <EventAttributes> anEventAttributes, Func <CILTypeBase> eventTypeFunc, Func <CILMethod> addMethodFunc, Func <CILMethod> removeMethodFunc, Func <CILMethod> raiseMethodFunc, Func <ListProxy <CILMethod> > otherMethodsFunc, Func <CILType> declaringTypeFunc, Boolean resettablesSettable ) { name = aName; eventAttributes = anEventAttributes; eventType = resettablesSettable ? new ResettableAndSettableLazy <CILTypeBase>(eventTypeFunc) : new ResettableLazy <CILTypeBase>(eventTypeFunc); addMethod = resettablesSettable ? new ResettableAndSettableLazy <CILMethod>(addMethodFunc) : new ResettableLazy <CILMethod>(addMethodFunc); removeMethod = resettablesSettable ? new ResettableAndSettableLazy <CILMethod>(removeMethodFunc) : new ResettableLazy <CILMethod>(removeMethodFunc); raiseMethod = resettablesSettable ? new ResettableAndSettableLazy <CILMethod>(raiseMethodFunc) : new ResettableLazy <CILMethod>(raiseMethodFunc); otherMethods = new ResettableLazy <ListProxy <CILMethod> >(otherMethodsFunc); declaringType = new Lazy <CILType>(declaringTypeFunc, LazyThreadSafetyMode.ExecutionAndPublication); }
private static void InitFields( ref SettableValueForClasses <String> name, ref SettableValueForEnums <PropertyAttributes> propertyAttributes, ref ResettableLazy <CILMethod> setMethod, ref ResettableLazy <CILMethod> getMethod, ref SettableLazy <CILType> declaringType, ref SettableLazy <Object> constValue, ref LazyWithLock <ListProxy <CILCustomModifier> > customModifiers, SettableValueForClasses <String> aName, SettableValueForEnums <PropertyAttributes> aPropertyAttributes, Func <CILMethod> setMethodFunc, Func <CILMethod> getMethodFunc, Func <CILType> declaringTypeFunc, SettableLazy <Object> aConstValue, LazyWithLock <ListProxy <CILCustomModifier> > customMods, Boolean resettablesAreSettable ) { name = aName; propertyAttributes = aPropertyAttributes; setMethod = resettablesAreSettable ? new ResettableAndSettableLazy <CILMethod>(setMethodFunc) : new ResettableLazy <CILMethod>(setMethodFunc); getMethod = resettablesAreSettable ? new ResettableAndSettableLazy <CILMethod>(getMethodFunc) : new ResettableLazy <CILMethod>(getMethodFunc); declaringType = new SettableLazy <CILType>(declaringTypeFunc); constValue = aConstValue; customModifiers = customMods; }
internal static Boolean RemoveFromResettableLazyList <T>(this ResettableLazy <ListProxy <T> > lazy, T value) { lock (lazy.Lock) { return(lazy.Value.Remove(value)); } }
private static void InitFields( ref SettableValueForEnums <CallingConventions> callingConvention, ref SettableValueForEnums <MethodAttributes> methodAttributes, ref MethodKind methodKind, ref Lazy <CILType> declaringType, ref ResettableLazy <ListProxy <CILParameter> > parameters, ref SettableLazy <MethodIL> il, ref SettableLazy <MethodImplAttributes> methodImplementationAttributes, ref Lazy <DictionaryWithRoles <SecurityAction, ListProxy <SecurityInformation>, ListProxyQuery <SecurityInformation>, ListQuery <SecurityInformation> > > securityInfo, SettableValueForEnums <CallingConventions> aCallingConvention, SettableValueForEnums <MethodAttributes> aMethodAttributes, MethodKind aMethodKind, Func <CILType> declaringTypeFunc, Func <ListProxy <CILParameter> > parametersFunc, Func <MethodIL> methodIL, SettableLazy <MethodImplAttributes> aMethodImplementationAttributes, Lazy <DictionaryWithRoles <SecurityAction, ListProxy <SecurityInformation>, ListProxyQuery <SecurityInformation>, ListQuery <SecurityInformation> > > securityInfoLazy, Boolean resettablesAreSettable ) { callingConvention = aCallingConvention; methodAttributes = aMethodAttributes; methodKind = aMethodKind; declaringType = new Lazy <CILType>(declaringTypeFunc, LazyThreadSafetyMode.ExecutionAndPublication); // TODO is ResettableAndSettableLazy really needed? parameters = resettablesAreSettable ? new ResettableAndSettableLazy <ListProxy <CILParameter> >(parametersFunc) : new ResettableLazy <ListProxy <CILParameter> >(parametersFunc); il = new SettableLazy <MethodIL>(resettablesAreSettable ? methodIL : () => { throw new NotSupportedException("Emitting IL is not supported for methods with generic non-definition declaring types or generic non-definition methods."); }); methodImplementationAttributes = aMethodImplementationAttributes; securityInfo = securityInfoLazy; }
private static void InitFields( ref SettableValueForEnums <FieldAttributes> attributes, ref SettableValueForClasses <String> name, ref Lazy <CILType> declaringType, ref ResettableLazy <CILTypeBase> fieldType, ref SettableLazy <Object> constValue, ref SettableValueForClasses <Byte[]> initialValue, ref LazyWithLock <ListProxy <CILCustomModifier> > customModifiers, ref SettableLazy <Int32> fieldOffset, ref SettableLazy <MarshalingInfo> marshalInfo, SettableValueForEnums <FieldAttributes> fAttributes, SettableValueForClasses <String> aName, Func <CILType> declaringTypeFunc, Func <CILTypeBase> fieldTypeFunc, SettableLazy <Object> aConstValue, SettableValueForClasses <Byte[]> anInitialValue, LazyWithLock <ListProxy <CILCustomModifier> > customModifiersFunc, SettableLazy <Int32> aFieldOffset, SettableLazy <MarshalingInfo> marshalInfoVal, Boolean resettablesAreSettable ) { attributes = fAttributes; name = aName; declaringType = new Lazy <CILType>(declaringTypeFunc, LazyThreadSafetyMode.ExecutionAndPublication); fieldType = resettablesAreSettable ? new ResettableAndSettableLazy <CILTypeBase>(fieldTypeFunc) : new ResettableLazy <CILTypeBase>(fieldTypeFunc); constValue = aConstValue; initialValue = anInitialValue; customModifiers = customModifiersFunc; fieldOffset = aFieldOffset; marshalInfo = marshalInfoVal; }
internal static T AddToResettableLazyList <T>(this ResettableLazy <ListProxy <T> > lazy, T value) { lock (lazy.Lock) { lazy.Value.Add(value); } return(value); }