コード例 #1
0
 public EditableMethodCallExpression(EditableExpressionCollection arguments, MethodInfo method, EditableExpression theObject, ExpressionType nodeType)
 {
     Arguments = arguments;
     Method    = method;
     Object    = theObject;
     NodeType  = nodeType;
 }
コード例 #2
0
 public EditableConditionalExpression(ExpressionType nodeType, EditableExpression test, EditableExpression ifTrue, EditableExpression ifFalse)
 {
     NodeType = nodeType;
     Test     = test;
     IfTrue   = ifTrue;
     IfFalse  = ifFalse;
 }
コード例 #3
0
 public EditableConditionalExpression(ConditionalExpression condEx)
 {
     NodeType = condEx.NodeType;
     Test     = EditableExpression.Create(condEx.Test);
     IfTrue   = EditableExpression.Create(condEx.IfTrue);
     IfFalse  = EditableExpression.Create(condEx.IfFalse);
 }
コード例 #4
0
 public EditableListInitExpression(ListInitExpression listInit)
     : this()
 {
     NewExpression = EditableExpression.Create(listInit.NewExpression);
     foreach (ElementInit e in listInit.Initializers)
     {
         Initializers.Add(new EditableElementInit(e));
     }
 }
コード例 #5
0
 public EditableInvocationExpression(InvocationExpression invocEx)
     : this()
 {
     Expression = EditableExpression.Create(invocEx.Expression);
     foreach (Expression ex in invocEx.Arguments)
     {
         Arguments.Add(EditableExpression.Create(ex));
     }
 }
コード例 #6
0
 public EditableElementInit(ElementInit elmInit)
     : this()
 {
     AddMethod = elmInit.AddMethod;
     foreach (Expression ex in elmInit.Arguments)
     {
         Arguments.Add(EditableExpression.Create(ex));
     }
 }
コード例 #7
0
 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));
     }
 }
コード例 #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
 }
コード例 #9
0
 public EditableMemberExpression(EditableExpression editEx, MemberInfo member)
 {
     Member     = member;
     Expression = editEx;
 }
コード例 #10
0
 public EditableMemberAssignment(MemberAssignment member)
     : base(member.BindingType, member.Member)
 {
     Expression = EditableExpression.Create(member.Expression);
 }
コード例 #11
0
 public EditableMemberExpression(Expression rawEx, MemberInfo member)
     : this(EditableExpression.Create(rawEx), member)
 {
 }
コード例 #12
0
 public EditableUnaryExpression(UnaryExpression unEx)
     : this(unEx.NodeType, EditableExpression.Create(unEx.Operand), unEx.Type)
 {
 }
コード例 #13
0
 public EditableBinaryExpression(BinaryExpression binex) : base(binex.Type)
 {
     Left     = EditableExpression.Create(binex.Left);
     Right    = EditableExpression.Create(binex.Right);
     NodeType = binex.NodeType;
 }
コード例 #14
0
 public EditableMethodCallExpression(IEnumerable <EditableExpression> arguments, MethodInfo method, Expression theObject, ExpressionType nodeType) :
     this(new EditableExpressionCollection(arguments), method, EditableExpression.Create(theObject), nodeType)
 {
 }
コード例 #15
0
 public EditableUnaryExpression(ExpressionType nodeType, EditableExpression operand, Type type)
 {
     NodeType = nodeType;
     Operand  = operand;
     Type     = type;
 }
コード例 #16
0
 public EditableListInitExpression(EditableExpression newEx, IEnumerable <EditableElementInit> initializers)
 {
     Initializers  = new EditableElementInitCollection(initializers);
     NewExpression = newEx;
 }
コード例 #17
0
 public EditableMethodCallExpression(MethodCallExpression callEx) :
     this(new EditableExpressionCollection(callEx.Arguments), callEx.Method, EditableExpression.Create(callEx.Object), callEx.NodeType)
 {
 }
コード例 #18
0
 public EditableTypeBinaryExpression(EditableExpression expression, Type type)
     : base(type)
 {
     Expression = expression;
 }
コード例 #19
0
 public EditableMemberExpression(MemberExpression membEx)
     : this(EditableExpression.Create(membEx.Expression), membEx.Member)
 {
 }
コード例 #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);
            }
        }
コード例 #21
0
 public EditableMemberInitExpression(MemberInitExpression membInit)
     : this(EditableExpression.Create(membInit.NewExpression) as EditableNewExpression, membInit.Bindings)
 {
 }
コード例 #22
0
 public EditableMemberInitExpression(NewExpression newRawEx, IEnumerable <MemberBinding> bindings)
     : this(EditableExpression.Create(newRawEx) as EditableNewExpression, bindings)
 {
 }
コード例 #23
0
 protected override Expression <TDelegate> TransformToReal(EditableExpression <TDelegate> proxy)
 {
     return(proxy.ToTypedLambda());
 }
コード例 #24
0
 public EditableTypeBinaryExpression(TypeBinaryExpression typeBinEx)
     : this(EditableExpression.Create(typeBinEx.Expression), typeBinEx.TypeOperand)
 {
 }