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


C# Symbols.SourceMemberContainerTypeSymbol类代码示例

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


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

示例1: SourceConstructorSymbol

        private SourceConstructorSymbol(
            SourceMemberContainerTypeSymbol containingType,
            Location location,
            ConstructorDeclarationSyntax syntax,
            MethodKind methodKind,
            DiagnosticBag diagnostics) :
            base(containingType, syntax.GetReference(), syntax.Body.GetReferenceOrNull(), ImmutableArray.Create(location))
        {
            bool modifierErrors;
            var declarationModifiers = this.MakeModifiers(syntax.Modifiers, methodKind, location, diagnostics, out modifierErrors);
            this.flags = MakeFlags(methodKind, declarationModifiers, returnsVoid: true, isExtensionMethod: false);

            var bodyOpt = syntax.Body;
            if (bodyOpt != null)
            {
                if (IsExtern)
                {
                    diagnostics.Add(ErrorCode.ERR_ExternHasBody, location, this);
                }
            }

            var info = ModifierUtils.CheckAccessibility(this.DeclarationModifiers);
            if (info != null)
            {
                diagnostics.Add(info, location);
            }

            if (!modifierErrors)
            {
                this.CheckModifiers(methodKind, location, diagnostics);
            }
        }
开发者ID:EkardNT,项目名称:Roslyn,代码行数:32,代码来源:SourceConstructorSymbol.cs

示例2: CreatePrimaryConstructorSymbol

 public static SourceConstructorSymbol CreatePrimaryConstructorSymbol(
     SourceMemberContainerTypeSymbol containingType,
     ParameterListSyntax syntax,
     DiagnosticBag diagnostics)
 {
     return new SourceConstructorSymbol(containingType, syntax.GetLocation(), syntax, diagnostics);
 }
开发者ID:EkardNT,项目名称:Roslyn,代码行数:7,代码来源:SourceConstructorSymbol.cs

示例3: SynthesizedInteractiveInitializerMethod

        internal SynthesizedInteractiveInitializerMethod(SourceMemberContainerTypeSymbol containingType, DiagnosticBag diagnostics)
        {
            Debug.Assert(containingType.IsScriptClass);

            _containingType = containingType;
            CalculateReturnType(containingType.DeclaringCompilation, diagnostics, out _resultType, out _returnType);
        }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:7,代码来源:SynthesizedInteractiveInitializerMethod.cs

示例4: SourceMemberFieldSymbol

        internal SourceMemberFieldSymbol(
            SourceMemberContainerTypeSymbol containingType,
            VariableDeclaratorSyntax declarator,
            DeclarationModifiers modifiers,
            bool modifierErrors,
            DiagnosticBag diagnostics)
            : base(containingType, declarator.Identifier.ValueText, declarator.GetReference(), declarator.Identifier.GetLocation())
        {
            this.modifiers = modifiers;

            this.CheckAccessibility(diagnostics);

            var location = Location;
            if (modifierErrors)
            {
                // skip the following checks
            }
            else if (containingType.IsSealed && (DeclaredAccessibility == Accessibility.Protected || DeclaredAccessibility == Accessibility.ProtectedOrInternal))
            {
                diagnostics.Add(AccessCheck.GetProtectedMemberInSealedTypeError(containingType), location, this);
            }
            else if (IsVolatile && IsReadOnly)
            {
                diagnostics.Add(ErrorCode.ERR_VolatileAndReadonly, location, this);
            }
            else if (containingType.IsStatic && !IsStatic)
            {
                diagnostics.Add(ErrorCode.ERR_InstanceMemberInStaticClass, location, this);
            }

            // TODO: Consider checking presence of core type System.Runtime.CompilerServices.IsVolatile 
            // if there is a volatile modifier. Perhaps an appropriate error should be reported if the 
            // type isn’t available.
        }
开发者ID:riversky,项目名称:roslyn,代码行数:34,代码来源:SourceMemberFieldSymbol.cs

示例5: BindFieldInitializers

        internal static ImmutableArray<BoundInitializer> BindFieldInitializers(
            SourceMemberContainerTypeSymbol containingType,
            MethodSymbol scriptCtor,
            ImmutableArray<FieldInitializers> initializers,
            DiagnosticBag diagnostics,
            bool generateDebugInfo,
            out ConsList<Imports> firstDebugImports)
        {
            if (initializers.IsEmpty)
            {
                firstDebugImports = null;
                return ImmutableArray<BoundInitializer>.Empty;
            }

            CSharpCompilation compilation = containingType.DeclaringCompilation;
            ArrayBuilder<BoundInitializer> boundInitializers = ArrayBuilder<BoundInitializer>.GetInstance();

            if ((object)scriptCtor == null)
            {
                BindRegularCSharpFieldInitializers(compilation, initializers, boundInitializers, diagnostics, generateDebugInfo, out firstDebugImports);
            }
            else
            {
                BindScriptFieldInitializers(compilation, scriptCtor, initializers, boundInitializers, diagnostics, generateDebugInfo, out firstDebugImports);
            }

            return boundInitializers.ToImmutableAndFree();
        }
开发者ID:EkardNT,项目名称:Roslyn,代码行数:28,代码来源:Binder_Initializers.cs

示例6: SourceEnumConstantSymbol

 protected SourceEnumConstantSymbol(SourceMemberContainerTypeSymbol containingEnum, EnumMemberDeclarationSyntax syntax, DiagnosticBag diagnostics)
     : base(containingEnum, syntax.Identifier.ValueText, syntax.GetReference(), syntax.Identifier.GetLocation())
 {
     if (this.Name == WellKnownMemberNames.EnumBackingFieldName)
     {
         diagnostics.Add(ErrorCode.ERR_ReservedEnumerator, this.Location, WellKnownMemberNames.EnumBackingFieldName);
     }
 }
