GetParameterDescription() public static method

public static GetParameterDescription ( ISymbol symbol, MetadataItem item, string id, bool isReturn, ITripleSlashCommentParserContext context ) : ApiParameter
symbol ISymbol
item MetadataItem
id string
isReturn bool
context ITripleSlashCommentParserContext
return Microsoft.DocAsCode.DataContracts.ManagedReference.ApiParameter
Beispiel #1
0
        public override MetadataItem VisitField(IFieldSymbol symbol)
        {
            MetadataItem result = GetYamlItem(symbol);

            if (result == null)
            {
                return(null);
            }
            if (result.Syntax == null)
            {
                result.Syntax = new SyntaxDetail {
                    Content = new SortedList <SyntaxLanguage, string>()
                };
            }
            if (result.Syntax.Content == null)
            {
                result.Syntax.Content = new SortedList <SyntaxLanguage, string>();
            }
            _generator.GenerateSyntax(result.Type, symbol, result.Syntax, this);
            _generator.GenerateField(symbol, result, this);

            var typeGenericParameters = symbol.ContainingType.IsGenericType ? symbol.ContainingType.Accept(TypeGenericParameterNameVisitor.Instance) : EmptyListOfString;

            var id = AddSpecReference(symbol.Type, typeGenericParameters);

            result.Syntax.Return = VisitorHelper.GetParameterDescription(symbol, result, id, true, GetTripleSlashCommentParserContext(result, _preserveRawInlineComments));
            Debug.Assert(result.Syntax.Return.Type != null);

            result.Attributes = GetAttributeInfo(symbol.GetAttributes());

            return(result);
        }
Beispiel #2
0
        private void AddMethodSyntax(IMethodSymbol symbol, MetadataItem result, IReadOnlyList <string> typeGenericParameters, IReadOnlyList <string> methodGenericParameters)
        {
            if (!symbol.ReturnsVoid)
            {
                var id = AddSpecReference(symbol.ReturnType, typeGenericParameters, methodGenericParameters);
                result.Syntax.Return            = VisitorHelper.GetParameterDescription(symbol, result, id, true, GetTripleSlashCommentParserContext(result, _preserveRawInlineComments));
                result.Syntax.Return.Attributes = GetAttributeInfo(symbol.GetReturnTypeAttributes());
            }

            if (symbol.Parameters.Length > 0)
            {
                if (result.Syntax.Parameters == null)
                {
                    result.Syntax.Parameters = new List <ApiParameter>();
                }

                foreach (var p in symbol.Parameters)
                {
                    var id    = AddSpecReference(p.Type, typeGenericParameters, methodGenericParameters);
                    var param = VisitorHelper.GetParameterDescription(p, result, id, false, GetTripleSlashCommentParserContext(result, _preserveRawInlineComments));
                    Debug.Assert(param.Type != null);
                    param.Attributes = GetAttributeInfo(p.GetAttributes());
                    result.Syntax.Parameters.Add(param);
                }
            }
        }
Beispiel #3
0
        public override MetadataItem VisitProperty(IPropertySymbol symbol)
        {
            MetadataItem result = GetYamlItem(symbol);

            if (result == null)
            {
                return(null);
            }
            if (result.Syntax == null)
            {
                result.Syntax = new SyntaxDetail {
                    Content = new SortedList <SyntaxLanguage, string>()
                };
            }
            if (result.Syntax.Parameters == null)
            {
                result.Syntax.Parameters = new List <ApiParameter>();
            }
            if (result.Syntax.Content == null)
            {
                result.Syntax.Content = new SortedList <SyntaxLanguage, string>();
            }
            _generator.GenerateSyntax(result.Type, symbol, result.Syntax, this);

            var typeGenericParameters = symbol.ContainingType.IsGenericType ? symbol.ContainingType.Accept(TypeGenericParameterNameVisitor.Instance) : EmptyListOfString;

            if (symbol.Parameters.Length > 0)
            {
                foreach (var p in symbol.Parameters)
                {
                    var id    = AddSpecReference(p.Type, typeGenericParameters);
                    var param = VisitorHelper.GetParameterDescription(p, result, id, false, GetTripleSlashCommentParserContext(result, _preserveRawInlineComments));
                    Debug.Assert(param.Type != null);
                    result.Syntax.Parameters.Add(param);
                }
            }
            {
                var id = AddSpecReference(symbol.Type, typeGenericParameters);
                result.Syntax.Return = VisitorHelper.GetParameterDescription(symbol, result, id, true, GetTripleSlashCommentParserContext(result, _preserveRawInlineComments));
                Debug.Assert(result.Syntax.Return.Type != null);
            }

            if (symbol.IsOverride && symbol.OverriddenProperty != null)
            {
                result.Overridden = AddSpecReference(symbol.OverriddenProperty, typeGenericParameters);
            }

            result.Overload = AddOverloadReference(symbol.OriginalDefinition);

            _generator.GenerateProperty(symbol, result, this);

            AddMemberImplements(symbol, result, typeGenericParameters);

            result.Attributes = GetAttributeInfo(symbol.GetAttributes());

            result.IsExplicitInterfaceImplementation = !symbol.ExplicitInterfaceImplementations.IsEmpty;

            return(result);
        }