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; }
internal CILPropertyImpl( CILReflectionContextImpl ctx, Int32 anID, LazyWithLock <ListProxy <CILCustomAttribute> > cAttrDataFunc, SettableValueForClasses <String> aName, SettableValueForEnums <PropertyAttributes> aPropertyAttributes, Func <CILMethod> setMethodFunc, Func <CILMethod> getMethodFunc, Func <CILType> declaringTypeFunc, SettableLazy <Object> aConstValue, LazyWithLock <ListProxy <CILCustomModifier> > customMods, Boolean resettablesAreSettable = false ) : base(ctx, CILElementKind.Property, anID, cAttrDataFunc) { InitFields( ref this.name, ref this.propertyAttributes, ref this.setMethod, ref this.getMethod, ref this.declaringType, ref this.constValue, ref this.customModifiers, aName, aPropertyAttributes, setMethodFunc, getMethodFunc, declaringTypeFunc, aConstValue, customMods, resettablesAreSettable ); }
private static void InitFields( ref SettableValueForClasses <String> name, ref Lazy <CILParameter> returnParameter, ref Lazy <ListProxy <CILTypeBase> > gArgs, ref Object gArgsLock, ref SettableLazy <CILMethod> gDef, ref Lazy <ListProxy <CILMethod> > overriddenMethod, // TODO use LazyWithLock ? ref Object overriddenMethodsLock, ref SettableValueForEnums <PInvokeAttributes> pInvokeAttributes, ref SettableValueForClasses <String> pInvokeName, ref SettableValueForClasses <String> pInvokeModule, SettableValueForClasses <String> aName, Func <CILParameter> returnParameterFunc, Func <ListProxy <CILTypeBase> > gArgsFunc, Func <CILMethod> gDefFunc, Func <ListProxy <CILMethod> > anOverriddenMethod, SettableValueForEnums <PInvokeAttributes> aPInvokeAttributes, SettableValueForClasses <String> aPInvokeName, SettableValueForClasses <String> aPInvokeModule, Boolean resettablesAreSettable ) { name = aName; returnParameter = new Lazy <CILParameter>(returnParameterFunc, LazyThreadSafetyMode.ExecutionAndPublication); gArgs = new Lazy <ListProxy <CILTypeBase> >(gArgsFunc, LazyThreadSafetyMode.ExecutionAndPublication); gDef = new SettableLazy <CILMethod>(gDefFunc); overriddenMethod = resettablesAreSettable ? new Lazy <ListProxy <CILMethod> >(anOverriddenMethod, LazyThreadSafetyMode.ExecutionAndPublication) : null; gArgsLock = resettablesAreSettable ? new Object() : null; overriddenMethodsLock = resettablesAreSettable ? new Object() : null; pInvokeAttributes = aPInvokeAttributes ?? new SettableValueForEnums <PInvokeAttributes>((PInvokeAttributes)0); pInvokeName = aPInvokeName ?? new SettableValueForClasses <String>(null); pInvokeModule = aPInvokeModule ?? new SettableValueForClasses <String>(null); }
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; }
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; }
private static void InitFields( ref String name, ref Lazy <CILAssembly> assembly, ref LazyWithLock <ListProxy <CILType> > types, ref Lazy <CILType> moduleInitializer, ref SettableLazy <CILModule> associatedMSCorLib, ref ConcurrentDictionary <String, CILType> typeNameCache, ref IDictionary <String, ManifestResource> manifestResources, String aName, Func <CILAssembly> assemblyFunc, Func <ListProxy <CILType> > typesFunc, Func <CILType> moduleInitializerFunc, Func <CILModule> associatedMSCorLibFunc, IDictionary <String, ManifestResource> mResources, CILModuleImpl me ) { name = aName; assembly = new Lazy <CILAssembly>(assemblyFunc, LazyThreadSafetyMode.ExecutionAndPublication); types = new LazyWithLock <ListProxy <CILType> >(typesFunc); moduleInitializer = new Lazy <CILType>(moduleInitializerFunc, LazyThreadSafetyMode.ExecutionAndPublication); associatedMSCorLib = new SettableLazy <CILModule>(associatedMSCorLibFunc); typeNameCache = new ConcurrentDictionary <String, CILType>(); manifestResources = mResources ?? new Dictionary <String, ManifestResource>(); }
internal CILConstructorImpl( CILReflectionContextImpl ctx, Int32 anID, LazyWithLock <ListProxy <CILCustomAttribute> > cAttrDataFunc, SettableValueForEnums <CallingConventions> aCallingConvention, SettableValueForEnums <MethodAttributes> aMethodAttributes, Func <CILType> declaringTypeFunc, Func <ListProxy <CILParameter> > parametersFunc, Func <MethodIL> methodIL, SettableLazy <MethodImplAttributes> aMethodImplementationAttributes, Lazy <DictionaryWithRoles <SecurityAction, ListProxy <SecurityInformation>, ListProxyQuery <SecurityInformation>, ListQuery <SecurityInformation> > > aSecurityInfo, Boolean resettablesAreSettable ) : base(ctx, anID, true, cAttrDataFunc, aCallingConvention, aMethodAttributes, declaringTypeFunc, parametersFunc, methodIL, aMethodImplementationAttributes, aSecurityInfo, resettablesAreSettable) { }
private static void InitFields( ref SettableLazy <CILAssemblyName> name, ref LazyWithLock <ListProxy <CILModule> > modules, ref LazyWithLock <DictionaryProxy <Tuple <String, String>, TypeForwardingInfo> > forwardedTypes, ref SettableLazy <CILModule> mainModule, Func <CILAssemblyName> nameFunc, Func <ListProxy <CILModule> > moduleFunc, Func <DictionaryProxy <Tuple <String, String>, TypeForwardingInfo> > forwardedTypesFunc, Func <CILModule> mainModuleFunc ) { name = new SettableLazy <CILAssemblyName>(nameFunc); modules = new LazyWithLock <ListProxy <CILModule> >(moduleFunc); forwardedTypes = new LazyWithLock <DictionaryProxy <Tuple <String, String>, TypeForwardingInfo> >(forwardedTypesFunc); mainModule = new SettableLazy <CILModule>(mainModuleFunc); }
internal CILMethodImpl( CILReflectionContextImpl ctx, Int32 anID, LazyWithLock <ListProxy <CILCustomAttribute> > cAttrDataFunc, SettableValueForEnums <CallingConventions> aCallingConvention, SettableValueForEnums <MethodAttributes> aMethodAttributes, Func <CILType> declaringTypeFunc, Func <ListProxy <CILParameter> > parametersFunc, Func <MethodIL> methodIL, SettableLazy <MethodImplAttributes> aMethodImplementationAttributes, Lazy <DictionaryWithRoles <SecurityAction, ListProxy <SecurityInformation>, ListProxyQuery <SecurityInformation>, ListQuery <SecurityInformation> > > aSecurityInformation, SettableValueForClasses <String> aName, Func <CILParameter> returnParameterFunc, Func <ListProxy <CILTypeBase> > gArgsFunc, Func <CILMethod> gDefFunc, Func <ListProxy <CILMethod> > overriddenMethodFunc, SettableValueForEnums <PInvokeAttributes> aPInvokeAttributes, SettableValueForClasses <String> aPInvokeName, SettableValueForClasses <String> aPInvokeModuleName, Boolean resettablesAreSettable ) : base(ctx, anID, false, cAttrDataFunc, aCallingConvention, aMethodAttributes, declaringTypeFunc, parametersFunc, methodIL, aMethodImplementationAttributes, aSecurityInformation, resettablesAreSettable) { InitFields( ref this.name, ref this.returnParameter, ref this.gArgs, ref this.gArgsLock, ref this.gDef, ref this.overriddenMethods, ref this.overriddenMethodsLock, ref this.pInvokeAttributes, ref this.pInvokeName, ref this.pInvokeModule, aName, returnParameterFunc, gArgsFunc, gDefFunc, overriddenMethodFunc, aPInvokeAttributes, aPInvokeName, aPInvokeModuleName, resettablesAreSettable ); }
internal CILMethodImpl( CILReflectionContextImpl ctx, Int32 anID, LazyWithLock <ListProxy <CILCustomAttribute> > cAttrDataFunc, SettableValueForEnums <CallingConventions> aCallingConvention, SettableValueForEnums <MethodAttributes> aMethodAttributes, Func <CILType> declaringTypeFunc, Func <ListProxy <CILParameter> > parametersFunc, SettableLazy <MethodImplAttributes> aMethodImplementationAttributes, Lazy <DictionaryWithRoles <SecurityAction, ListProxy <SecurityInformation>, ListProxyQuery <SecurityInformation>, ListQuery <SecurityInformation> > > aSecurityInformation, SettableValueForClasses <String> aName, Func <CILParameter> returnParameterFunc, Func <ListProxy <CILTypeBase> > gArgsFunc, Func <CILMethod> gDefFunc, Boolean resettablesAreSettable = false ) : this(ctx, anID, cAttrDataFunc, aCallingConvention, aMethodAttributes, declaringTypeFunc, parametersFunc, null, aMethodImplementationAttributes, aSecurityInformation, aName, returnParameterFunc, gArgsFunc, gDefFunc, null, null, null, null, resettablesAreSettable) { }
internal CILFieldImpl( CILReflectionContextImpl ctx, Int32 anID, LazyWithLock <ListProxy <CILCustomAttribute> > cAttrDataFunc, SettableValueForEnums <FieldAttributes> fAttributes, SettableValueForClasses <String> aName, Func <CILType> declaringTypeFunc, Func <CILTypeBase> fieldTypeFunc, SettableLazy <Object> aConstValue, SettableValueForClasses <Byte[]> anInitialValue, LazyWithLock <ListProxy <CILCustomModifier> > customModsFunc, SettableLazy <Int32> aFieldOffset, SettableLazy <MarshalingInfo> marshalInfoVal, Boolean resettablesAreSettable = false ) : base(ctx, CILElementKind.Field, anID, cAttrDataFunc) { InitFields( ref this.fieldAttributes, ref this.name, ref this.declaringType, ref this.fieldType, ref this.constValue, ref this.initialValue, ref this.customModifiers, ref this.fieldOffset, ref this.marshalInfo, fAttributes, aName, declaringTypeFunc, fieldTypeFunc, aConstValue, anInitialValue, customModsFunc, aFieldOffset, marshalInfoVal, resettablesAreSettable ); }
internal CILParameterImpl( CILReflectionContextImpl ctx, Int32 anID, LazyWithLock <ListProxy <CILCustomAttribute> > cAttrDataFunc, SettableValueForEnums <ParameterAttributes> aParameterAttributes, Int32 aPosition, SettableValueForClasses <String> aName, Func <CILMethodBase> methodFunc, Func <CILTypeBase> parameterTypeFunc, SettableLazy <Object> aDefaultValue, LazyWithLock <ListProxy <CILCustomModifier> > customMods, SettableLazy <MarshalingInfo> marshalInfoVal, Boolean resettablesAreSettable = false ) : base(ctx, CILElementKind.Parameter, anID, cAttrDataFunc) { InitFields( ref this.paramAttributes, ref this.position, ref this.name, ref this.method, ref this.parameterType, ref this.defaultValue, ref this.customModifiers, ref this.marshalInfo, aParameterAttributes, aPosition, aName, methodFunc, parameterTypeFunc, aDefaultValue, customMods, marshalInfoVal, resettablesAreSettable ); }
protected CILMethodBaseImpl( CILReflectionContextImpl ctx, Int32 anID, Boolean isCtor, LazyWithLock <ListProxy <CILCustomAttribute> > cAttrDataFunc, SettableValueForEnums <CallingConventions> aCallingConvention, SettableValueForEnums <MethodAttributes> aMethodAttributes, Func <CILType> declaringTypeFunc, Func <ListProxy <CILParameter> > parametersFunc, Func <MethodIL> methodIL, SettableLazy <MethodImplAttributes> aMethodImplementationAttributes, Lazy <DictionaryWithRoles <SecurityAction, ListProxy <SecurityInformation>, ListProxyQuery <SecurityInformation>, ListQuery <SecurityInformation> > > aSecurityInfo, Boolean resettablesAreSettable ) : base(ctx, isCtor ? CILElementKind.Constructor : CILElementKind.Method, anID, cAttrDataFunc) { InitFields( ref this.callingConvention, ref this.methodAttributes, ref this.methodKind, ref this.declaringType, ref this.parameters, ref this.il, ref this.methodImplementationAttributes, ref this.securityInfo, aCallingConvention, aMethodAttributes, isCtor ? MethodKind.Constructor : MethodKind.Method, declaringTypeFunc, parametersFunc, methodIL, aMethodImplementationAttributes, aSecurityInfo ?? new Lazy <DictionaryWithRoles <SecurityAction, ListProxy <SecurityInformation>, ListProxyQuery <SecurityInformation>, ListQuery <SecurityInformation> > >(() => ctx.CollectionsFactory.NewDictionary <SecurityAction, ListProxy <SecurityInformation>, ListProxyQuery <SecurityInformation>, ListQuery <SecurityInformation> >(), LazyThreadSafetyMode.ExecutionAndPublication), resettablesAreSettable ); }