Пример #1
0
        /// <inheritdoc/>
        protected override bool HandleDynamic(CodeParameterDeclarationExpression obj, Context ctx)
        {
            if (obj.CustomAttributes.Count > 0)
            {
                GeneralUtils.HandleCollection(obj.CustomAttributes.Cast <CodeAttributeDeclaration>(),
                                              ctx.HandlerProvider.AttributeDeclarationHandler, ctx);
                ctx.Writer.Write(" ");
            }

            if (obj is CodeParameterDeclarationExpressionExt objExt && objExt.IsVarargs)
            {
                ctx.Writer.Write("params ");
            }

            if (obj.Direction != FieldDirection.In)
            {
                //TODO c# 7 allows "in" with a different meaning from parameters without modifier (readonly reference)
                ctx.Writer.Write($"{CSharpKeywordsUtils.DirectionKeyword(obj.Direction)} ");
            }

            ctx.HandlerProvider.TypeReferenceHandler.Handle(obj.Type, ctx);
            ctx.Writer.Write($" {obj.Name.AsCsId()}");
            if (obj is CodeParameterDeclarationExpressionExt objExt2 && objExt2.DefaultValue != null)
            {
                ctx.Writer.Write(" = ");
                ctx.HandlerProvider.ExpressionHandler.Handle(objExt2.DefaultValue, ctx);
            }
            return(true);
        }
Пример #2
0
 /// <inheritdoc/>
 protected override bool HandleDynamic(CodeDirectionExpression obj, Context ctx)
 {
     if (obj.Direction != FieldDirection.In)
     {
         ctx.Writer.Write($"{CSharpKeywordsUtils.DirectionKeyword(obj.Direction)} ");
     }
     ctx.HandlerProvider.ExpressionHandler.Handle(obj.Expression, ctx);
     return(true);
 }