Esempio n. 1
0
        internal override TypeWithModifiers Substitute(AbstractTypeMap typeMap)
        {
            TypeWithModifiers substitutedReferencedType = typeMap.SubstituteType(_referencedType);

            return(substitutedReferencedType.Is(_referencedType) ?
                   new TypeWithModifiers(this) :
                   new TypeWithModifiers(new ByRefReturnErrorTypeSymbol(substitutedReferencedType.Type, _countOfCustomModifiersPrecedingByRef),
                                         substitutedReferencedType.CustomModifiers));
        }
Esempio n. 2
0
 internal TypeMap(NamedTypeSymbol containingType, ImmutableArray <TypeParameterSymbol> typeParameters, ImmutableArray <TypeWithModifiers> typeArguments)
     : base(ForType(containingType))
 {
     for (int i = 0; i < typeParameters.Length; i++)
     {
         TypeParameterSymbol tp = typeParameters[i];
         TypeWithModifiers   ta = typeArguments[i];
         if (!ta.Is(tp))
         {
             Mapping.Add(tp, ta);
         }
     }
 }
Esempio n. 3
0
        private static SmallDictionary <TypeParameterSymbol, TypeWithModifiers> ConstructMapping(ImmutableArray <TypeParameterSymbol> from, ImmutableArray <TypeWithModifiers> to)
        {
            var mapping = new SmallDictionary <TypeParameterSymbol, TypeWithModifiers>(ReferenceEqualityComparer.Instance);

            Debug.Assert(from.Length == to.Length);

            for (int i = 0; i < from.Length; i++)
            {
                TypeParameterSymbol tp = from[i];
                TypeWithModifiers   ta = to[i];
                if (!ta.Is(tp))
                {
                    mapping.Add(tp, ta);
                }
            }

            return(mapping);
        }