Exemple #1
0
 public PredefinedMember(ModuleContainer module, PredefinedType type, string name, MemberKind kind, Func <TypeSpec[]> typesBuilder)
     : this(module, type, new MemberFilter(name, 0, kind, null, null))
 {
     filter_builder = typesBuilder;
 }
Exemple #2
0
		public PredefinedTypes (ModuleContainer module)
		{
			TypedReference = new PredefinedType (module, MemberKind.Struct, "System", "TypedReference");
			ArgIterator = new PredefinedType (module, MemberKind.Struct, "System", "ArgIterator");
			MarshalByRefObject = new PredefinedType (module, MemberKind.Class, "System", "MarshalByRefObject");
			RuntimeHelpers = new PredefinedType (module, MemberKind.Class, "System.Runtime.CompilerServices", "RuntimeHelpers");
			IAsyncResult = new PredefinedType (module, MemberKind.Interface, "System", "IAsyncResult");
			AsyncCallback = new PredefinedType (module, MemberKind.Delegate, "System", "AsyncCallback");
			RuntimeArgumentHandle = new PredefinedType (module, MemberKind.Struct, "System", "RuntimeArgumentHandle");
			CharSet = new PredefinedType (module, MemberKind.Enum, "System.Runtime.InteropServices", "CharSet");
			IsVolatile = new PredefinedType (module, MemberKind.Class, "System.Runtime.CompilerServices", "IsVolatile");
			IEnumeratorGeneric = new PredefinedType (module, MemberKind.Interface, "System.Collections.Generic", "IEnumerator", 1);
			IListGeneric = new PredefinedType (module, MemberKind.Interface, "System.Collections.Generic", "IList", 1);
			ICollectionGeneric = new PredefinedType (module, MemberKind.Interface, "System.Collections.Generic", "ICollection", 1);
			IEnumerableGeneric = new PredefinedType (module, MemberKind.Interface, "System.Collections.Generic", "IEnumerable", 1);
			Nullable = new PredefinedType (module, MemberKind.Struct, "System", "Nullable", 1);
			Activator = new PredefinedType (module, MemberKind.Class, "System", "Activator");
			Interlocked = new PredefinedType (module, MemberKind.Class, "System.Threading", "Interlocked");
			Monitor = new PredefinedType (module, MemberKind.Class, "System.Threading", "Monitor");
			NotSupportedException = new PredefinedType (module, MemberKind.Class, "System", "NotSupportedException");
			RuntimeFieldHandle = new PredefinedType (module, MemberKind.Struct, "System", "RuntimeFieldHandle");
			RuntimeMethodHandle = new PredefinedType (module, MemberKind.Struct, "System", "RuntimeMethodHandle");

			Expression = new PredefinedType (module, MemberKind.Class, "System.Linq.Expressions", "Expression");
			ExpressionGeneric = new PredefinedType (module, MemberKind.Class, "System.Linq.Expressions", "Expression", 1);
			ParameterExpression = new PredefinedType (module, MemberKind.Class, "System.Linq.Expressions", "ParameterExpression");
			FieldInfo = new PredefinedType (module, MemberKind.Class, "System.Reflection", "FieldInfo");
			MethodBase = new PredefinedType (module, MemberKind.Class, "System.Reflection", "MethodBase");
			MethodInfo = new PredefinedType (module, MemberKind.Class, "System.Reflection", "MethodInfo");
			ConstructorInfo = new PredefinedType (module, MemberKind.Class, "System.Reflection", "ConstructorInfo");

			CallSite = new PredefinedType (module, MemberKind.Class, "System.Runtime.CompilerServices", "CallSite");
			CallSiteGeneric = new PredefinedType (module, MemberKind.Class, "System.Runtime.CompilerServices", "CallSite", 1);
			Binder = new PredefinedType (module, MemberKind.Class, "Microsoft.CSharp.RuntimeBinder", "Binder");
			BinderFlags = new PredefinedType (module, MemberKind.Enum, "Microsoft.CSharp.RuntimeBinder", "CSharpBinderFlags");

			//
			// Define types which are used for comparison. It does not matter
			// if they don't exist as no error report is needed
			//
			TypedReference.Define ();
			ArgIterator.Define ();
			MarshalByRefObject.Define ();
			CharSet.Define ();

			IEnumerableGeneric.Define ();
			IListGeneric.Define ();
			ICollectionGeneric.Define ();
			IEnumerableGeneric.Define ();
			IEnumeratorGeneric.Define ();
			Nullable.Define ();
			ExpressionGeneric.Define ();

			// Deal with obsolete static types
			// TODO: remove
			TypeManager.typed_reference_type = TypedReference.TypeSpec;
			TypeManager.arg_iterator_type = ArgIterator.TypeSpec;
			TypeManager.mbr_type = MarshalByRefObject.TypeSpec;
			TypeManager.generic_ilist_type = IListGeneric.TypeSpec;
			TypeManager.generic_icollection_type = ICollectionGeneric.TypeSpec;
			TypeManager.generic_ienumerator_type = IEnumeratorGeneric.TypeSpec;
			TypeManager.generic_ienumerable_type = IEnumerableGeneric.TypeSpec;
			TypeManager.generic_nullable_type = Nullable.TypeSpec;
			TypeManager.expression_type = ExpressionGeneric.TypeSpec;
		}
