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 } }
/// <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)); }
/// <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))); }