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);
 }
            internal override AnonymousTypeOrDelegatePublicSymbol SubstituteTypes(AbstractTypeMap map)
            {
                var typeDescr = TypeDescriptor.SubstituteTypes(map, out bool changed);

                return(changed ?
                       new AnonymousDelegatePublicSymbol(Manager, typeDescr) :
                       this);
            }
Beispiel #3
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));
        }
            internal override AnonymousTypeOrDelegatePublicSymbol SubstituteTypes(AbstractTypeMap map)
            {
                var oldFieldTypes = TypeDescriptor.Fields.SelectAsArray(f => f.TypeWithAnnotations);
                var newFieldTypes = map.SubstituteTypes(oldFieldTypes);

                return((oldFieldTypes == newFieldTypes) ?
                       this :
                       new AnonymousTypePublicSymbol(Manager, TypeDescriptor.WithNewFieldsTypes(newFieldTypes)));
            }
        public TypeWithModifiers SubstituteType(AbstractTypeMap typeMap)
        {
            var newTypeWithModifiers = typeMap.SubstituteType(this.Type);

            if (!newTypeWithModifiers.Is(this.Type))
            {
                return(new TypeWithModifiers(newTypeWithModifiers.Type, this.CustomModifiers.Concat(newTypeWithModifiers.CustomModifiers)));
            }
            else
            {
                return(this); // substitution had no effect on the type
            }
        }
 private static TypeSymbol SubstituteAllTypeParameters(AbstractTypeMap substitution, TypeSymbol type)
 {
     if (substitution != null)
     {
         TypeSymbol previous;
         do
         {
             previous = type;
             type = substitution.SubstituteType(type);
         } while (type != previous);
     }
     return type;
 }
Beispiel #7
0
        private static TypeWithModifiers SubstituteAllTypeParameters(AbstractTypeMap substitution, TypeWithModifiers type)
        {
            if (substitution != null)
            {
                TypeWithModifiers previous;
                do
                {
                    previous = type;
                    type = type.SubstituteType(substitution);
                } while (type != previous);
            }

            return type;
        }
Beispiel #8
0
        public TypeWithModifiers SubstituteTypeWithTupleUnification(AbstractTypeMap typeMap)
        {
            var newCustomModifiers   = typeMap.SubstituteCustomModifiers(this.CustomModifiers);
            var newTypeWithModifiers = typeMap.SubstituteTypeWithTupleUnification(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
            }
        }
Beispiel #9
0
        internal override ErrorTypeSymbol Substitute(AbstractTypeMap typeMap)
        {
            TypeSymbol substitutedReferencedType = typeMap.SubstituteType(_referencedType);

            return(substitutedReferencedType == _referencedType ? this : new ByRefReturnErrorTypeSymbol(substitutedReferencedType));
        }
Beispiel #10
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)));
 }
Beispiel #11
0
 /// <summary>
 /// Called by <see cref="AbstractTypeMap.SubstituteType(TypeSymbol)"/> 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 TypeSymbolWithAnnotations Substitute(AbstractTypeMap typeMap)
 {
     return(TypeSymbolWithAnnotations.Create(typeMap.SubstituteNamedType(this)));
 }
 internal override ErrorTypeSymbol Substitute(AbstractTypeMap typeMap)
 {
     TypeSymbol substitutedReferencedType = typeMap.SubstituteType(this.referencedType);
     return substitutedReferencedType == this.referencedType ? this : new ByRefReturnErrorTypeSymbol(substitutedReferencedType);
 }
 /// <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 ErrorTypeSymbol Substitute(AbstractTypeMap typeMap)
 {
     return((ErrorTypeSymbol)typeMap.SubstituteNamedType(this));
 }
Beispiel #14
0
 internal abstract AnonymousTypeOrDelegatePublicSymbol SubstituteTypes(AbstractTypeMap typeMap);
Beispiel #15
0
 /// <summary>
 /// Called by <see cref="AbstractTypeMap.SubstituteType(TypeSymbol)"/> 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 TypeSymbolWithAnnotations Substitute(AbstractTypeMap typeMap)
 {
     return(TypeSymbolWithAnnotations.Create(NonNullTypesNullContext.Instance, (ErrorTypeSymbol)typeMap.SubstituteNamedType(this)));
 }