示例#1
0
 internal ParameterWithMonoCecil(AssemblyWithMonoCecil assembly, ParameterDefinition parameter, MemberReference member)
 {
     this.assembly  = assembly;
     this.parameter = parameter;
     attributes     = new Lazy <Attributes>(() => new Attributes(assembly, parameter, excludedAttributeTypes));
     parameterType  = TypeReferenceWithMonoCecilFactory.CreateReference(assembly, parameter.ParameterType, member);
 }
        internal ConversionOperatorWithMonoCecil(ITypeWithMonoCecil declaringType, MethodDefinition method)
        {
            this.declaringType = declaringType;
            this.method        = method;
            AssemblyWithMonoCecil assembly = declaringType.Assembly;

            attributes       = new Lazy <Attributes>(() => new Attributes(assembly, method));
            parameter        = new OperatorParameterWithMonoCecil(new ParameterWithMonoCecil(assembly, method.Parameters[0], method));
            returnType       = TypeReferenceWithMonoCecilFactory.CreateReference(declaringType.Assembly, method.ReturnType, method);
            returnAttributes = new Lazy <Attributes>(() => new Attributes(assembly, method.MethodReturnType));
            body             = new Lazy <ILMethodBodyWithMonoCecilCil>(() => new ILMethodBodyWithMonoCecilCil(method));
        }
示例#3
0
        internal OperatorOverloadWithMonoCecil(ITypeWithMonoCecil declaringType, MethodDefinition method)
        {
            this.declaringType = declaringType;
            this.method        = method;
            AssemblyWithMonoCecil assembly = declaringType.Assembly;

            attributes = new Lazy <Attributes>(() => new Attributes(assembly, method));
            returnType = TypeReferenceWithMonoCecilFactory.CreateReference(assembly, method.ReturnType, method);
            parameters = new Lazy <Parameters <OperatorParameterWithMonoCecil> >(
                () => new Parameters <OperatorParameterWithMonoCecil>(assembly, method, parameter => new OperatorParameterWithMonoCecil(parameter)));
            body = new Lazy <ILMethodBodyWithMonoCecilCil>(() => new ILMethodBodyWithMonoCecilCil(method));
        }
示例#4
0
        internal DelegateWithMonoCecil(AssemblyWithMonoCecil assembly, NamespaceWithMonoCecil @namespace, TypeDefinition type)
        {
            this.assembly     = assembly;
            this.@namespace   = @namespace;
            this.type         = type;
            attributes        = new Lazy <Attributes>(() => new Attributes(assembly, type));
            genericParameters = new Lazy <GenericParameterDeclarations>(() => new GenericParameterDeclarations(assembly, type));
            MethodDefinition invokeMethod = type.Methods.First(method => method.Name == "Invoke");

            returnType = TypeReferenceWithMonoCecilFactory.CreateReference(assembly, invokeMethod.ReturnType, invokeMethod);
            parameters = new Lazy <Parameters <DelegateParameterWithMonoCecil> >(
                () => new Parameters <DelegateParameterWithMonoCecil>(assembly, invokeMethod, parameter => new DelegateParameterWithMonoCecil(parameter)));
        }
        internal InterfaceMethodWithMonoCecil(IInterfaceTypeWithMonoCecil declaringType, MethodDefinition method)
        {
            this.method        = method;
            this.declaringType = declaringType;
            AssemblyWithMonoCecil assembly = declaringType.Assembly;

            attributes        = new Lazy <Attributes>(() => new Attributes(assembly, method));
            returnAttributes  = new Lazy <Attributes>(() => new Attributes(assembly, method.MethodReturnType));
            genericParameters = new Lazy <GenericParameterDeclarations>(() => new GenericParameterDeclarations(assembly, method));
            returnType        = TypeReferenceWithMonoCecilFactory.CreateReference(assembly, method.ReturnType, method);
            parameters        = new Lazy <Parameters <MethodParameterWithMonoCecil> >(
                () => new Parameters <MethodParameterWithMonoCecil>(assembly, method, parameter => new MethodParameterWithMonoCecil(parameter)));
        }
示例#6
0
        internal InterfacePropertyWithMonoCecil(IInterfaceTypeWithMonoCecil declaringType, PropertyDefinition property)
        {
            this.property      = property;
            this.declaringType = declaringType;
            AssemblyWithMonoCecil assembly = declaringType.Assembly;

            attributes   = new Lazy <Attributes>(() => new Attributes(assembly, property));
            propertyType = TypeReferenceWithMonoCecilFactory.CreateReference(assembly, property.PropertyType, property);
            if (property.GetMethod != null)
            {
                getAccessor = new InterfaceAccessorWithMonoCecil(assembly, property.GetMethod);
            }

            if (property.SetMethod != null)
            {
                setAccessor = new InterfaceAccessorWithMonoCecil(assembly, property.SetMethod);
            }
        }
        internal InterfaceIndexerWithMonoCecil(IInterfaceTypeWithMonoCecil declaringType, PropertyDefinition indexer)
        {
            this.indexer       = indexer;
            this.declaringType = declaringType;
            AssemblyWithMonoCecil assembly = declaringType.Assembly;

            attributes  = new Lazy <Attributes>(() => new Attributes(assembly, indexer));
            indexerType = TypeReferenceWithMonoCecilFactory.CreateReference(assembly, indexer.PropertyType, indexer);
            parameters  = new Lazy <Parameters <IndexerParameterWithMonoCecil> >(
                () => new Parameters <IndexerParameterWithMonoCecil>(assembly, indexer, parameter => new IndexerParameterWithMonoCecil(parameter)));
            if (indexer.GetMethod != null)
            {
                getAccessor = new InterfaceAccessorWithMonoCecil(assembly, indexer.GetMethod);
            }

            if (indexer.SetMethod != null)
            {
                setAccessor = new InterfaceAccessorWithMonoCecil(assembly, indexer.SetMethod);
            }
        }
示例#8
0
 internal ArrayTypeReferenceWithMonoCecil(AssemblyWithMonoCecil assembly, TypeReference type, MemberReference member)
 {
     this.type = type;
     //dimensions = type..GetArrayRank();
     elementType = TypeReferenceWithMonoCecilFactory.CreateReference(assembly, type.GetElementType(), member);
 }
 internal NestedTypeReferenceWithMonoCecil(AssemblyWithMonoCecil assembly, TypeReference nestedType)
 {
     type            = TypeReferenceWithMonoCecilFactory.CreateReference(assembly, nestedType.DeclaringType);
     this.nestedType = TypeReferenceWithMonoCecilFactory.CreateReference(assembly, nestedType, ignoreNestedType: true);
 }