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

                return(changed ?
                       new AnonymousDelegatePublicSymbol(Manager, typeDescr) :
                       this);
            }
コード例 #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));
        }
コード例 #4
0
            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)));
            }
コード例 #5
0
        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
            }
        }
コード例 #6
0
 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;
 }
コード例 #7
0
ファイル: TypeUnification.cs プロジェクト: GuilhermeSa/roslyn
        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;
        }
コード例 #8
0
ファイル: TypeWithModifiers.cs プロジェクト: GStoob/roslyn
        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
            }
        }
コード例 #9
0
        internal override ErrorTypeSymbol Substitute(AbstractTypeMap typeMap)
        {
            TypeSymbol substitutedReferencedType = typeMap.SubstituteType(_referencedType);

            return(substitutedReferencedType == _referencedType ? this : new ByRefReturnErrorTypeSymbol(substitutedReferencedType));
        }
コード例 #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)));
 }
コード例 #11
0
ファイル: ErrorTypeSymbol.cs プロジェクト: zyonet/roslyn
 /// <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)));
 }
コード例 #12
0
 internal override ErrorTypeSymbol Substitute(AbstractTypeMap typeMap)
 {
     TypeSymbol substitutedReferencedType = typeMap.SubstituteType(this.referencedType);
     return substitutedReferencedType == this.referencedType ? this : new ByRefReturnErrorTypeSymbol(substitutedReferencedType);
 }
コード例 #13
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 ErrorTypeSymbol Substitute(AbstractTypeMap typeMap)
 {
     return((ErrorTypeSymbol)typeMap.SubstituteNamedType(this));
 }
コード例 #14
0
 internal abstract AnonymousTypeOrDelegatePublicSymbol SubstituteTypes(AbstractTypeMap typeMap);
コード例 #15
0
ファイル: ErrorTypeSymbol.cs プロジェクト: sanilpaul/roslyn
 /// <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)));
 }