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


C# Symbols.NamedTypeSymbol类代码示例

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


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

示例1: AnonymousTypeEqualsMethodSymbol

 internal AnonymousTypeEqualsMethodSymbol(NamedTypeSymbol container)
     : base(container, WellKnownMemberNames.ObjectEquals)
 {
     _parameters = ImmutableArray.Create<ParameterSymbol>(
                           SynthesizedParameterSymbol.Create(this, this.Manager.System_Object, 0, RefKind.None, "value")
                       );
 }
开发者ID:GuilhermeSa,项目名称:roslyn,代码行数:7,代码来源:AnonymousType.EqualsMethodSymbol.cs

示例2: SynthesizedEntryPointSymbol

        internal SynthesizedEntryPointSymbol(NamedTypeSymbol containingType, TypeSymbol returnType, DiagnosticBag diagnostics)
        {
            Debug.Assert((object)containingType != null);
            this.containingType = containingType;

            if (containingType.ContainingAssembly.IsInteractive)
            {
                var interactiveSessionType = this.DeclaringCompilation.GetWellKnownType(WellKnownType.Microsoft_CSharp_RuntimeHelpers_Session);
                var useSiteDiagnostic = interactiveSessionType.GetUseSiteDiagnostic();
                if (useSiteDiagnostic != null)
                {
                    Symbol.ReportUseSiteDiagnostic(useSiteDiagnostic, diagnostics, NoLocation.Singleton);
                }

                this.parameters = ImmutableArray.Create<ParameterSymbol>(new SynthesizedParameterSymbol(this, interactiveSessionType, 0, RefKind.None, "session"));
                this.name = "<Factory>";
            }
            else
            {
                this.parameters = ImmutableArray<ParameterSymbol>.Empty;
                this.name = "<Main>";
            }

            this.returnType = returnType;
        }
开发者ID:riversky,项目名称:roslyn,代码行数:25,代码来源:SynthesizedEntryPointSymbol.cs

示例3: RegisterDeclaredSpecialType

        /// <summary>
        /// Register declaration of predefined CorLib type in this Assembly.
        /// </summary>
        /// <param name="corType"></param>
        internal override sealed void RegisterDeclaredSpecialType(NamedTypeSymbol corType)
        {
            SpecialType typeId = corType.SpecialType;
            Debug.Assert(typeId != SpecialType.None);
            Debug.Assert(ReferenceEquals(corType.ContainingAssembly, this));
            Debug.Assert(corType.ContainingModule.Ordinal == 0);
            Debug.Assert(ReferenceEquals(this.CorLibrary, this));

            if (_lazySpecialTypes == null)
            {
                Interlocked.CompareExchange(ref _lazySpecialTypes,
                    new NamedTypeSymbol[(int)SpecialType.Count + 1], null);
            }

            if ((object)Interlocked.CompareExchange(ref _lazySpecialTypes[(int)typeId], corType, null) != null)
            {
                Debug.Assert(ReferenceEquals(corType, _lazySpecialTypes[(int)typeId]) ||
                                        (corType.Kind == SymbolKind.ErrorType &&
                                        _lazySpecialTypes[(int)typeId].Kind == SymbolKind.ErrorType));
            }
            else
            {
                Interlocked.Increment(ref _cachedSpecialTypes);
                Debug.Assert(_cachedSpecialTypes > 0 && _cachedSpecialTypes <= (int)SpecialType.Count);
            }
        }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:30,代码来源:MetadataOrSourceAssemblySymbol.cs

示例4: SynthesizedEntryPointSymbol

        internal SynthesizedEntryPointSymbol(NamedTypeSymbol containingType, TypeSymbol returnType, DiagnosticBag diagnostics)
        {
            Debug.Assert((object)containingType != null);
            _containingType = containingType;

            if (containingType.ContainingAssembly.IsInteractive)
            {
                var submissionArrayType = this.DeclaringCompilation.CreateArrayTypeSymbol(this.DeclaringCompilation.GetSpecialType(SpecialType.System_Object));
                var useSiteDiagnostic = submissionArrayType.GetUseSiteDiagnostic();
                if (useSiteDiagnostic != null)
                {
                    Symbol.ReportUseSiteDiagnostic(useSiteDiagnostic, diagnostics, NoLocation.Singleton);
                }

                _parameters = ImmutableArray.Create<ParameterSymbol>(new SynthesizedParameterSymbol(this, submissionArrayType, 0, RefKind.None, "submissionArray"));
                _name = "<Factory>";
            }
            else
            {
                _parameters = ImmutableArray<ParameterSymbol>.Empty;
                _name = "<Main>";
            }

            if (this.DeclaringCompilation.IsSubmission)
            {
                returnType = this.DeclaringCompilation.GetSpecialType(SpecialType.System_Object);
            }

            _returnType = returnType;
        }