Exemple #3
0
 public PredefinedMember(ModuleContainer module, PredefinedType type, string name, params TypeSpec[] types)
     : this(module, type, MemberFilter.Method(name, 0, ParametersCompiled.CreateFullyResolved(types), null))
 {
 }
Exemple #4
0
 public PredefinedMember(ModuleContainer module, PredefinedType type, MemberFilter filter)
 {
     this.module = module;
     this.declaring_type_predefined = type;
     this.filter = filter;
 }
Exemple #5
0
        public PredefinedTypes(ModuleContainer module)
        {
            TypedReference = new PredefinedType(module, MemberKind.Struct, "System", "TypedReference");
            ArgIterator    = new PredefinedType(module, MemberKind.Struct, "System", "ArgIterator");

            MarshalByRefObject    = new PredefinedType(module, MemberKind.Class, "System", "MarshalByRefObject");
            RuntimeHelpers        = new PredefinedType(module, MemberKind.Class, "System.Runtime.CompilerServices", "RuntimeHelpers");
            IAsyncResult          = new PredefinedType(module, MemberKind.Interface, "System", "IAsyncResult");
            AsyncCallback         = new PredefinedType(module, MemberKind.Delegate, "System", "AsyncCallback");
            RuntimeArgumentHandle = new PredefinedType(module, MemberKind.Struct, "System", "RuntimeArgumentHandle");
            CharSet               = new PredefinedType(module, MemberKind.Enum, "System.Runtime.InteropServices", "CharSet");
            IsVolatile            = new PredefinedType(module, MemberKind.Class, "System.Runtime.CompilerServices", "IsVolatile");
            IEnumeratorGeneric    = new PredefinedType(module, MemberKind.Interface, "System.Collections.Generic", "IEnumerator", 1);
            IListGeneric          = new PredefinedType(module, MemberKind.Interface, "System.Collections.Generic", "IList", 1);
            ICollectionGeneric    = new PredefinedType(module, MemberKind.Interface, "System.Collections.Generic", "ICollection", 1);
            IEnumerableGeneric    = new PredefinedType(module, MemberKind.Interface, "System.Collections.Generic", "IEnumerable", 1);
            Nullable              = new PredefinedType(module, MemberKind.Struct, "System", "Nullable", 1);
            Activator             = new PredefinedType(module, MemberKind.Class, "System", "Activator");
            Interlocked           = new PredefinedType(module, MemberKind.Class, "System.Threading", "Interlocked");
            Monitor               = new PredefinedType(module, MemberKind.Class, "System.Threading", "Monitor");
            NotSupportedException = new PredefinedType(module, MemberKind.Class, "System", "NotSupportedException");
            RuntimeFieldHandle    = new PredefinedType(module, MemberKind.Struct, "System", "RuntimeFieldHandle");
            RuntimeMethodHandle   = new PredefinedType(module, MemberKind.Struct, "System", "RuntimeMethodHandle");
            SecurityAction        = new PredefinedType(module, MemberKind.Enum, "System.Security.Permissions", "SecurityAction");
            Dictionary            = new PredefinedType(module, MemberKind.Class, "System.Collections.Generic", "Dictionary", 2);
            Hashtable             = new PredefinedType(module, MemberKind.Class, "System.Collections", "Hashtable");

            Expression          = new PredefinedType(module, MemberKind.Class, "System.Linq.Expressions", "Expression");
            ExpressionGeneric   = new PredefinedType(module, MemberKind.Class, "System.Linq.Expressions", "Expression", 1);
            MemberBinding       = new PredefinedType(module, MemberKind.Class, "System.Linq.Expressions", "MemberBinding");
            ParameterExpression = new PredefinedType(module, MemberKind.Class, "System.Linq.Expressions", "ParameterExpression");
            FieldInfo           = new PredefinedType(module, MemberKind.Class, "System.Reflection", "FieldInfo");
            MethodBase          = new PredefinedType(module, MemberKind.Class, "System.Reflection", "MethodBase");
            MethodInfo          = new PredefinedType(module, MemberKind.Class, "System.Reflection", "MethodInfo");
            ConstructorInfo     = new PredefinedType(module, MemberKind.Class, "System.Reflection", "ConstructorInfo");

            CallSite        = new PredefinedType(module, MemberKind.Class, "System.Runtime.CompilerServices", "CallSite");
            CallSiteGeneric = new PredefinedType(module, MemberKind.Class, "System.Runtime.CompilerServices", "CallSite", 1);
            Binder          = new PredefinedType(module, MemberKind.Class, "Microsoft.CSharp.RuntimeBinder", "Binder");
            BinderFlags     = new PredefinedType(module, MemberKind.Enum, "Microsoft.CSharp.RuntimeBinder", "CSharpBinderFlags");

            Action = new PredefinedType(module, MemberKind.Delegate, "System", "Action");
            AsyncVoidMethodBuilder        = new PredefinedType(module, MemberKind.Struct, "System.Runtime.CompilerServices", "AsyncVoidMethodBuilder");
            AsyncTaskMethodBuilder        = new PredefinedType(module, MemberKind.Struct, "System.Runtime.CompilerServices", "AsyncTaskMethodBuilder");
            AsyncTaskMethodBuilderGeneric = new PredefinedType(module, MemberKind.Struct, "System.Runtime.CompilerServices", "AsyncTaskMethodBuilder", 1);
            Task        = new PredefinedType(module, MemberKind.Class, "System.Threading.Tasks", "Task");
            TaskGeneric = new PredefinedType(module, MemberKind.Class, "System.Threading.Tasks", "Task", 1);

            //
            // Define types which are used for comparison. It does not matter
            // if they don't exist as no error report is needed
            //
            if (TypedReference.Define())
            {
                TypedReference.TypeSpec.IsSpecialRuntimeType = true;
            }

            if (ArgIterator.Define())
            {
                ArgIterator.TypeSpec.IsSpecialRuntimeType = true;
            }

            if (IEnumerableGeneric.Define())
            {
                IEnumerableGeneric.TypeSpec.IsGenericIterateInterface = true;
            }

            if (IListGeneric.Define())
            {
                IListGeneric.TypeSpec.IsGenericIterateInterface = true;
            }

            if (ICollectionGeneric.Define())
            {
                ICollectionGeneric.TypeSpec.IsGenericIterateInterface = true;
            }

            if (Nullable.Define())
            {
                Nullable.TypeSpec.IsNullableType = true;
            }

            if (ExpressionGeneric.Define())
            {
                ExpressionGeneric.TypeSpec.IsExpressionTreeType = true;
            }

            Task.Define();
            if (TaskGeneric.Define())
            {
                TaskGeneric.TypeSpec.IsGenericTask = true;
            }
        }
        public PredefinedTypes(ModuleContainer module)
        {
            TypedReference        = new PredefinedType(module, MemberKind.Struct, "System", "TypedReference");
            ArgIterator           = new PredefinedType(module, MemberKind.Struct, "System", "ArgIterator");
            MarshalByRefObject    = new PredefinedType(module, MemberKind.Class, "System", "MarshalByRefObject");
            RuntimeHelpers        = new PredefinedType(module, MemberKind.Class, "System.Runtime.CompilerServices", "RuntimeHelpers");
            IAsyncResult          = new PredefinedType(module, MemberKind.Interface, "System", "IAsyncResult");
            AsyncCallback         = new PredefinedType(module, MemberKind.Delegate, "System", "AsyncCallback");
            RuntimeArgumentHandle = new PredefinedType(module, MemberKind.Struct, "System", "RuntimeArgumentHandle");
            CharSet               = new PredefinedType(module, MemberKind.Enum, "System.Runtime.InteropServices", "CharSet");
            IsVolatile            = new PredefinedType(module, MemberKind.Class, "System.Runtime.CompilerServices", "IsVolatile");
            IEnumeratorGeneric    = new PredefinedType(module, MemberKind.Interface, "System.Collections.Generic", "IEnumerator", 1);
            IListGeneric          = new PredefinedType(module, MemberKind.Interface, "System.Collections.Generic", "IList", 1);
            ICollectionGeneric    = new PredefinedType(module, MemberKind.Interface, "System.Collections.Generic", "ICollection", 1);
            IEnumerableGeneric    = new PredefinedType(module, MemberKind.Interface, "System.Collections.Generic", "IEnumerable", 1);
            Nullable              = new PredefinedType(module, MemberKind.Struct, "System", "Nullable", 1);
            Activator             = new PredefinedType(module, MemberKind.Class, "System", "Activator");
            Interlocked           = new PredefinedType(module, MemberKind.Class, "System.Threading", "Interlocked");
            Monitor               = new PredefinedType(module, MemberKind.Class, "System.Threading", "Monitor");
            NotSupportedException = new PredefinedType(module, MemberKind.Class, "System", "NotSupportedException");
            RuntimeFieldHandle    = new PredefinedType(module, MemberKind.Struct, "System", "RuntimeFieldHandle");
            RuntimeMethodHandle   = new PredefinedType(module, MemberKind.Struct, "System", "RuntimeMethodHandle");
            SecurityAction        = new PredefinedType(module, MemberKind.Enum, "System.Security.Permissions", "SecurityAction");

            Expression          = new PredefinedType(module, MemberKind.Class, "System.Linq.Expressions", "Expression");
            ExpressionGeneric   = new PredefinedType(module, MemberKind.Class, "System.Linq.Expressions", "Expression", 1);
            ParameterExpression = new PredefinedType(module, MemberKind.Class, "System.Linq.Expressions", "ParameterExpression");
            FieldInfo           = new PredefinedType(module, MemberKind.Class, "System.Reflection", "FieldInfo");
            MethodBase          = new PredefinedType(module, MemberKind.Class, "System.Reflection", "MethodBase");
            MethodInfo          = new PredefinedType(module, MemberKind.Class, "System.Reflection", "MethodInfo");
            ConstructorInfo     = new PredefinedType(module, MemberKind.Class, "System.Reflection", "ConstructorInfo");

            CallSite        = new PredefinedType(module, MemberKind.Class, "System.Runtime.CompilerServices", "CallSite");
            CallSiteGeneric = new PredefinedType(module, MemberKind.Class, "System.Runtime.CompilerServices", "CallSite", 1);
            Binder          = new PredefinedType(module, MemberKind.Class, "Microsoft.CSharp.RuntimeBinder", "Binder");
            BinderFlags     = new PredefinedType(module, MemberKind.Enum, "Microsoft.CSharp.RuntimeBinder", "CSharpBinderFlags");

            //
            // Define types which are used for comparison. It does not matter
            // if they don't exist as no error report is needed
            //
            TypedReference.Define();
            ArgIterator.Define();
            MarshalByRefObject.Define();
            CharSet.Define();

            IEnumerableGeneric.Define();
            IListGeneric.Define();
            ICollectionGeneric.Define();
            IEnumerableGeneric.Define();
            IEnumeratorGeneric.Define();
            Nullable.Define();
            ExpressionGeneric.Define();

            // Deal with obsolete static types
            // TODO: remove
            TypeManager.typed_reference_type     = TypedReference.TypeSpec;
            TypeManager.arg_iterator_type        = ArgIterator.TypeSpec;
            TypeManager.mbr_type                 = MarshalByRefObject.TypeSpec;
            TypeManager.generic_ilist_type       = IListGeneric.TypeSpec;
            TypeManager.generic_icollection_type = ICollectionGeneric.TypeSpec;
            TypeManager.generic_ienumerator_type = IEnumeratorGeneric.TypeSpec;
            TypeManager.generic_ienumerable_type = IEnumerableGeneric.TypeSpec;
            TypeManager.generic_nullable_type    = Nullable.TypeSpec;
            TypeManager.expression_type          = ExpressionGeneric.TypeSpec;
        }
 public PredefinedMember(ModuleContainer module, PredefinedType type, string name, MemberKind kind, params PredefinedType[] types)
     : this(module, type, new MemberFilter(name, 0, kind, null, null))
 {
     parameters_predefined = types;
 }