Пример #1
0
 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);
 }
Пример #2
0
 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;
 }
Пример #3
0
 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;
 }
Пример #4
0
 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
         );
 }
Пример #5
0
 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);
 }
Пример #6
0
 internal static void CheckMethodAttributesForOverriddenMethods(SettableValueForEnums <MethodAttributes> attrs, ListProxy <CILMethod> overriddenMethods)
 {
     if (overriddenMethods.CQ.Any())
     {
         attrs.Value = (attrs.Value & (~MethodAttributes.MemberAccessMask)) | MethodAttributes.Private;
     }
 }
Пример #7
0
 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;
 }
Пример #8
0
 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;
 }
Пример #9
0
 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)
 {
 }
Пример #10
0
 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
         );
 }
Пример #11
0
 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)
 {
 }
Пример #12
0
 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
         );
 }
Пример #13
0
 internal CILEventImpl(
     CILReflectionContextImpl ctx,
     Int32 anID,
     LazyWithLock <ListProxy <CILCustomAttribute> > cAttrDataFunc,
     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 resettablesAreSettable = false
     )
     : base(ctx, CILElementKind.Event, anID, cAttrDataFunc)
 {
     InitFields(
         ref this.name,
         ref this.eventAttributes,
         ref this.eventType,
         ref this.addMethod,
         ref this.removeMethod,
         ref this.raiseMethod,
         ref this.otherMethods,
         ref this.declaringType,
         aName,
         anEventAttributes,
         eventTypeFunc,
         addMethodFunc,
         removeMethodFunc,
         raiseMethodFunc,
         otherMethodsFunc,
         declaringTypeFunc,
         resettablesAreSettable
         );
 }
Пример #14
0
 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
         );
 }
Пример #15
0
 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
         );
 }