开发者ID:GloryChou,项目名称:roslyn,代码行数:30,代码来源:SynthesizedEntryPointSymbol.cs

示例5: SynthesizedLambdaMethod

            internal SynthesizedLambdaMethod(NamedTypeSymbol containingType, MethodSymbol topLevelMethod, BoundLambda node, bool isStatic, TypeCompilationState compilationState)
                : base(containingType,
                       node.Symbol,
                       null,
                       node.SyntaxTree.GetReference(node.Body.Syntax),
                       node.Syntax.GetLocation(),
                       GeneratedNames.MakeLambdaMethodName(topLevelMethod.Name, compilationState.GenerateTempNumber()),
                       (containingType is LambdaFrame ? DeclarationModifiers.Internal : DeclarationModifiers.Private)
                            | (isStatic ? DeclarationModifiers.Static : 0)
                            | (node.Symbol.IsAsync ? DeclarationModifiers.Async : 0))
            {
                TypeMap typeMap;
                ImmutableArray<TypeParameterSymbol> typeParameters;
                LambdaFrame lambdaFrame;

                if (!topLevelMethod.IsGenericMethod)
                {
                    typeMap = TypeMap.Empty;
                    typeParameters = ImmutableArray<TypeParameterSymbol>.Empty;
                }
                else if ((object)(lambdaFrame = this.ContainingType as LambdaFrame) != null)
                {
                    typeMap = lambdaFrame.TypeMap;
                    typeParameters = ImmutableArray<TypeParameterSymbol>.Empty;
                }
                else
                {
                    typeMap = TypeMap.Empty.WithAlphaRename(topLevelMethod, this, out typeParameters);
                }

                AssignTypeMapAndTypeParameters(typeMap, typeParameters);
            }
开发者ID:nagyist,项目名称:roslyn,代码行数:32,代码来源:LambdaRewriter.Frame.cs

示例6: SpecializedGenericNestedTypeInstanceReference

 public SpecializedGenericNestedTypeInstanceReference(NamedTypeSymbol underlyingNamedType)
     : base(underlyingNamedType)
 {
     Debug.Assert(underlyingNamedType.IsDefinition);
     // Definition doesn't have custom modifiers on type arguments
     Debug.Assert(!underlyingNamedType.HasTypeArgumentsCustomModifiers);
 }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:7,代码来源:SpecializedGenericNestedTypeInstanceReference.cs

示例7: SynthesizedImplementationMethod

        public SynthesizedImplementationMethod(
            MethodSymbol interfaceMethod,
            NamedTypeSymbol implementingType,
            string name = null,
            bool generateDebugInfo = true,
            PropertySymbol associatedProperty = null)
        {
            //it does not make sense to add methods to substituted types
            Debug.Assert(implementingType.IsDefinition);

            _name = name ?? ExplicitInterfaceHelpers.GetMemberName(interfaceMethod.Name, interfaceMethod.ContainingType, aliasQualifierOpt: null);
            _interfaceMethod = interfaceMethod;
            _implementingType = implementingType;
            _generateDebugInfo = generateDebugInfo;
            _associatedProperty = associatedProperty;
            _explicitInterfaceImplementations = ImmutableArray.Create<MethodSymbol>(interfaceMethod);

            // alpha-rename to get the implementation's type parameters
            var typeMap = interfaceMethod.ContainingType.TypeSubstitution ?? TypeMap.Empty;
            typeMap.WithAlphaRename(interfaceMethod, this, out _typeParameters);

            var substitutedInterfaceMethod = interfaceMethod.ConstructIfGeneric(_typeParameters.Cast<TypeParameterSymbol, TypeSymbol>());
            _returnType = substitutedInterfaceMethod.ReturnType;
            _parameters = SynthesizedParameterSymbol.DeriveParameters(substitutedInterfaceMethod, this);
        }
