private static MethodCallCSharpExpression MakeAccess(ConditionalReceiver receiver, MethodInfo method, ReadOnlyCollection <ParameterAssignment> arguments) { if (method.IsStatic && method.IsDefined(typeof(ExtensionAttribute))) { var thisPar = method.GetParametersCached()[0]; var thisArg = CSharpExpression.Bind(thisPar, receiver); var newArgs = new ParameterAssignment[arguments.Count + 1]; newArgs[0] = thisArg; var i = 1; foreach (var arg in arguments) { newArgs[i++] = arg; } var newArguments = new TrueReadOnlyCollection <ParameterAssignment>(newArgs); return(CSharpExpression.Call(null, method, newArguments)); // TODO: call ctor directly } else { return(CSharpExpression.Call(receiver, method, arguments)); // TODO: call ctor directly } }
protected override ParameterAssignment VisitParameterAssignment(ParameterAssignment node) { var expr = Visit(node.Expression); var res = new XElement(nameof(ParameterAssignment), new XAttribute(nameof(node.Parameter), node.Parameter), new XElement(nameof(node.Expression), expr)); _nodes.Push(res); return(node); }
public static ReadOnlyCollection <ParameterAssignment> GetParameterBindings(ParameterInfo[] parameters, IEnumerable <Expression> expressions) { var arguments = expressions.ToReadOnly(); var n = arguments.Count; if (n > parameters.Length) { throw Error.TooManyArguments(); } var bindings = new ParameterAssignment[n]; for (var i = 0; i < n; i++) { bindings[i] = CSharpExpression.Bind(parameters[i], arguments[i]); } return(new TrueReadOnlyCollection <ParameterAssignment>(bindings)); }
public ParameterAssignmentProxy(ParameterAssignment node) { _node = node; }
protected virtual ParameterAssignment VisitParameterAssignment(ParameterAssignment node) { return(node.Update(Visit(node.Expression))); }
public XNode GetDebugView(ParameterAssignment assignment) { return(Visit(assignment)); }
private XNode Visit(ParameterAssignment node) { VisitParameterAssignment(node); return(_nodes.Pop()); }
public static ReadOnlyCollection<ParameterAssignment> GetParameterBindings(ParameterInfo[] parameters, IEnumerable<Expression> expressions) { var arguments = expressions.ToReadOnly(); var n = arguments.Count; if (n > parameters.Length) { throw Error.TooManyArguments(); } var bindings = new ParameterAssignment[n]; for (var i = 0; i < n; i++) { bindings[i] = CSharpExpression.Bind(parameters[i], arguments[i]); } return new TrueReadOnlyCollection<ParameterAssignment>(bindings); }
protected override ParameterAssignment VisitParameterAssignment(ParameterAssignment node) { Visited = true; return base.VisitParameterAssignment(node); }
protected virtual ParameterAssignment VisitParameterAssignment(ParameterAssignment node) { return node.Update(Visit(node.Expression)); }