當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。