开发者ID:RoryVL,项目名称:roslyn,代码行数:25,代码来源:SynthesizedImplementationMethod.cs

示例8: SubstituteNamedType

        /// <summary>
        /// SubstType, but for NamedTypeSymbols only.  This is used for concrete types, so no alpha substitution appears in the result.
        /// </summary>
        internal NamedTypeSymbol SubstituteNamedType(NamedTypeSymbol previous)
        {
            if (ReferenceEquals(previous, null))
                return null;

            if (previous.IsUnboundGenericType)
                return previous;

            if (previous.IsAnonymousType)
            {
                ImmutableArray<TypeSymbol> oldFieldTypes = AnonymousTypeManager.GetAnonymousTypePropertyTypes(previous);
                ImmutableArray<TypeSymbol> newFieldTypes = SubstituteTypes(oldFieldTypes);
                return (oldFieldTypes == newFieldTypes) ? previous : AnonymousTypeManager.ConstructAnonymousTypeSymbol(previous, newFieldTypes);
            }

            // TODO: we could construct the result's ConstructedFrom lazily by using a "deep"
            // construct operation here (as VB does), thereby avoiding alpha renaming in most cases.
            // Aleksey has shown that would reduce GC pressure if substitutions of deeply nested generics are common.
            NamedTypeSymbol oldConstructedFrom = previous.ConstructedFrom;
            NamedTypeSymbol newConstructedFrom = SubstituteMemberType(oldConstructedFrom);

            ImmutableArray<TypeSymbol> oldTypeArguments = previous.TypeArgumentsNoUseSiteDiagnostics;
            ImmutableArray<TypeSymbol> newTypeArguments = SubstituteTypes(oldTypeArguments);

            if (ReferenceEquals(oldConstructedFrom, newConstructedFrom) && oldTypeArguments == newTypeArguments)
            {
                return previous;
            }

            return newConstructedFrom.ConstructIfGeneric(newTypeArguments);
        }
开发者ID:GloryChou,项目名称:roslyn,代码行数:34,代码来源:AbstractTypeMap.cs

示例9: EEAssemblyBuilder

        public EEAssemblyBuilder(
            SourceAssemblySymbol sourceAssembly,
            EmitOptions emitOptions,
            ImmutableArray<MethodSymbol> methods,
            ModulePropertiesForSerialization serializationProperties,
            ImmutableArray<NamedTypeSymbol> additionalTypes,
            NamedTypeSymbol dynamicOperationContextType,
            CompilationTestData testData) :
            base(
                  sourceAssembly,
                  emitOptions,
                  outputKind: OutputKind.DynamicallyLinkedLibrary,
                  serializationProperties: serializationProperties,
                  manifestResources: SpecializedCollections.EmptyEnumerable<ResourceDescription>(),
                  additionalTypes: additionalTypes)
        {
            Methods = ImmutableHashSet.CreateRange(methods);
            _dynamicOperationContextType = dynamicOperationContextType;

            if (testData != null)
            {
                this.SetMethodTestData(testData.Methods);
                testData.Module = this;
            }
        }
开发者ID:rgani,项目名称:roslyn,代码行数:25,代码来源:EEAssemblyBuilder.cs

示例10: SourceAttributeData

        internal SourceAttributeData(
            SyntaxReference applicationNode,
            NamedTypeSymbol attributeClass,
            MethodSymbol attributeConstructor,
            ImmutableArray<TypedConstant> constructorArguments,
            ImmutableArray<int> constructorArgumentsSourceIndices,
            ImmutableArray<KeyValuePair<string, TypedConstant>> namedArguments,
            bool hasErrors,
            bool isConditionallyOmitted)
        {
            Debug.Assert(!isConditionallyOmitted || (object)attributeClass != null && attributeClass.IsConditional);
            Debug.Assert(!constructorArguments.IsDefault);
            Debug.Assert(!namedArguments.IsDefault);
            Debug.Assert(constructorArgumentsSourceIndices.IsDefault ||
                constructorArgumentsSourceIndices.Any() && constructorArgumentsSourceIndices.Length == constructorArguments.Length);

            this.attributeClass = attributeClass;
            this.attributeConstructor = attributeConstructor;
            this.constructorArguments = constructorArguments;
            this.constructorArgumentsSourceIndices = constructorArgumentsSourceIndices;
            this.namedArguments = namedArguments;
            this.isConditionallyOmitted = isConditionallyOmitted;
            this.hasErrors = hasErrors;
            this.applicationNode = applicationNode;
        }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:25,代码来源:SourceAttributeData.cs

