Exemple #1
0
        //-----------------------------------------------------------------------------------------------------------------------------------------------------

        protected SyntaxList <AttributeListSyntax> EmitAttributeLists()
        {
            return(AttributeSyntaxEmitter.EmitSyntaxList(Member.Attributes));
            //return SingletonList<AttributeListSyntax>(
            //    AttributeList(
            //        SeparatedList<AttributeSyntax>(
            //            Member.Attributes.Select(AttributeSyntaxEmitter.EmitSyntax))));
        }
Exemple #2
0
        private static ParameterSyntax EmitParameterSyntax(MethodParameter parameter)
        {
            var syntax = SyntaxFactory.Parameter(SyntaxFactory.Identifier(parameter.Name));

            switch (parameter.Modifier)
            {
            case MethodParameterModifier.Ref:
                syntax = syntax.WithModifiers(SyntaxFactory.TokenList(SyntaxFactory.Token(SyntaxKind.RefKeyword)));
                break;

            case MethodParameterModifier.Out:
                syntax = syntax.WithModifiers(SyntaxFactory.TokenList(SyntaxFactory.Token(SyntaxKind.OutKeyword)));
                break;
            }

            if (parameter.Attributes.Count > 0)
            {
                syntax = syntax.WithAttributeLists(AttributeSyntaxEmitter.EmitSyntaxList(parameter.Attributes));
            }

            syntax = syntax.WithType(parameter.Type.GetTypeNameSyntax());

            return(syntax);
        }