8 [global::__DynamicallyInvokable]
12 [global::__DynamicallyInvokable]
20 [global::__DynamicallyInvokable]
23 return node?.Accept(
this);
29 [global::__DynamicallyInvokable]
34 for (
int count = nodes.
Count; i < count; i++)
39 array[i] = expression;
41 else if (expression != nodes[i])
44 for (
int j = 0; j < i; j++)
48 array[i] = expression;
55 return new TrueReadOnlyCollection<Expression>(array);
62 for (
int argumentCount = nodes.
ArgumentCount; i < argumentCount; i++)
68 array[i] = expression;
70 else if (expression != argument)
72 array =
new Expression[argumentCount];
73 for (
int j = 0; j < i; j++)
77 array[i] = expression;
88 [global::__DynamicallyInvokable]
93 for (
int count = nodes.
Count; i < count; i++)
95 T val = elementVisitor(nodes[i]);
100 else if ((
object)val != (
object)nodes[i])
102 array =
new T[count];
103 for (
int j = 0; j < i; j++)
114 return new TrueReadOnlyCollection<T>(array);
123 [global::__DynamicallyInvokable]
130 node = (
Visit(node) as
T);
133 throw Error.MustRewriteToSameNode(callerName, typeof(
T), callerName);
144 [global::__DynamicallyInvokable]
149 for (
int count = nodes.Count; i < count; i++)
154 throw Error.MustRewriteToSameNode(callerName, typeof(
T), callerName);
160 else if (val != nodes[i])
162 array =
new T[count];
163 for (
int j = 0; j < i; j++)
174 return new TrueReadOnlyCollection<T>(array);
180 [global::__DynamicallyInvokable]
189 [global::__DynamicallyInvokable]
192 int expressionCount = node.ExpressionCount;
194 for (
int i = 0; i < expressionCount; i++)
196 Expression expression = node.GetExpression(i);
198 if (expression != expression2)
204 array[i] = expression2;
208 if (readOnlyCollection == node.
Variables && array ==
null)
212 for (
int j = 0; j < expressionCount; j++)
214 if (array[j] ==
null)
216 array[j] = node.GetExpression(j);
219 return node.Rewrite(readOnlyCollection, array);
225 [global::__DynamicallyInvokable]
234 [global::__DynamicallyInvokable]
243 [global::__DynamicallyInvokable]
252 [global::__DynamicallyInvokable]
260 return node.Rewrite(array);
266 [global::__DynamicallyInvokable]
275 [global::__DynamicallyInvokable]
278 return node.VisitChildren(
this);
284 [global::__DynamicallyInvokable]
293 [global::__DynamicallyInvokable]
298 if (expression == node.
Expression && array ==
null)
302 return node.Rewrite(expression, array);
308 [global::__DynamicallyInvokable]
317 [global::__DynamicallyInvokable]
327 [global::__DynamicallyInvokable]
330 return node.Update(
Visit(node.Body), VisitAndConvert(node.Parameters,
"VisitLambda"));
336 [global::__DynamicallyInvokable]
345 [global::__DynamicallyInvokable]
354 [global::__DynamicallyInvokable]
359 if (expression == node.
Object && array ==
null)
363 return node.Rewrite(expression, array);
369 [global::__DynamicallyInvokable]
374 if (expression == node.
Object && array ==
null)
378 return node.Rewrite(expression, array);
384 [global::__DynamicallyInvokable]
393 [global::__DynamicallyInvokable]
402 [global::__DynamicallyInvokable]
411 [global::__DynamicallyInvokable]
414 return node.
Update(VisitAndConvert(node.
Variables,
"VisitRuntimeVariables"));
420 [global::__DynamicallyInvokable]
429 [global::__DynamicallyInvokable]
438 [global::__DynamicallyInvokable]
447 [global::__DynamicallyInvokable]
456 [global::__DynamicallyInvokable]
465 [global::__DynamicallyInvokable]
474 [global::__DynamicallyInvokable]
483 [global::__DynamicallyInvokable]
492 [global::__DynamicallyInvokable]
501 [global::__DynamicallyInvokable]
513 throw Error.UnhandledBindingType(node.
BindingType);
520 [global::__DynamicallyInvokable]
529 [global::__DynamicallyInvokable]
538 [global::__DynamicallyInvokable]
546 if (before != after && before.
Method ==
null)
550 throw Error.MustRewriteWithoutMethod(after.
Method,
"VisitUnary");
554 ValidateChildType(before.
Operand.Type, after.
Operand.Type,
"VisitUnary");
560 private static BinaryExpression ValidateBinary(BinaryExpression before, BinaryExpression after)
562 if (before != after && before.Method ==
null)
564 if (after.Method !=
null)
566 throw Error.MustRewriteWithoutMethod(after.Method,
"VisitBinary");
568 ValidateChildType(before.Left.Type, after.Left.Type,
"VisitBinary");
569 ValidateChildType(before.Right.Type, after.Right.Type,
"VisitBinary");
574 private static SwitchExpression ValidateSwitch(SwitchExpression before, SwitchExpression after)
576 if (before.Comparison ==
null && after.Comparison !=
null)
578 throw Error.MustRewriteWithoutMethod(after.Comparison,
"VisitSwitch");
583 private static void ValidateChildType(Type before, Type after,
string methodName)
585 if (before.IsValueType)
587 if (TypeUtils.AreEquivalent(before, after))
592 else if (!after.IsValueType)
596 throw Error.MustRewriteChildToSameType(before, after, methodName);
LabelTarget BreakLabel
Gets the T:System.Linq.Expressions.LabelTarget that is used by the loop body as a break statement tar...
Represents an expression that has a constant value.
virtual internal Expression VisitTry(TryExpression node)
Visits the children of the T:System.Linq.Expressions.TryExpression.
LabelTarget Target
The T:System.Linq.Expressions.LabelTarget which this label is associated with.
MemberMemberBinding Update(IEnumerable< MemberBinding > bindings)
Creates a new expression that is like this one, but using the supplied children. If all of the childr...
ListInitExpression Update(NewExpression newExpression, IEnumerable< ElementInit > initializers)
Creates a new expression that is like this one, but using the supplied children. If all of the childr...
virtual MemberBinding VisitMemberBinding(MemberBinding node)
Visits the children of the T:System.Linq.Expressions.MemberBinding.
Expression Expression
Gets the delegate or lambda expression to be applied.
Emits or clears a sequence point for debug information. This allows the debugger to highlight the cor...
Expression Right
Gets the right operand of the binary operation.
virtual LabelTarget VisitLabelTarget(LabelTarget node)
Visits the T:System.Linq.Expressions.LabelTarget.
ReadOnlyCollection< MemberBinding > Bindings
Gets the bindings that describe how to initialize the members of the newly created object.
ReadOnlyCollection< SwitchCase > Cases
Gets the collection of T:System.Linq.Expressions.SwitchCase objects for the switch.
SwitchExpression Update(Expression switchValue, IEnumerable< SwitchCase > cases, Expression defaultBody)
Creates a new expression that is like this one, but using the supplied children. If all of the childr...
MemberBindingType BindingType
Gets the type of binding that is represented.
TypeBinaryExpression Update(Expression expression)
Creates a new expression that is like this one, but using the supplied children. If all of the childr...
Represents an infinite loop. It can be exited with "break".
virtual internal Expression VisitInvocation(InvocationExpression node)
Visits the children of the T:System.Linq.Expressions.InvocationExpression.
Expression Expression
Gets the containing object of the field or property.
Represents accessing a field or property.
virtual internal Expression VisitGoto(GotoExpression node)
Visits the children of the T:System.Linq.Expressions.GotoExpression.
Expression Body
Gets the T:System.Linq.Expressions.Expression representing the body of the try block.
Expression Test
Gets the test of the conditional operation.
Expression DefaultValue
The value of the T:System.Linq.Expressions.LabelExpression when the label is reached through regular ...
ReadOnlyCollection< Expression > Visit(ReadOnlyCollection< Expression > nodes)
Dispatches the list of expressions to one of the more specialized visit methods in this class.
Provides the base class for a generic read-only collection.
ElementInit Update(IEnumerable< Expression > arguments)
Creates a new expression that is like this one, but using the supplied children. If all of the childr...
Represents a constructor call.
Represents creating a new array and possibly initializing the elements of the new array.
Represents calling a constructor and initializing one or more members of the new object.
LabelTarget Target
The target label where this node jumps to.
virtual internal Expression VisitDynamic(DynamicExpression node)
Visits the children of the T:System.Linq.Expressions.DynamicExpression.
Expression Filter
Gets the body of the T:System.Linq.Expressions.CatchBlock filter.
Expression Value
The value passed to the target, or null if the target is of type System.Void.
Provides an internal interface for accessing the arguments of multiple tree nodes (DynamicExpression,...
Represents a block that contains a sequence of expressions where variables can be defined.
LoopExpression Update(LabelTarget breakLabel, LabelTarget continueLabel, Expression body)
Creates a new expression that is like this one, but using the supplied children. If all of the childr...
RuntimeVariablesExpression Update(IEnumerable< ParameterExpression > variables)
Creates a new expression that is like this one, but using the supplied children. If all of the childr...
BinaryExpression Update(Expression left, LambdaExpression conversion, Expression right)
Creates a new expression that is like this one, but using the supplied children. If all of the childr...
Represents initializing the elements of a collection member of a newly created object.
Represents a label, which can be put in any T:System.Linq.Expressions.Expression context....
Represents an expression that applies a delegate or lambda expression to a list of argument expressio...
int Count
Gets the number of elements contained in the T:System.Collections.ObjectModel.ReadOnlyCollection`1 in...
TryExpression Update(Expression body, IEnumerable< CatchBlock > handlers, Expression @finally, Expression fault)
Creates a new expression that is like this one, but using the supplied children. If all of the childr...
Expression SwitchValue
Gets the test for the switch.
Expression Object
Gets the T:System.Linq.Expressions.Expression that represents the instance for instance method calls ...
NewExpression Update(IEnumerable< Expression > arguments)
Creates a new expression that is like this one, but using the supplied children. If all of the childr...
LabelTarget ContinueLabel
Gets the T:System.Linq.Expressions.LabelTarget that is used by the loop body as a continue statement ...
int ArgumentCount
Returns the number of arguments to the expression tree node. You should not use this type....
Used to represent the target of a T:System.Linq.Expressions.GotoExpression.
Expression Body
Gets the body of the catch block.
virtual internal Expression VisitConstant(ConstantExpression node)
Visits the T:System.Linq.Expressions.ConstantExpression.
GotoExpression Update(LabelTarget target, Expression value)
Creates a new expression that is like this one, but using the supplied children. If all of the childr...
Expression GetArgument(int index)
Returns the argument at index, throwing if index is out of bounds. You should not use this type....
virtual internal Expression VisitLoop(LoopExpression node)
Visits the children of the T:System.Linq.Expressions.LoopExpression.
virtual internal Expression VisitMemberInit(MemberInitExpression node)
Visits the children of the T:System.Linq.Expressions.MemberInitExpression.
CatchBlock Update(ParameterExpression variable, Expression filter, Expression body)
Creates a new expression that is like this one, but using the supplied children. If all of the childr...
virtual internal Expression VisitListInit(ListInitExpression node)
Visits the children of the T:System.Linq.Expressions.ListInitExpression.
NewExpression NewExpression
Gets the expression that represents the constructor call.
virtual internal Expression VisitExtension(Expression node)
Visits the children of the extension expression.
ReadOnlyCollection< Expression > Arguments
Gets the collection of arguments that are passed to a method that adds an element to an T:System....
Provides the base class from which the classes that represent bindings that are used to initialize me...
static ReadOnlyCollection< T > Visit< T >(ReadOnlyCollection< T > nodes, Func< T, T > elementVisitor)
Visits all nodes in the collection using a specified element visitor.
Provides the base class from which the classes that represent expression tree nodes are derived....
Represents an unconditional jump. This includes return statements, break and continue statements,...
An expression that provides runtime read/write permission for variables.
Expression Body
Gets the T:System.Linq.Expressions.Expression that is the body of the loop.
MemberListBinding Update(IEnumerable< ElementInit > initializers)
Creates a new expression that is like this one, but using the supplied children. If all of the childr...
MemberBindingType
Describes the binding types that are used in T:System.Linq.Expressions.MemberInitExpression objects.
virtual CatchBlock VisitCatchBlock(CatchBlock node)
Visits the children of the T:System.Linq.Expressions.CatchBlock.
NewArrayExpression Update(IEnumerable< Expression > expressions)
Creates a new expression that is like this one, but using the supplied children. If all of the childr...
T VisitAndConvert< T >(T node, string callerName)
Visits an expression, casting the result back to the original expression type.
NewExpression NewExpression
Gets the expression that contains a call to the constructor of a collection type.
ConditionalExpression Update(Expression test, Expression ifTrue, Expression ifFalse)
Creates a new expression that is like this one, but using the supplied children. If all of the childr...
LambdaExpression Conversion
Gets the type conversion function that is used by a coalescing or compound assignment operation.
Represents initializing members of a member of a newly created object.
Represents an initializer for a single element of an T:System.Collections.IEnumerable collection.
ReadOnlyCollection< ElementInit > Initializers
Gets the element initializers for initializing a collection member of a newly created object.
virtual internal Expression VisitLabel(LabelExpression node)
Visits the children of the T:System.Linq.Expressions.LabelExpression.
Expression IfFalse
Gets the expression to execute if the test evaluates to false.
Represents a constructor call that has a collection initializer.
ParameterExpression Variable
Gets a reference to the T:System.Exception object caught by this handler.
virtual internal Expression VisitConditional(ConditionalExpression node)
Visits the children of the T:System.Linq.Expressions.ConditionalExpression.
ReadOnlyCollection< CatchBlock > Handlers
Gets the collection of T:System.Linq.Expressions.CatchBlock expressions associated with the try block...
Represents a control expression that handles multiple selections by passing control to T:System....
Represents a named parameter expression.
virtual internal Expression VisitLambda< T >(Expression< T > node)
Visits the children of the T:System.Linq.Expressions.Expression`1.
Represents assignment operation for a field or property of an object.
Expression Expression
Gets the expression operand of a type test operation.
Expression Object
An object to index.
virtual Expression Visit(Expression node)
Dispatches the expression to one of the more specialized visit methods in this class.
ReadOnlyCollection< ParameterExpression > Variables
The variables or parameters to which to provide runtime access.
ExpressionVisitor()
Initializes a new instance of T:System.Linq.Expressions.ExpressionVisitor.
Expression Expression
Gets the expression to assign to the field or property.
virtual internal Expression VisitBinary(BinaryExpression node)
Visits the children of the T:System.Linq.Expressions.BinaryExpression.
virtual internal Expression VisitUnary(UnaryExpression node)
Visits the children of the T:System.Linq.Expressions.UnaryExpression.
Represents one case of a T:System.Linq.Expressions.SwitchExpression.
Expression DefaultBody
Gets the test for the switch.
Expression Fault
Gets the T:System.Linq.Expressions.Expression representing the fault block.
Represents an operation between an expression and a type.
Expression IfTrue
Gets the expression to execute if the test evaluates to true.
Represents a try/catch/finally/fault block.
ReadOnlyCollection< Expression > Expressions
Gets the bounds of the array if the value of the P:System.Linq.Expressions.Expression....
ReadOnlyCollection< MemberBinding > Bindings
Gets the bindings that describe how to initialize the members of a member.
virtual internal Expression VisitRuntimeVariables(RuntimeVariablesExpression node)
Visits the children of the T:System.Linq.Expressions.RuntimeVariablesExpression.
Represents the default value of a type or an empty expression.
MemberInitExpression Update(NewExpression newExpression, IEnumerable< MemberBinding > bindings)
Creates a new expression that is like this one, but using the supplied children. If all of the childr...
MethodInfo Method
Gets the implementing method for the unary operation.
UnaryExpression Update(Expression operand)
Creates a new expression that is like this one, but using the supplied children. If all of the childr...
virtual internal Expression VisitBlock(BlockExpression node)
Visits the children of the T:System.Linq.Expressions.BlockExpression.
Represents a dynamic operation.
virtual internal Expression VisitParameter(ParameterExpression node)
Visits the T:System.Linq.Expressions.ParameterExpression.
virtual ElementInit VisitElementInit(ElementInit node)
Visits the children of the T:System.Linq.Expressions.ElementInit.
Represents indexing a property or array.
SwitchCase Update(IEnumerable< Expression > testValues, Expression body)
Creates a new expression that is like this one, but using the supplied children. If all of the childr...
Represents an expression that has a unary operator.
virtual MemberAssignment VisitMemberAssignment(MemberAssignment node)
Visits the children of the T:System.Linq.Expressions.MemberAssignment.
Represents a catch statement in a try block.
virtual MemberMemberBinding VisitMemberMemberBinding(MemberMemberBinding node)
Visits the children of the T:System.Linq.Expressions.MemberMemberBinding.
Expression Finally
Gets the T:System.Linq.Expressions.Expression representing the finally block.
Expression Body
Gets the body of this case.
ReadOnlyCollection< ElementInit > Initializers
Gets the element initializers that are used to initialize a collection.
Represents an expression that has a binary operator.
Expression Left
Gets the left operand of the binary operation.
Represents a call to either static or an instance method.
Represents an expression that has a conditional operator.
virtual internal Expression VisitMethodCall(MethodCallExpression node)
Visits the children of the T:System.Linq.Expressions.MethodCallExpression.
virtual internal Expression VisitDebugInfo(DebugInfoExpression node)
Visits the T:System.Linq.Expressions.DebugInfoExpression.
virtual MemberListBinding VisitMemberListBinding(MemberListBinding node)
Visits the children of the T:System.Linq.Expressions.MemberListBinding.
virtual internal Expression VisitTypeBinary(TypeBinaryExpression node)
Visits the children of the T:System.Linq.Expressions.TypeBinaryExpression.
ReadOnlyCollection< ParameterExpression > Variables
Gets the variables defined in this block.
ReadOnlyCollection< Expression > Arguments
Gets the arguments to the constructor.
virtual internal Expression VisitNew(NewExpression node)
Visits the children of the T:System.Linq.Expressions.NewExpression.
Expression Operand
Gets the operand of the unary operation.
virtual internal Expression VisitMember(MemberExpression node)
Visits the children of the T:System.Linq.Expressions.MemberExpression.
virtual internal Expression VisitIndex(IndexExpression node)
Visits the children of the T:System.Linq.Expressions.IndexExpression.
virtual internal Expression VisitSwitch(SwitchExpression node)
Visits the children of the T:System.Linq.Expressions.SwitchExpression.
virtual SwitchCase VisitSwitchCase(SwitchCase node)
Visits the children of the T:System.Linq.Expressions.SwitchCase.
LabelExpression Update(LabelTarget target, Expression defaultValue)
Creates a new expression that is like this one, but using the supplied children. If all of the childr...
virtual internal Expression VisitDefault(DefaultExpression node)
Visits the T:System.Linq.Expressions.DefaultExpression.
virtual internal Expression VisitNewArray(NewArrayExpression node)
Visits the children of the T:System.Linq.Expressions.NewArrayExpression.
Represents a visitor or rewriter for expression trees.
MemberExpression Update(Expression expression)
Creates a new expression that is like this one, but using the supplied children. If all of the childr...
ReadOnlyCollection< Expression > TestValues
Gets the values of this case. This case is selected for execution when the P:System....
MemberAssignment Update(Expression expression)
Creates a new expression that is like this one, but using the supplied children. If all of the childr...