当前位置: 首页>>代码示例>>C#>>正文


C# Symbols.TypeParameterSymbol类代码示例

本文整理汇总了C#中Microsoft.CodeAnalysis.CSharp.Symbols.TypeParameterSymbol的典型用法代码示例。如果您正苦于以下问题:C# TypeParameterSymbol类的具体用法?C# TypeParameterSymbol怎么用?C# TypeParameterSymbol使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TypeParameterSymbol类属于Microsoft.CodeAnalysis.CSharp.Symbols命名空间,在下文中一共展示了TypeParameterSymbol类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RetargetingTypeParameterSymbol

        public RetargetingTypeParameterSymbol(RetargetingModuleSymbol retargetingModule, TypeParameterSymbol underlyingTypeParameter)
            : base(underlyingTypeParameter)
        {
            Debug.Assert((object)retargetingModule != null);
            Debug.Assert(!(underlyingTypeParameter is RetargetingTypeParameterSymbol));

            _retargetingModule = retargetingModule;
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:8,代码来源:RetargetingTypeParameterSymbol.cs

示例2: DependsOn

        public static bool DependsOn(this TypeParameterSymbol typeParameter1, TypeParameterSymbol typeParameter2)
        {
            Debug.Assert((object)typeParameter1 != null);
            Debug.Assert((object)typeParameter2 != null);

            Func<TypeParameterSymbol, IEnumerable<TypeParameterSymbol>> dependencies = x => x.ConstraintTypesNoUseSiteDiagnostics.OfType<TypeParameterSymbol>();
            return dependencies.TransitiveClosure(typeParameter1).Contains(typeParameter2);
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:8,代码来源:TypeParameterSymbolExtensions.cs

示例3: SubstitutedTypeParameterSymbol

 internal SubstitutedTypeParameterSymbol(Symbol newContainer, TypeMap map, TypeParameterSymbol substitutedFrom)
 {
     _container = newContainer;
     // it is important that we don't use the map here in the constructor, as the map is still being filled
     // in by TypeMap.WithAlphaRename.  Instead, we can use the map lazily when yielding the constraints.
     _map = map;
     _substitutedFrom = substitutedFrom;
 }
开发者ID:ehsansajjad465,项目名称:roslyn,代码行数:8,代码来源:SubstitutedTypeParameterSymbol.cs

示例4: RetargetingTypeParameterSymbol

        public RetargetingTypeParameterSymbol(RetargetingModuleSymbol retargetingModule, TypeParameterSymbol underlyingTypeParameter)
        {
            Debug.Assert((object)retargetingModule != null);
            Debug.Assert((object)underlyingTypeParameter != null);
            Debug.Assert(!(underlyingTypeParameter is RetargetingTypeParameterSymbol));

            this.retargetingModule = retargetingModule;
            this.underlyingTypeParameter = underlyingTypeParameter;
        }
开发者ID:EkardNT,项目名称:Roslyn,代码行数:9,代码来源:RetargetingTypeParameterSymbol.cs

示例5: SubstituteTypeParameter

        protected sealed override TypeSymbol SubstituteTypeParameter(TypeParameterSymbol typeParameter)
        {
            // It might need to be substituted directly.
            TypeSymbol result;
            if (Mapping.TryGetValue(typeParameter, out result))
            {
                return result;
            }

            return typeParameter;
        }
开发者ID:GloryChou,项目名称:roslyn,代码行数:11,代码来源:AbstractTypeParameterMap.cs

示例6: SubstituteTypeParameter

        protected sealed override TypeWithModifiers SubstituteTypeParameter(TypeParameterSymbol typeParameter)
        {
            // It might need to be substituted directly.
            TypeWithModifiers result;
            if (Mapping.TryGetValue(typeParameter, out result))
            {
                return result;
            }

            return new TypeWithModifiers(typeParameter);
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:11,代码来源:AbstractTypeParameterMap.cs

示例7: EETypeParameterSymbol

 public EETypeParameterSymbol(
     Symbol container,
     TypeParameterSymbol sourceTypeParameter,
     int ordinal,
     Func<TypeMap> getTypeMap)
 {
     Debug.Assert((container.Kind == SymbolKind.NamedType) || (container.Kind == SymbolKind.Method));
     _container = container;
     _sourceTypeParameter = sourceTypeParameter;
     _ordinal = ordinal;
     _getTypeMap = getTypeMap;
 }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:12,代码来源:EETypeParameterSymbol.cs

示例8: SubstitutedTypeParameterSymbol

        internal SubstitutedTypeParameterSymbol(Symbol newContainer, TypeMap map, TypeParameterSymbol substitutedFrom, int ordinal)
        {
            _container = newContainer;
            // it is important that we don't use the map here in the constructor, as the map is still being filled
            // in by TypeMap.WithAlphaRename.  Instead, we can use the map lazily when yielding the constraints.
            _map = map;
            _substitutedFrom = substitutedFrom;
            _ordinal = ordinal;
#if DEBUG_ALPHA
            _mySequence = _nextSequence++;
#endif
        }
开发者ID:rafaellincoln,项目名称:roslyn,代码行数:12,代码来源:SubstitutedTypeParameterSymbol.cs

示例9: SubstituteTypeParameter

        protected sealed override TypeWithModifiers SubstituteTypeParameter(TypeParameterSymbol typeParameter)
        {
            // It might need to be substituted directly.
            TypeWithModifiers result;
            if (Mapping.TryGetValue(typeParameter, out result))
            {
                if (typeParameter.NullabilityPreservation == CodeAnalysis.Symbols.NullabilityPreservationKind.None && result.Type.Kind == SymbolKind.NonNullableReference)
                {
                    return new TypeWithModifiers(((NonNullableReferenceTypeSymbol)result.Type).UnderlyingType);
                }
                return result;
            }

            return new TypeWithModifiers(typeParameter);
        }
开发者ID:jeffanders,项目名称:roslyn,代码行数:15,代码来源:AbstractTypeParameterMap.cs

示例10: SynthesizedContainer

        /// <summary>
        /// Used for <see cref="SynthesizedDelegateSymbol"/> construction.
        /// </summary>
        protected SynthesizedContainer(NamespaceOrTypeSymbol containingSymbol, string name, int parameterCount, bool returnsVoid)
        {
            var typeParameters = new TypeParameterSymbol[parameterCount + (returnsVoid ? 0 : 1)];
            for (int i = 0; i < parameterCount; i++)
            {
                typeParameters[i] = new AnonymousTypeManager.AnonymousTypeParameterSymbol(this, i, "T" + (i + 1));
            }

            if (!returnsVoid)
            {
                typeParameters[parameterCount] = new AnonymousTypeManager.AnonymousTypeParameterSymbol(this, parameterCount, "TResult");
            }

            this.containingSymbol = containingSymbol;
            this.name = name;
            this.TypeMap = TypeMap.Empty;
            this.typeParameters = typeParameters.AsImmutableOrNull();
        }
开发者ID:riversky,项目名称:roslyn,代码行数:21,代码来源:SynthesizedContainer.cs

示例11: GrowPool

        private static void GrowPool(int count)
        {
            var initialPool = s_parameterPool;
            while (count > initialPool.Length)
            {
                var newPoolSize = ((count + 0x0F) & ~0xF); // grow in increments of 16
                var newPool = new TypeParameterSymbol[newPoolSize];

                Array.Copy(initialPool, newPool, initialPool.Length);

                for (int i = initialPool.Length; i < newPool.Length; i++)
                {
                    newPool[i] = new IndexedTypeParameterSymbol(i);
                }

                Interlocked.CompareExchange(ref s_parameterPool, newPool, initialPool);

                // repeat if race condition occurred and someone else resized the pool before us
                // and the new pool is still too small
                initialPool = s_parameterPool;
            }
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:22,代码来源:IndexedTypeParameterSymbol.cs

示例12: Contains

        /// <summary>
        /// Return true if the given type contains the specified type parameter.
        /// </summary>
        private static bool Contains(TypeSymbol type, TypeParameterSymbol typeParam)
        {
            switch (type.Kind)
            {
                case SymbolKind.ArrayType:
                    return Contains(((ArrayTypeSymbol)type).ElementType, typeParam);
                case SymbolKind.PointerType:
                    return Contains(((PointerTypeSymbol)type).PointedAtType, typeParam);
                case SymbolKind.NamedType:
                case SymbolKind.ErrorType:
                    {
                        NamedTypeSymbol namedType = (NamedTypeSymbol)type;
                        while ((object)namedType != null)
                        {
                            ImmutableArray<TypeSymbol> typeParts = namedType.IsTupleType ? namedType.TupleElementTypes : namedType.TypeArgumentsNoUseSiteDiagnostics;
                            foreach (TypeSymbol typePart in typeParts)
                            {
                                if (Contains(typePart, typeParam))
                                {
                                    return true;
                                }
                            }
                            namedType = namedType.ContainingType;
                        }

                        return false;
                    }
                case SymbolKind.TypeParameter:
                    return type == typeParam;
                default:
                    return false;
            }
        }
开发者ID:GuilhermeSa,项目名称:roslyn,代码行数:36,代码来源:TypeUnification.cs

示例13: AddSubstitution

        private static void AddSubstitution(ref MutableTypeMap substitution, TypeParameterSymbol tp1, TypeWithModifiers t2)
        {
            if (substitution == null)
            {
                substitution = new MutableTypeMap();
            }

            // MutableTypeMap.Add will throw if the key has already been added.  However,
            // if t1 was already in the substitution, it would have been substituted at the
            // start of CanUnifyHelper and we wouldn't be here.
            substitution.Add(tp1, t2);
        }
开发者ID:GuilhermeSa,项目名称:roslyn,代码行数:12,代码来源:TypeUnification.cs

示例14: GenerateConflictingConstraintsError

 private static TypeParameterDiagnosticInfo GenerateConflictingConstraintsError(TypeParameterSymbol typeParameter, TypeSymbol deducedBase, bool classConflict)
 {
     // "Type parameter '{0}' inherits conflicting constraints '{1}' and '{2}'"
     return new TypeParameterDiagnosticInfo(typeParameter, new CSDiagnosticInfo(ErrorCode.ERR_BaseConstraintConflict, typeParameter, deducedBase, classConflict ? "class" : "struct"));
 }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:5,代码来源:ConstraintsHelper.cs

示例15: IsValueType

 private static bool IsValueType(TypeParameterSymbol typeParameter, ImmutableArray<TypeSymbol> constraintTypes)
 {
     return typeParameter.HasValueTypeConstraint || TypeParameterSymbol.IsValueTypeFromConstraintTypes(constraintTypes);
 }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:4,代码来源:ConstraintsHelper.cs


注:本文中的Microsoft.CodeAnalysis.CSharp.Symbols.TypeParameterSymbol类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。