public EditableMethodCallExpression(EditableExpressionCollection arguments, MethodInfo method, EditableExpression theObject, ExpressionType nodeType) { Arguments = arguments; Method = method; Object = theObject; NodeType = nodeType; }
public EditableConditionalExpression(ExpressionType nodeType, EditableExpression test, EditableExpression ifTrue, EditableExpression ifFalse) { NodeType = nodeType; Test = test; IfTrue = ifTrue; IfFalse = ifFalse; }
public EditableConditionalExpression(ConditionalExpression condEx) { NodeType = condEx.NodeType; Test = EditableExpression.Create(condEx.Test); IfTrue = EditableExpression.Create(condEx.IfTrue); IfFalse = EditableExpression.Create(condEx.IfFalse); }
public EditableListInitExpression(ListInitExpression listInit) : this() { NewExpression = EditableExpression.Create(listInit.NewExpression); foreach (ElementInit e in listInit.Initializers) { Initializers.Add(new EditableElementInit(e)); } }
public EditableInvocationExpression(InvocationExpression invocEx) : this() { Expression = EditableExpression.Create(invocEx.Expression); foreach (Expression ex in invocEx.Arguments) { Arguments.Add(EditableExpression.Create(ex)); } }
public EditableElementInit(ElementInit elmInit) : this() { AddMethod = elmInit.AddMethod; foreach (Expression ex in elmInit.Arguments) { Arguments.Add(EditableExpression.Create(ex)); } }
public EditableLambdaExpression(LambdaExpression lambEx) : base(lambEx.Type) { Parameters = new EditableExpressionCollection(); Body = EditableExpression.Create(lambEx.Body); foreach (ParameterExpression param in lambEx.Parameters) { Parameters.Add(EditableExpression.Create(param)); } }
//return all the nodes in a given expression tree public static IEnumerable <EditableExpression> Nodes(this EditableExpression source) { //i.e. left, right, body, etc. foreach (EditableExpression linkNode in source.LinkNodes()) { //recursive call to get the nodes from the tree, until you hit terminals foreach (EditableExpression subNode in linkNode.Nodes()) { yield return(subNode); } } yield return(source); //return the root of this most recent call }
public EditableMemberExpression(EditableExpression editEx, MemberInfo member) { Member = member; Expression = editEx; }
public EditableMemberAssignment(MemberAssignment member) : base(member.BindingType, member.Member) { Expression = EditableExpression.Create(member.Expression); }
public EditableMemberExpression(Expression rawEx, MemberInfo member) : this(EditableExpression.Create(rawEx), member) { }
public EditableUnaryExpression(UnaryExpression unEx) : this(unEx.NodeType, EditableExpression.Create(unEx.Operand), unEx.Type) { }
public EditableBinaryExpression(BinaryExpression binex) : base(binex.Type) { Left = EditableExpression.Create(binex.Left); Right = EditableExpression.Create(binex.Right); NodeType = binex.NodeType; }
public EditableMethodCallExpression(IEnumerable <EditableExpression> arguments, MethodInfo method, Expression theObject, ExpressionType nodeType) : this(new EditableExpressionCollection(arguments), method, EditableExpression.Create(theObject), nodeType) { }
public EditableUnaryExpression(ExpressionType nodeType, EditableExpression operand, Type type) { NodeType = nodeType; Operand = operand; Type = type; }
public EditableListInitExpression(EditableExpression newEx, IEnumerable <EditableElementInit> initializers) { Initializers = new EditableElementInitCollection(initializers); NewExpression = newEx; }
public EditableMethodCallExpression(MethodCallExpression callEx) : this(new EditableExpressionCollection(callEx.Arguments), callEx.Method, EditableExpression.Create(callEx.Object), callEx.NodeType) { }
public EditableTypeBinaryExpression(EditableExpression expression, Type type) : base(type) { Expression = expression; }
public EditableMemberExpression(MemberExpression membEx) : this(EditableExpression.Create(membEx.Expression), membEx.Member) { }
public static IEnumerable <EditableExpression> LinkNodes(this EditableExpression source) { //returns all the "paths" or "links" from a node in an expression tree // each expression type that has "links" from it has different kinds of links if (source is EditableLambdaExpression) { yield return((source as EditableLambdaExpression).Body); foreach (EditableParameterExpression parm in (source as EditableLambdaExpression).Parameters) { yield return(parm); } } else if (source is EditableBinaryExpression) { yield return((source as EditableBinaryExpression).Left); yield return((source as EditableBinaryExpression).Right); } else if (source is EditableConditionalExpression) { yield return((source as EditableConditionalExpression).IfTrue); yield return((source as EditableConditionalExpression).IfFalse); yield return((source as EditableConditionalExpression).Test); } else if (source is EditableInvocationExpression) { foreach (EditableExpression x in (source as EditableInvocationExpression).Arguments) { yield return(x); } } else if (source is EditableListInitExpression) { yield return((source as EditableListInitExpression).NewExpression); foreach (EditableElementInit x in (source as EditableListInitExpression).Initializers) { foreach (EditableExpression ex in x.Arguments) { yield return(ex); } } } else if (source is EditableMemberExpression) { yield return((source as EditableMemberExpression).Expression); } else if (source is EditableMemberInitExpression) { yield return((source as EditableMemberInitExpression).NewExpression); } else if (source is EditableMethodCallExpression) { foreach (EditableExpression x in (source as EditableMethodCallExpression).Arguments) { yield return(x); } if ((source as EditableMethodCallExpression).Object != null) { yield return((source as EditableMethodCallExpression).Object); } } else if (source is EditableNewArrayExpression) { foreach (EditableExpression x in (source as EditableNewArrayExpression).Expressions) { yield return(x); } } else if (source is EditableNewExpression) { foreach (EditableExpression x in (source as EditableNewExpression).Arguments) { yield return(x); } } else if (source is EditableTypeBinaryExpression) { yield return((source as EditableTypeBinaryExpression).Expression); } else if (source is EditableUnaryExpression) { yield return((source as EditableUnaryExpression).Operand); } }
public EditableMemberInitExpression(MemberInitExpression membInit) : this(EditableExpression.Create(membInit.NewExpression) as EditableNewExpression, membInit.Bindings) { }
public EditableMemberInitExpression(NewExpression newRawEx, IEnumerable <MemberBinding> bindings) : this(EditableExpression.Create(newRawEx) as EditableNewExpression, bindings) { }
protected override Expression <TDelegate> TransformToReal(EditableExpression <TDelegate> proxy) { return(proxy.ToTypedLambda()); }
public EditableTypeBinaryExpression(TypeBinaryExpression typeBinEx) : this(EditableExpression.Create(typeBinEx.Expression), typeBinEx.TypeOperand) { }