internal override MethodCallExpressionSlim Rewrite(ExpressionSlim instance, IList <ExpressionSlim> args) { Debug.Assert(instance != null); Debug.Assert(args == null || args.Count == _arguments.Count); return(ExpressionSlim.Call(instance, Method, args ?? _arguments)); }
#pragma warning disable CA1720 // Identifier 'object' contains type name. (Mirroring expression tree APIs.) /// <summary> /// Creates a new expression that is like this one, but using the supplied children. If all of the children are the same, it will return this expression. /// </summary> /// <param name="object">The <see cref="Object"/> child node of the result.</param> /// <param name="arguments">The <see cref="Arguments"/> child node of the result.</param> /// <returns>This expression if no children are changed or an expression with the updated children.</returns> public MethodCallExpressionSlim Update(ExpressionSlim @object, ReadOnlyCollection <ExpressionSlim> arguments) { if (@object == Object && arguments == Arguments) { return(this); } return(ExpressionSlim.Call(@object, Method, arguments)); }
internal override MethodCallExpressionSlim Rewrite(ExpressionSlim instance, IList <ExpressionSlim> args) { Debug.Assert(instance == null); Debug.Assert(args != null); Debug.Assert(args.Count == 1); // NB: We don't protect against a visitor that returns a non-null value for Visit(node.Object) // when the original node.Object was null for a static call. This already breaks the assert // higher up and will result in a NullReferenceException here (just like in LINQ ET). return(ExpressionSlim.Call(Method, args[0])); }
internal override MethodCallExpressionSlim Rewrite(ExpressionSlim instance, IList <ExpressionSlim> args) { Debug.Assert(instance != null); Debug.Assert(args == null || args.Count == 5); if (args != null) { return(ExpressionSlim.Call(instance, Method, args[0], args[1], args[2], args[3], args[4])); } else { return(ExpressionSlim.Call(instance, Method, ReturnObject <ExpressionSlim>(_arg0), _arg1, _arg2, _arg3, _arg4)); } }