Ejemplo n.º 1
0
 public GenericConstructionChecker(TypeSystemServices tss, Node constructionNode, IType[] typeArguments, CompilerErrorCollection errorCollection)
 {
     _tss = tss;
     _constructionNode = constructionNode;
     _typeArguments = typeArguments;
     _errors = errorCollection;
 }
Ejemplo n.º 2
0
 public GenericConstructionChecker(TypeSystemServices tss, Node constructionNode, TypeReferenceCollection argumentNodes, CompilerErrorCollection errorCollection)
 {
     _tss = tss;
     _constructionNode = constructionNode;
     _argumentNodes = argumentNodes;
     _errors = errorCollection;
 }
Ejemplo n.º 3
0
 public ArrayType(TypeSystemServices tagManager, IType elementType, int rank)
 {
     _array = tagManager.ArrayType;
     _elementType = elementType;
     _rank = rank;
     _enumerable = tagManager.IEnumerableGenericType;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Constrcuts a new GenericMapping for a specific mapping of generic parameters to type arguments.
 /// </summary>
 /// <param name="parameters">The generic parameters that should be mapped.</param>
 /// <param name="arguments">The type arguments to map generic parameters to.</param>
 protected GenericMapping(TypeSystemServices tss, IGenericParameter[] parameters, IType[] arguments)
 {
     _tss = tss;
     for (int i = 0; i < parameters.Length; i++)
     {
         _map.Add(parameters[i], arguments[i]);
     }
 }
Ejemplo n.º 5
0
 public ExternalGenericParameter(TypeSystemServices tss, Type type)
     : base(tss, type)
 {
     if (type.DeclaringMethod != null)
     {
         _declaringMethod = (IMethod)tss.Map(type.DeclaringMethod);
     }
 }
Ejemplo n.º 6
0
        public NamespaceEntity(INamespace parent, TypeSystemServices tagManager, string name)
        {
            _parent = parent;
            _typeSystemServices = tagManager;
            _name = name;
			_assemblies = new Dictionary<Assembly, Dictionary<string, List<Type>>>(AssemblyEqualityComparer.Default);
            _childrenNamespaces = new Dictionary<string, NamespaceEntity>();
            _internalModules = new List<ModuleEntity>();
            _externalModules = new List<ExternalType>();
Ejemplo n.º 7
0
 public ModuleEntity(NameResolutionService nameResolutionService,
     TypeSystemServices typeSystemServices,
     Module module)
 {
     _nameResolutionService = nameResolutionService;
     _typeSystemServices = typeSystemServices;
     _module = module;
     _namespace = SafeNamespace(module);
 }
Ejemplo n.º 8
0
        public GenericConstructedMethod(TypeSystemServices tss, IMethod definition, IType[] arguments)
        {
            _tss = tss;
            _definition = definition;
            _genericArguments = arguments;

            _genericMapping = new GenericMapping(tss, this, arguments);

            _fullyConstructed = IsFullyConstructed();
        }
Ejemplo n.º 9
0
        public InternalGenericParameter(TypeSystemServices tss, GenericParameterDeclaration declaration)
        {
            _tss = tss;
            _declaration = declaration;

            // Determine and remember declaring type and declaring method (if applicable)
            _declaringMethod = declaration.ParentNode as Method;
            _declaringType = (
                _declaringMethod == null ?
                declaration.ParentNode as TypeDefinition : _declaringMethod.DeclaringType);
        }
Ejemplo n.º 10
0
 internal AnonymousCallableType(TypeSystemServices services, CallableSignature signature)
 {
     if (null == services)
     {
         throw new ArgumentNullException("services");
     }
     if (null == signature)
     {
         throw new ArgumentNullException("signature");
     }
     _typeSystemServices = services;
     _signature = signature;
 }
Ejemplo n.º 11
0
 internal InternalMethod(TypeSystemServices typeSystemServices, Method method)
 {
     _typeSystemServices = typeSystemServices;
     _method = method;
     if (method.NodeType != NodeType.Constructor && method.NodeType != NodeType.Destructor)
     {
         if (null == _method.ReturnType)
         {
             IType returnType = _method.DeclaringType.NodeType == NodeType.ClassDefinition
                 ? Unknown.Default
                 : (IType)_typeSystemServices.VoidType;
             _method.ReturnType = _typeSystemServices.CodeBuilder.CreateTypeReference(method.LexicalInfo, returnType);
         }
     }
 }
Ejemplo n.º 12
0
 public ReferenceExpression CreateReference(ParameterDeclaration parameter)
 {
     return(CreateReference((InternalParameter)TypeSystemServices.GetEntity(parameter)));
 }
Ejemplo n.º 13
0
 public ReferenceExpression CreateReference(LexicalInfo li, System.Type type)
 {
     return(CreateReference(li, TypeSystemServices.Map(type)));
 }
Ejemplo n.º 14
0
 public TypeReference CreateTypeReference(Type type)
 {
     return(CreateTypeReference(TypeSystemServices.Map(type)));
 }
Ejemplo n.º 15
0
 public InternalGenericParameter(TypeSystemServices tss, GenericParameterDeclaration declaration, AbstractInternalType declaringType, int position)
     : this(tss, declaration, position)
 {
     _declaringType = declaringType;
 }
Ejemplo n.º 16
0
 public ExternalParameter(TypeSystemServices service, ParameterInfo parameter)
 {
     _typeSystemServices = service;
     _parameter = parameter;
 }
Ejemplo n.º 17
0
 public InternalProperty(TypeSystemServices tagManager, Property property)
 {
     _typeSystemServices = tagManager;
     _property           = property;
 }
Ejemplo n.º 18
0
 public ExternalConstructor(TypeSystemServices manager, ConstructorInfo ci) : base(manager, ci)
 {
 }
Ejemplo n.º 19
0
 public ArrayType(TypeSystemServices tagManager, IType elementType)
     : this(tagManager, elementType, 1)
 {
 }
Ejemplo n.º 20
0
 public InternalEvent(TypeSystemServices tagManager, Event event_)
 {
     _event = event_;
 }
Ejemplo n.º 21
0
 public AbstractExternalGenericInfo(TypeSystemServices tss)
 {
     _tss = tss;
 }
Ejemplo n.º 22
0
 internal ExternalMethod(TypeSystemServices manager, MethodBase mi)
 {
     _typeSystemServices = manager;
     _mi = mi;
 }
Ejemplo n.º 23
0
 private static IMethod GetNoArgsNoVoid(IEnumerable <IEntity> value, TypeSystemServices tss)
 {
     return(value.Cast <IMethod>().SingleOrDefault(m =>
                                                   ((m.GetParameters().Length == 0) || (m.IsExtension && m.GetParameters().Length == 1)) &&
                                                   m.ReturnType != tss.VoidType));
 }
Ejemplo n.º 24
0
 private static IMethod GetNoArgs(IEnumerable <IEntity> value, TypeSystemServices tss)
 {
     return(value.Cast <IMethod>().SingleOrDefault(m => m.GetParameters().Length == 0));
 }
Ejemplo n.º 25
0
 public InternalGenericParameter(TypeSystemServices tss, GenericParameterDeclaration declaration, InternalMethod declaringMethod, int position)
     : this(tss, declaration, position)
 {
     _declaringMethod = declaringMethod;
 }
Ejemplo n.º 26
0
        private int CalculateArgumentScore(IType parameterType, IType argumentType)
        {
            if (parameterType == argumentType || (TypeSystemServices.IsSystemObject(argumentType) && TypeSystemServices.IsSystemObject(parameterType)))
            {
                return(parameterType is ICallableType ? CallableExactMatchScore : ExactMatchScore);
            }

            if (TypeCompatibilityRules.IsAssignableFrom(parameterType, argumentType))
            {
                var callableType = parameterType as ICallableType;
                var callableArg  = argumentType as ICallableType;
                if (callableType != null && callableArg != null)
                {
                    return(CalculateCallableScore(callableType, callableArg));
                }
                return(UpCastScore);
            }

            if (TypeSystemServices.FindImplicitConversionOperator(argumentType, parameterType) != null)
            {
                return(ImplicitConversionScore);
            }

            if (TypeSystemServices.CanBeReachedByPromotion(parameterType, argumentType))
            {
                return(IsWideningPromotion(parameterType, argumentType) ? WideningPromotion : NarrowingPromotion);
            }

            if (MyDowncastPermissions().CanBeReachedByDowncast(parameterType, argumentType))
            {
                return(DowncastScore);
            }

            return(-1);
        }
Ejemplo n.º 27
0
 internal InternalClass(TypeSystemServices manager, TypeDefinition typeDefinition) :
     base(manager, typeDefinition)
 {
 }
Ejemplo n.º 28
0
 internal InternalEnum(TypeSystemServices tagManager, EnumDefinition enumDefinition)
     : base(tagManager, enumDefinition)
 {
 }
Ejemplo n.º 29
0
 internal ExternalType(TypeSystemServices tss, Type type)
 {
     if (null == type) throw new ArgumentException("type");
     _typeSystemServices = tss;
     _type = type;
 }
Ejemplo n.º 30
0
 public InternalProperty(TypeSystemServices typeSystemServices, Property property)
 {
     _typeSystemServices = typeSystemServices;
     _property = property;
 }
Ejemplo n.º 31
0
 public DeclarationsNamespace(INamespace parent, TypeSystemServices tagManager, DeclarationCollection declarations)
 {
     _parent = parent;
     _declarations = declarations;
 }
Ejemplo n.º 32
0
 internal InternalCallableType(TypeSystemServices typeSystemServices, TypeDefinition typeDefinition) :
     base(typeSystemServices, typeDefinition)
 {
 }
Ejemplo n.º 33
0
 internal ExternalCallableType(TypeSystemServices typeSystemServices, Type type) : base(typeSystemServices, type)
 {
     _invoke = typeSystemServices.Map(type.GetMethod("Invoke"));
 }
Ejemplo n.º 34
0
 /// <summary>
 /// Constructs a new generic mapping between a generic method and one of its constructed methods.
 /// </summary>
 public GenericMapping(TypeSystemServices tss, IMethod constructedMethod, IType[] arguments)
     : this(tss, constructedMethod.ConstructedInfo.GenericDefinition.GenericInfo.GenericParameters, arguments)
 {
     _constructedOwner = constructedMethod;
     _genericSource = constructedMethod.ConstructedInfo.GenericDefinition;
 }
Ejemplo n.º 35
0
 public MethodInvocationExpression CreateMethodInvocation(MethodInfo staticMethod, Expression arg0, Expression arg1)
 {
     return(CreateMethodInvocation(TypeSystemServices.Map(staticMethod), arg0, arg1));
 }
Ejemplo n.º 36
0
 public InternalGenericMethod(TypeSystemServices tss, Method method)
     : base(tss, method)
 {
 }
Ejemplo n.º 37
0
 public TypeReference CreateTypeReference(LexicalInfo li, Type type)
 {
     return(CreateTypeReference(li, TypeSystemServices.Map(type)));
 }
 public ExternalGenericMethodDefinitionInfo(TypeSystemServices tss, ExternalMethod method) :     base(tss)
 {
     _method = method;
 }
Ejemplo n.º 39
0
 public BinaryExpression CreateAssignment(Expression lhs, Expression rhs)
 {
     return(CreateBoundBinaryExpression(TypeSystemServices.GetExpressionType(lhs), BinaryOperatorType.Assign, lhs, rhs));
 }
Ejemplo n.º 40
0
 internal InternalInterface(TypeSystemServices manager, TypeDefinition typeDefinition)
     : base(manager, typeDefinition)
 {
 }
Ejemplo n.º 41
0
 protected IType ArgumentType(Expression e)
 {
     return(TypeSystemServices.GetExpressionType(e));
 }
Ejemplo n.º 42
0
 internal InternalCallableType(TypeSystemServices typeSystemServices, TypeDefinition typeDefinition)
     : base(typeSystemServices, typeDefinition)
 {
 }
Ejemplo n.º 43
0
        public InternalConstructor(TypeSystemServices typeSystemServices,
		                           Constructor constructor)
            : base(typeSystemServices, constructor)
        {
        }
Ejemplo n.º 44
0
 public ExternalEntity(TypeSystemServices typeSystemServices, T memberInfo)
 {
     _typeSystemServices = typeSystemServices;
     _memberInfo         = memberInfo;
 }
Ejemplo n.º 45
0
 public ExternalParameter(TypeSystemServices service, ParameterInfo parameter)
 {
     _typeSystemServices = service;
     _parameter          = parameter;
 }
Ejemplo n.º 46
0
 public InternalEnumMember(TypeSystemServices tagManager, EnumMember member)
 {
     _member = member;
 }
Ejemplo n.º 47
0
 public ExternalConstructor(TypeSystemServices manager, ConstructorInfo ci)
     : base(manager, ci)
 {
 }
Ejemplo n.º 48
0
 internal VoidTypeImpl(TypeSystemServices typeSystemServices)
     : base(typeSystemServices, Types.Void)
 {
 }
Ejemplo n.º 49
0
 protected AbstractInternalType(TypeSystemServices typeSystemServices, TypeDefinition typeDefinition)
 {
     _typeSystemServices = typeSystemServices;
     _typeDefinition     = typeDefinition;
 }
Ejemplo n.º 50
0
 public InternalGenericParameter(TypeSystemServices tss, GenericParameterDeclaration declaration, int position)
     : this(tss, declaration)
 {
     _position = position;
 }
Ejemplo n.º 51
0
 internal InternalEnum(TypeSystemServices tagManager, EnumDefinition enumDefinition) :
     base(tagManager, enumDefinition)
 {
 }
Ejemplo n.º 52
0
 public RaiseStatement RaiseException(LexicalInfo lexicalInfo, IConstructor exceptionConstructor, params Expression[] args)
 {
     Debug.Assert(TypeSystemServices.IsValidException(exceptionConstructor.DeclaringType));
     return(new RaiseStatement(lexicalInfo, CreateConstructorInvocation(lexicalInfo, exceptionConstructor, args)));
 }
Ejemplo n.º 53
0
 public DeclarationsNamespace(INamespace parent, TypeSystemServices tagManager, Declaration declaration)
 {
     _parent = parent;
     _declarations = new DeclarationCollection();
     _declarations.Add(declaration);
 }
Ejemplo n.º 54
0
 public Expression CreateTypeofExpression(System.Type type)
 {
     return(CreateTypeofExpression(TypeSystemServices.Map(type)));
 }
Ejemplo n.º 55
0
 public ExternalConstructedTypeInfo(TypeSystemServices tss, ExternalType type)
 {
     _type = type;
     _tss  = tss;
 }
Ejemplo n.º 56
0
 public MethodInvocationExpression CreateMethodInvocation(Expression target, MethodInfo method)
 {
     return(CreateMethodInvocation(target, TypeSystemServices.Map(method)));
 }
Ejemplo n.º 57
0
 internal ExternalCallableType(TypeSystemServices typeSystemServices, Type type)
     : base(typeSystemServices, type)
 {
     _invoke = typeSystemServices.Map(type.GetMethod("Invoke"));
 }
Ejemplo n.º 58
0
 public ExternalConstructedMethodInfo(TypeSystemServices tss, ExternalMethod method)
 {
     _method = method;
     _tss    = tss;
 }
 public ExternalConstructedTypeInfo(TypeSystemServices tss, ExternalType type)
 {
     _type = type;
     _tss = tss;
 }
Ejemplo n.º 60
0
 public ExternalGenericTypeInfo(TypeSystemServices tss, ExternalType type) : base(tss)
 {
     _type = type;
 }