Ejemplo n.º 1
0
        public static MethodArgumentDeclaration AddArgument(this MethodDeclaration method, string name, TypeReference type)
        {
            var argument = new MethodArgumentDeclaration(type, name);

            method.Arguments.Add(argument);
            return(argument);
        }
Ejemplo n.º 2
0
 public virtual void VisitMethodArgumentDeclaration(MethodArgumentDeclaration methodArgumentDeclaration)
 {
     VisitCommentable(methodArgumentDeclaration);
     VisitCustomAttributeContainer(methodArgumentDeclaration);
     Visit(methodArgumentDeclaration.Type);
     Visit(methodArgumentDeclaration.DefaultValue);
 }
Ejemplo n.º 3
0
 public static ConditionStatement CreateThrowIfNullStatement(this MethodArgumentDeclaration argument)
 {
     return(new ConditionStatement
     {
         Condition = new BinaryExpression(BinaryOperator.Equals, argument, new LiteralExpression(value: null)),
         TrueStatements = new ThrowStatement(new NewObjectExpression(typeof(ArgumentNullException), new NameofExpression(argument))),
     });
 }
        protected virtual void Write(IndentedTextWriter writer, MethodArgumentDeclaration arg)
        {
            WriteBeforeComments(writer, arg);
            Write(writer, arg.CustomAttributes);
            Write(writer, arg.Direction);
            Write(writer, arg.Type);
            writer.Write(" ");
            WriteIdentifier(writer, arg.Name);
            if (arg.DefaultValue != null)
            {
                writer.Write(" = ");
                Write(writer, arg.DefaultValue);
            }

            WriteAfterComments(writer, arg);
        }
Ejemplo n.º 5
0
 public static MethodArgumentDeclaration AddArgument(this MethodDeclaration method, MethodArgumentDeclaration argument)
 {
     method.Arguments.Add(argument);
     return(argument);
 }
 public static MemberReferenceExpression CreateMemberReferenceExpression(this MethodArgumentDeclaration argument, string name, params string[] names) => CreateMemberReferenceExpression(new ArgumentReferenceExpression(argument), name, names);