开发者ID:riversky,项目名称:roslyn,代码行数:8,代码来源:SourceEnumConstantSymbol.cs

示例7: CreateConstructorSymbol

 public static SourceConstructorSymbol CreateConstructorSymbol(
     SourceMemberContainerTypeSymbol containingType,
     ConstructorDeclarationSyntax syntax,
     DiagnosticBag diagnostics)
 {
     var methodKind = syntax.Modifiers.Any(SyntaxKind.StaticKeyword) ? MethodKind.StaticConstructor : MethodKind.Constructor;
     return new SourceConstructorSymbol(containingType, syntax.Identifier.GetLocation(), syntax, methodKind, diagnostics);
 }
开发者ID:GloryChou,项目名称:roslyn,代码行数:8,代码来源:SourceConstructorSymbol.cs

示例8: CreateExplicitValuedConstant

 public static SourceEnumConstantSymbol CreateExplicitValuedConstant(
     SourceMemberContainerTypeSymbol containingEnum,
     EnumMemberDeclarationSyntax syntax,
     DiagnosticBag diagnostics)
 {
     var initializer = syntax.EqualsValue;
     Debug.Assert(initializer != null);
     return new ExplicitValuedEnumConstantSymbol(containingEnum, syntax, initializer, diagnostics);
 }
开发者ID:riversky,项目名称:roslyn,代码行数:9,代码来源:SourceEnumConstantSymbol.cs

示例9: SourceMemberFieldSymbol

 internal SourceMemberFieldSymbol(
     SourceMemberContainerTypeSymbol containingType,
     DeclarationModifiers modifiers,
     string name,
     SyntaxReference syntax, 
     Location location)
     : base(containingType, name, syntax, location)
 {
     _modifiers = modifiers;
 }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:10,代码来源:SourceMemberFieldSymbol.cs

示例10: SourceDelegateMethodSymbol

 protected SourceDelegateMethodSymbol(
     SourceMemberContainerTypeSymbol delegateType,
     TypeSymbol returnType,
     DelegateDeclarationSyntax syntax,
     MethodKind methodKind,
     DeclarationModifiers declarationModifiers)
     : base(delegateType, syntax.GetReference(), bodySyntaxReferenceOpt: null, location: syntax.Identifier.GetLocation())
 {
     _returnType = returnType;
     this.MakeFlags(methodKind, declarationModifiers, _returnType.SpecialType == SpecialType.System_Void, isExtensionMethod: false);
 }
开发者ID:GloryChou,项目名称:roslyn,代码行数:11,代码来源:SourceDelegateMethodSymbol.cs

示例11: SourceFieldSymbol

        protected SourceFieldSymbol(SourceMemberContainerTypeSymbol containingType, string name, SyntaxReference syntax, Location location)
        {
            Debug.Assert((object)containingType != null);
            Debug.Assert(name != null);
            Debug.Assert(syntax != null);
            Debug.Assert(location != null);

            this.containingType = containingType;
            this.name = name;
            this.syntaxReference = syntax;
            this.location = location;
        }
开发者ID:riversky,项目名称:roslyn,代码行数:12,代码来源:SourceFieldSymbol.cs

示例12: CreateUserDefinedOperatorSymbol

        public static SourceUserDefinedOperatorSymbol CreateUserDefinedOperatorSymbol(
            SourceMemberContainerTypeSymbol containingType,
            OperatorDeclarationSyntax syntax,
            DiagnosticBag diagnostics)
        {
            var location = syntax.OperatorToken.GetLocation();

            string name = OperatorFacts.OperatorNameFromDeclaration(syntax);

            return new SourceUserDefinedOperatorSymbol(
                containingType, name, location, syntax, diagnostics);
        }
开发者ID:riversky,项目名称:roslyn,代码行数:12,代码来源:SourceUserDefinedOperatorSymbol.cs

示例13: GlobalExpressionVariable

 internal GlobalExpressionVariable(
     SourceMemberContainerTypeSymbol containingType,
     DeclarationModifiers modifiers,
     TypeSyntax typeSyntax,
     string name,
     SyntaxReference syntax,
     Location location)
     : base(containingType, modifiers, name, syntax, location)
 {
     Debug.Assert(DeclaredAccessibility == Accessibility.Private);
     _typeSyntax = typeSyntax.GetReference();
 }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:12,代码来源:GlobalExpressionVariable.cs

示例14: SourceFixedFieldSymbol

        internal SourceFixedFieldSymbol(
            SourceMemberContainerTypeSymbol containingType,
            VariableDeclaratorSyntax declarator,
            DeclarationModifiers modifiers,
            bool modifierErrors,
            DiagnosticBag diagnostics)
            : base(containingType, declarator, modifiers, modifierErrors, diagnostics)
        {
            // Checked in parser: a fixed field declaration requires a length in square brackets

            Debug.Assert(this.IsFixed);
        }
开发者ID:orthoxerox,项目名称:roslyn,代码行数:12,代码来源:SourceFixedFieldSymbol.cs

示例15: SynthesizedInteractiveInitializerMethod

        internal SynthesizedInteractiveInitializerMethod(SourceMemberContainerTypeSymbol containingType, DiagnosticBag diagnostics)
        {
            Debug.Assert(containingType.IsScriptClass);

            _containingType = containingType;

            var compilation = containingType.DeclaringCompilation;
            var submissionReturnType = compilation.SubmissionReturnType;
            _resultType = (submissionReturnType == null) ?
                null :
                compilation.GetTypeByReflectionType(submissionReturnType, diagnostics);
        }
开发者ID:daking2014,项目名称:roslyn,代码行数:12,代码来源:SynthesizedInteractiveInitializerMethod.cs


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