public virtual IArgumentConstraint GetArgumentConstraint(ParsedArgumentExpression argument) { if (IsParamArrayExpression(argument)) { return this.CreateParamArrayConstraint((NewArrayExpression)argument.Expression); } var isByRefArgument = IsByRefArgument(argument); object argumentValue; var constraint = this.GetArgumentConstraintFromExpression(argument.Expression, out argumentValue); if (isByRefArgument) { if (IsOutArgument(argument)) { constraint = new OutArgumentConstraint(argumentValue); } else { constraint = new RefArgumentConstraint(constraint, argumentValue); } } return constraint; }
public virtual IArgumentConstraint GetArgumentConstraint(ParsedArgumentExpression argument) { var parameterType = argument.ArgumentInformation.ParameterType; if (IsParamArrayExpression(argument)) { return(this.CreateParamArrayConstraint((NewArrayExpression)argument.Expression, parameterType)); } var isOutOrRefArgument = argument.ArgumentInformation.IsOutOrRef(); var constraint = this.GetArgumentConstraintFromExpression(argument.Expression, parameterType, out var argumentValue); if (isOutOrRefArgument) { if (IsOutArgument(argument)) { constraint = new OutArgumentConstraint(argumentValue); } else { constraint = new RefArgumentConstraint(constraint, argumentValue); } } return(constraint); }
public virtual IArgumentConstraint GetArgumentConstraint(ParsedArgumentExpression argument) { if (IsParamArrayExpression(argument)) { return(this.CreateParamArrayConstraint((NewArrayExpression)argument.Expression)); } var isByRefArgument = IsByRefArgument(argument); object argumentValue; var constraint = this.GetArgumentConstraintFromExpression(argument.Expression, out argumentValue); if (isByRefArgument) { if (IsOutArgument(argument)) { constraint = new OutArgumentConstraint(argumentValue); } else { constraint = new RefArgumentConstraint(constraint, argumentValue); } } return(constraint); }
public virtual IArgumentConstraint GetArgumentConstraint(ParsedArgumentExpression argument) { if (IsParamArrayExpression(argument)) { return this.CreateParamArrayConstraint((NewArrayExpression)argument.Expression); } return this.GetArgumentConstraintFromExpression(argument.Expression); }
public virtual IArgumentConstraint GetArgumentConstraint(ParsedArgumentExpression argument) { if (IsParamArrayExpression(argument)) { return(this.CreateParamArrayConstraint((NewArrayExpression)argument.Expression)); } return(this.GetArgumentConstraintFromExpression(argument.Expression)); }
private static ParsedArgumentExpression[] CreateParsedArgumentExpressions(IList <Expression> expressionArguments, ParameterInfo[] parameters) { var argumentsExpressions = new ParsedArgumentExpression[expressionArguments.Count]; for (int i = 0; i < argumentsExpressions.Length; i++) { argumentsExpressions[i] = new ParsedArgumentExpression(expressionArguments[i], parameters[i]); } return(argumentsExpressions); }
public virtual IArgumentConstraint GetArgumentConstraint(ParsedArgumentExpression argument) { if (IsParamArrayExpression(argument)) { return(this.CreateParamArrayConstraint((NewArrayExpression)argument.Expression)); } if (IsOutArgument(argument)) { return(new OutArgumentConstraint(argument.Value)); } var constraint = this.GetArgumentConstraintFromExpression(argument.Expression); if (IsRefArgument(argument)) { constraint = new RefArgumentConstraint(constraint, argument.Value); } return(constraint); }
public virtual IArgumentConstraint GetArgumentConstraint(ParsedArgumentExpression argument) { if (IsParamArrayExpression(argument)) { return this.CreateParamArrayConstraint((NewArrayExpression)argument.Expression); } if (IsOutArgument(argument)) { return new OutArgumentConstraint(argument.Value); } var constraint = this.GetArgumentConstraintFromExpression(argument.Expression); if (IsRefArgument(argument)) { constraint = new RefArgumentConstraint(constraint, argument.Value); } return constraint; }
private static bool IsOutArgument(ParsedArgumentExpression argument) { return(argument.ArgumentInformation.IsOut); }
private static bool IsTaggedWithParamArrayAttribute(ParsedArgumentExpression argument) { return(argument.ArgumentInformation.IsDefined(typeof(ParamArrayAttribute), true)); }
private static bool IsParamArrayExpression(ParsedArgumentExpression argument) { return(argument.Expression is NewArrayExpression && IsTaggedWithParamArrayAttribute(argument)); }
private static bool IsByRefArgument(ParsedArgumentExpression argument) { return(argument.ArgumentInformation.ParameterType.IsByRef); }
private static bool IsByRefArgument(ParsedArgumentExpression argument) { return argument.ArgumentInformation.ParameterType.IsByRef; }
private static bool IsOutArgument(ParsedArgumentExpression argument) { return argument.ArgumentInformation.IsOut; }
private static bool IsParamArrayExpression(ParsedArgumentExpression argument) { return IsTaggedWithParamArrayAttribute(argument) && argument.Expression is NewArrayExpression; }
private static bool IsTaggedWithParamArrayAttribute(ParsedArgumentExpression argument) { return argument.ArgumentInformation.GetCustomAttributes(typeof(ParamArrayAttribute), true).Any(); }
private static bool IsTaggedWithParamArrayAttribute(ParsedArgumentExpression argument) { return(argument.ArgumentInformation.GetCustomAttributes(typeof(ParamArrayAttribute), true).Any()); }