Abstract base class for mutable and immutable type maps.
Ejemplo n.º 1
0
        public TypeWithModifiers SubstituteType(AbstractTypeMap typeMap)
        {
            var newCustomModifiers   = typeMap.SubstituteCustomModifiers(this.CustomModifiers);
            var newTypeWithModifiers = typeMap.SubstituteType(this.Type);

            if (!newTypeWithModifiers.Is(this.Type) || newCustomModifiers != this.CustomModifiers)
            {
                return(new TypeWithModifiers(newTypeWithModifiers.Type, newCustomModifiers.Concat(newTypeWithModifiers.CustomModifiers)));
            }
            else
            {
                return(this); // substitution had no effect on the type or modifiers
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Called by <see cref="AbstractTypeMap.SubstituteType"/> to perform substitution
 /// on types with TypeKind ErrorType.  The general pattern is to use the type map
 /// to perform substitution on the wrapped type, if any, and then construct a new
 /// error type symbol from the result (if there was a change).
 /// </summary>
 internal virtual TypeWithModifiers Substitute(AbstractTypeMap typeMap)
 {
     return new TypeWithModifiers((ErrorTypeSymbol)typeMap.SubstituteNamedType(this));
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Called by <see cref="AbstractTypeMap.SubstituteType"/> to perform substitution
 /// on types with TypeKind ErrorType.  The general pattern is to use the type map
 /// to perform substitution on the wrapped type, if any, and then construct a new
 /// error type symbol from the result (if there was a change).
 /// </summary>
 internal virtual TypeWithModifiers Substitute(AbstractTypeMap typeMap)
 {
     return(new TypeWithModifiers((ErrorTypeSymbol)typeMap.SubstituteNamedType(this)));
 }