Beispiel #1
0
 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);
 }
Beispiel #4
0
 public EditableListInitExpression(ListInitExpression listInit)
     : this()
 {
     NewExpression = EditableExpression.Create(listInit.NewExpression);
     foreach (ElementInit e in listInit.Initializers)
     {
         Initializers.Add(new EditableElementInit(e));
     }
 }
Beispiel #5
0
 public EditableInvocationExpression(InvocationExpression invocEx)
     : this()
 {
     Expression = EditableExpression.Create(invocEx.Expression);
     foreach (Expression ex in invocEx.Arguments)
     {
         Arguments.Add(EditableExpression.Create(ex));
     }
 }
Beispiel #6
0
 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));
     }
 }
Beispiel #8
0
 //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
 }
Beispiel #9
0
 public EditableMemberExpression(EditableExpression editEx, MemberInfo member)
 {
     Member     = member;
     Expression = editEx;
 }
 public EditableMemberAssignment(MemberAssignment member)
     : base(member.BindingType, member.Member)
 {
     Expression = EditableExpression.Create(member.Expression);
 }
Beispiel #11
0
 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;
 }
Beispiel #14
0
 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;
 }
Beispiel #16
0
 public EditableListInitExpression(EditableExpression newEx, IEnumerable <EditableElementInit> initializers)
 {
     Initializers  = new EditableElementInitCollection(initializers);
     NewExpression = newEx;
 }
Beispiel #17
0
 public EditableMethodCallExpression(MethodCallExpression callEx) :
     this(new EditableExpressionCollection(callEx.Arguments), callEx.Method, EditableExpression.Create(callEx.Object), callEx.NodeType)
 {
 }
Beispiel #18
0
 public EditableTypeBinaryExpression(EditableExpression expression, Type type)
     : base(type)
 {
     Expression = expression;
 }
Beispiel #19
0
 public EditableMemberExpression(MemberExpression membEx)
     : this(EditableExpression.Create(membEx.Expression), membEx.Member)
 {
 }
Beispiel #20
0
        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);
            }
        }
Beispiel #21
0
 public EditableMemberInitExpression(MemberInitExpression membInit)
     : this(EditableExpression.Create(membInit.NewExpression) as EditableNewExpression, membInit.Bindings)
 {
 }
Beispiel #22
0
 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());
 }
Beispiel #24
0
 public EditableTypeBinaryExpression(TypeBinaryExpression typeBinEx)
     : this(EditableExpression.Create(typeBinEx.Expression), typeBinEx.TypeOperand)
 {
 }