示例11: VisitNamedType

        public override void VisitNamedType(NamedTypeSymbol symbol)
        {
            _cancellationToken.ThrowIfCancellationRequested();

            var sourceTypeSymbol = symbol as SourceMemberContainerTypeSymbol;
            if ((object)sourceTypeSymbol != null)
            {
                if (_moduleBeingBuilt != null)
                {
                    // In some circumstances (e.g. implicit implementation of an interface method by a non-virtual method in a 
                    // base type from another assembly) it is necessary for the compiler to generate explicit implementations for
                    // some interface methods.  They don't go in the symbol table, but if we are emitting metadata, then we should
                    // generate MethodDef entries for them.
                    foreach (var synthesizedExplicitImpl in sourceTypeSymbol.GetSynthesizedExplicitImplementations(_cancellationToken))
                    {
                        _moduleBeingBuilt.AddSynthesizedDefinition(symbol, synthesizedExplicitImpl);
                    }
                }
            }

            foreach (Symbol member in symbol.GetMembers())
            {
                switch (member.Kind)
                {
                    case SymbolKind.Property:
                    case SymbolKind.NamedType:
                        member.Accept(this);
                        break;
                }
            }
        }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:31,代码来源:SynthesizedMetadataCompiler.cs

示例12: CreateAccessorSymbol

        public static SourcePropertyAccessorSymbol CreateAccessorSymbol(
            NamedTypeSymbol containingType,
            SourcePropertySymbol property,
            DeclarationModifiers propertyModifiers,
            string propertyName,
            ArrowExpressionClauseSyntax syntax,
            PropertySymbol explicitlyImplementedPropertyOpt,
            string aliasQualifierOpt,
            DiagnosticBag diagnostics)
        {
            string name;
            ImmutableArray<MethodSymbol> explicitInterfaceImplementations;
            GetNameAndExplicitInterfaceImplementations(
                explicitlyImplementedPropertyOpt,
                propertyName,
                property.IsCompilationOutputWinMdObj(),
                aliasQualifierOpt,
                isGetMethod: true,
                name: out name,
                explicitInterfaceImplementations:
                out explicitInterfaceImplementations);

            return new SourcePropertyAccessorSymbol(
                containingType,
                name,
                property,
                propertyModifiers,
                explicitInterfaceImplementations,
                syntax.Expression.GetLocation(),
                syntax,
                diagnostics);
        }
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:32,代码来源:SourcePropertyAccessorSymbol.cs

示例13: ForType

 private static SmallDictionary<TypeParameterSymbol, TypeWithModifiers> ForType(NamedTypeSymbol containingType)
 {
     var substituted = containingType as SubstitutedNamedTypeSymbol;
     return (object)substituted != null ?
         new SmallDictionary<TypeParameterSymbol, TypeWithModifiers>(substituted.TypeSubstitution.Mapping, ReferenceEqualityComparer.Instance) :
         new SmallDictionary<TypeParameterSymbol, TypeWithModifiers>(ReferenceEqualityComparer.Instance);
 }
开发者ID:Rickinio,项目名称:roslyn,代码行数:7,代码来源:TypeMap.cs

示例14: SynthesizedExplicitImplementationMethod

 public SynthesizedExplicitImplementationMethod(
     MethodSymbol interfaceMethod,
     MethodSymbol implementingMethod,
     NamedTypeSymbol implementingType) : base(interfaceMethod, implementingType)
 {
     this.implementingMethod = implementingMethod;
 }
开发者ID:riversky,项目名称:roslyn,代码行数:7,代码来源:SynthesizedExplicitImplementationMethod.cs

示例15: DelegateConstructor

 public DelegateConstructor(NamedTypeSymbol containingType, TypeSymbol objectType, TypeSymbol intPtrType)
     : base(containingType)
 {
     _parameters = ImmutableArray.Create<ParameterSymbol>(
        new SynthesizedParameterSymbol(this, objectType, 0, RefKind.None, "object"),
        new SynthesizedParameterSymbol(this, intPtrType, 1, RefKind.None, "method"));
 }
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:7,代码来源:SynthesizedDelegateSymbol.cs


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