コード例 #1
0
            public override Accessibility VisitNamedType(INamedTypeSymbol symbol)
            {
                var accessibility = symbol.DeclaredAccessibility;

                foreach (var arg in symbol.TypeArguments)
                {
                    accessibility = AccessibilityUtilities.Minimum(accessibility, arg.Accept(this));
                }

                if (symbol.ContainingType != null)
                {
                    accessibility = AccessibilityUtilities.Minimum(accessibility, symbol.ContainingType.Accept(this));
                }

                return(accessibility);
            }
コード例 #2
0
            public override Accessibility VisitFunctionPointerType(IFunctionPointerTypeSymbol symbol)
            {
                var accessibility = symbol.DeclaredAccessibility;

                accessibility = AccessibilityUtilities.Minimum(accessibility, symbol.Signature.ReturnType.Accept(this));

                foreach (var parameter in symbol.Signature.Parameters)
                {
                    accessibility = AccessibilityUtilities.Minimum(accessibility, parameter.Type.Accept(this));
                }

                // CallingConvention types are currently specced to always be public, but if that spec ever changes
                // or the runtime creates special private types for it's own use, we'll be ready.
                foreach (var callingConventionType in symbol.Signature.UnmanagedCallingConventionTypes)
                {
                    accessibility = AccessibilityUtilities.Minimum(accessibility, callingConventionType.Accept(this));
                }

                return(accessibility);
            }