示例#1
0
 internal FullBinaryExpressionSlim(ExpressionType nodeType, ExpressionSlim left, ExpressionSlim right, bool liftToNull, MethodInfoSlim method, LambdaExpressionSlim conversion)
     : base(nodeType, left, right)
 {
     IsLiftedToNull = liftToNull;
     Method         = method;
     Conversion     = conversion;
 }
示例#2
0
#pragma warning restore CA1062
#pragma warning restore IDE0079

        internal static BinaryExpressionSlim Make(ExpressionType nodeType, ExpressionSlim left, ExpressionSlim right, bool liftToNull, MethodInfoSlim method, LambdaExpressionSlim conversion)
        {
            if (conversion == null)
            {
                if (liftToNull)
                {
                    if (method == null)
                    {
                        return(new LiftedBinaryExpressionSlim(nodeType, left, right));
                    }
                    else
                    {
                        return(new MethodBasedLiftedBinaryExpressionSlim(nodeType, left, right, method));
                    }
                }
                else
                {
                    if (method == null)
                    {
                        return(new NonLiftedBinaryExpressionSlim(nodeType, left, right));
                    }
                    else
                    {
                        return(new MethodBasedNonLiftedBinaryExpressionSlim(nodeType, left, right, method));
                    }
                }
            }

            return(new FullBinaryExpressionSlim(nodeType, left, right, liftToNull, method, conversion));
        }
示例#3
0
 public StaticMethodCallExpressionSlim3(MethodInfoSlim method, ExpressionSlim arg0, ExpressionSlim arg1, ExpressionSlim arg2)
     : base(method)
 {
     _arg0 = arg0;
     _arg1 = arg1;
     _arg2 = arg2;
 }
示例#4
0
        internal override InvocationExpressionSlim Rewrite(ExpressionSlim expression, IList <ExpressionSlim> args)
        {
            Debug.Assert(expression != null);
            Debug.Assert(args == null || args.Count == _arguments.Count);

            return(ExpressionSlim.Invoke(expression, args ?? _arguments));
        }
        public static NewExpressionSlim New(ConstructorInfoSlim constructor, ExpressionSlim arg0)
        {
            Require(constructor, nameof(constructor));
            Require(arg0, nameof(arg0));

            return(new NewReferenceTypeExpressionSlim1(constructor, arg0));
        }
        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));
        }
示例#7
0
#pragma warning restore CA1062
#pragma warning restore IDE0079

        internal static UnaryExpressionSlim Make(ExpressionType nodeType, ExpressionSlim operand, MethodInfoSlim method, TypeSlim type)
        {
            if (type == s_typeMissing)
            {
                if (method == null)
                {
                    return(new UntypedUnaryExpressionSlim(nodeType, operand));
                }
                else
                {
                    return(new MethodBasedUntypedUnaryExpressionSlim(nodeType, operand, method));
                }
            }
            else
            {
                if (method == null)
                {
                    return(new TypedUnaryExpressionSlim(nodeType, operand, type));
                }
                else
                {
                    return(new MethodBasedTypedUnaryExpressionSlim(nodeType, operand, type, method));
                }
            }
        }
示例#8
0
 internal CatchBlockSlim(TypeSlim test, ParameterExpressionSlim variable, ExpressionSlim body, ExpressionSlim filter)
 {
     Test     = test;
     Variable = variable;
     Body     = body;
     Filter   = filter;
 }
示例#9
0
 public InstanceMethodCallExpressionSlim3(ExpressionSlim @object, MethodInfoSlim method, ExpressionSlim arg0, ExpressionSlim arg1, ExpressionSlim arg2)
     : base(@object, method)
 {
     _arg0 = arg0;
     _arg1 = arg1;
     _arg2 = arg2;
 }
 internal ConditionalExpressionSlim(ExpressionSlim test, ExpressionSlim ifTrue, ExpressionSlim ifFalse, TypeSlim type)
 {
     Test    = test;
     IfTrue  = ifTrue;
     IfFalse = ifFalse;
     Type    = type;
 }
示例#11
0
 internal GotoExpressionSlim(GotoExpressionKind kind, LabelTargetSlim target, ExpressionSlim value, TypeSlim type)
 {
     Kind   = kind;
     Value  = value;
     Target = target;
     Type   = type;
 }
示例#12
0
 public InvocationExpressionSlim3(ExpressionSlim expression, ExpressionSlim arg0, ExpressionSlim arg1, ExpressionSlim arg2)
     : base(expression)
 {
     _arg0 = arg0;
     _arg1 = arg1;
     _arg2 = arg2;
 }
示例#13
0
        public static InvocationExpressionSlim Invoke(ExpressionSlim expression, ExpressionSlim arg0)
        {
            Require(expression, nameof(expression));
            Require(arg0, nameof(arg0));

            return(new InvocationExpressionSlim1(expression, arg0));
        }
 public NewReferenceTypeExpressionSlim3(ConstructorInfoSlim constructor, ExpressionSlim arg0, ExpressionSlim arg1, ExpressionSlim arg2)
     : base(constructor)
 {
     _arg0 = arg0;
     _arg1 = arg1;
     _arg2 = arg2;
 }
        internal override NewExpressionSlim Rewrite(IList <ExpressionSlim> args)
        {
            Debug.Assert(args != null);
            Debug.Assert(args.Count == 2);

            return(ExpressionSlim.New(Constructor, args[0], args[1]));
        }
示例#16
0
        public static MethodCallExpressionSlim Call(MethodInfoSlim method, ExpressionSlim arg0)
        {
            Require(method, nameof(method));
            Require(arg0, nameof(arg0));

            return(new StaticMethodCallExpressionSlim1(method, arg0));
        }
 internal SwitchExpressionSlim(TypeSlim type, ExpressionSlim switchValue, ExpressionSlim defaultBody, MethodInfoSlim comparison, ReadOnlyCollection <SwitchCaseSlim> cases)
 {
     Type        = type;
     SwitchValue = switchValue;
     DefaultBody = defaultBody;
     Comparison  = comparison;
     Cases       = cases;
 }
示例#18
0
 private void VisitNonNull(string prefix, ExpressionSlim expression)
 {
     if (expression != null)
     {
         Append(prefix);
         Visit(expression);
     }
 }
示例#19
0
 internal TryExpressionSlim(TypeSlim type, ExpressionSlim body, ExpressionSlim @finally, ExpressionSlim fault, ReadOnlyCollection <CatchBlockSlim> handlers)
 {
     Type     = type;
     Body     = body;
     Handlers = handlers;
     Finally  = @finally;
     Fault    = fault;
 }
示例#20
0
 public InvocationExpressionSlim4(ExpressionSlim expression, ExpressionSlim arg0, ExpressionSlim arg1, ExpressionSlim arg2, ExpressionSlim arg3)
     : base(expression)
 {
     _arg0 = arg0;
     _arg1 = arg1;
     _arg2 = arg2;
     _arg3 = arg3;
 }
示例#21
0
 public StaticMethodCallExpressionSlim5(MethodInfoSlim method, ExpressionSlim arg0, ExpressionSlim arg1, ExpressionSlim arg2, ExpressionSlim arg3, ExpressionSlim arg4)
     : base(method)
 {
     _arg0 = arg0;
     _arg1 = arg1;
     _arg2 = arg2;
     _arg3 = arg3;
     _arg4 = arg4;
 }
        /// <summary>
        /// Creates a new member binding that is like this one, but using the supplied children. If all of the children are the same, it will return this member binding.
        /// </summary>
        /// <param name="expression">The <see cref="Expression"/> child node of the result.</param>
        /// <returns>This member binding if no children are changed or a member binding with the updated children.</returns>
        public MemberAssignmentSlim Update(ExpressionSlim expression)
        {
            if (expression == Expression)
            {
                return(this);
            }

            return(new MemberAssignmentSlim(Member, expression));
        }
        /// <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="test">The <see cref="Test"/> child node of the result.</param>
        /// <param name="ifTrue">The <see cref="IfTrue"/> child node of the result.</param>
        /// <param name="ifFalse">The <see cref="IfFalse"/> child node of the result.</param>
        /// <returns>This expression if no children are changed or an expression with the updated children.</returns>
        public ConditionalExpressionSlim Update(ExpressionSlim test, ExpressionSlim ifTrue, ExpressionSlim ifFalse)
        {
            if (test == Test && ifTrue == IfTrue && ifFalse == IfFalse)
            {
                return(this);
            }

            return(new ConditionalExpressionSlim(test, ifTrue, ifFalse, Type));
        }
        /// <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="switchValue">The <see cref="SwitchValue" /> property of the result.</param>
        /// <param name="cases">The <see cref="Cases" /> property of the result.</param>
        /// <param name="defaultBody">The <see cref="DefaultBody" /> property of the result.</param>
        /// <returns>This expression if no children changed, or an expression with the updated children.</returns>
        public SwitchExpressionSlim Update(ExpressionSlim switchValue, ReadOnlyCollection <SwitchCaseSlim> cases, ExpressionSlim defaultBody)
        {
            if (switchValue == SwitchValue && cases == Cases && defaultBody == DefaultBody)
            {
                return(this);
            }

            return(new SwitchExpressionSlim(Type, switchValue, defaultBody, Comparison, cases));
        }
示例#25
0
        /// <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="target">The <see cref="Target" /> property of the result.</param>
        /// <param name="value">The <see cref="Value" /> property of the result.</param>
        /// <returns>This expression if no children changed, or an expression with the updated children.</returns>
        public GotoExpressionSlim Update(LabelTargetSlim target, ExpressionSlim value)
        {
            if (target == Target && value == Value)
            {
                return(this);
            }

            return(new GotoExpressionSlim(Kind, target, value, Type));
        }
示例#26
0
        /// <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="instance">The <see cref="Object"/> child node of the result.</param>
        /// <param name="arguments">The <see cref="Arguments"/> child nodes of the result.</param>
        /// <returns>This expression if no children are changed or an expression with the updated children.</returns>
        public IndexExpressionSlim Update(ExpressionSlim instance, ReadOnlyCollection <ExpressionSlim> arguments)
        {
            if (instance == Object && arguments == Arguments)
            {
                return(this);
            }

            return(new IndexExpressionSlim(instance, Indexer, arguments));
        }
示例#27
0
        /// <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="variable">The <see cref="Variable" /> property of the result.</param>
        /// <param name="filter">The <see cref="Filter" /> property of the result.</param>
        /// <param name="body">The <see cref="Body" /> property of the result.</param>
        /// <returns>This expression if no children changed, or an expression with the updated children.</returns>
        public CatchBlockSlim Update(ParameterExpressionSlim variable, ExpressionSlim filter, ExpressionSlim body)
        {
            if (variable == Variable && filter == Filter && body == Body)
            {
                return(this);
            }

            return(new CatchBlockSlim(Test, variable, body, filter));
        }
        /// <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="body">The <see cref="Body"/> child node of the result.</param>
        /// <param name="parameters">The <see cref="Parameters"/> child node of the result.</param>
        /// <returns>This expression if no children are changed or an expression with the updated children.</returns>
        public LambdaExpressionSlim Update(ExpressionSlim body, ReadOnlyCollection <ParameterExpressionSlim> parameters)
        {
            if (body == Body && parameters == Parameters)
            {
                return(this);
            }

            return(new LambdaExpressionSlim(DelegateType, body, parameters));
        }
示例#29
0
        /// <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="operand">The <see cref="Operand"/> child node of the result.</param>
        /// <returns>This expression if no children are changed or an expression with the updated children.</returns>
        public UnaryExpressionSlim Update(ExpressionSlim operand)
        {
            if (operand == Operand)
            {
                return(this);
            }

            return(UnaryExpressionSlim.Make(NodeType, operand, Method, Type));
        }
示例#30
0
 public InstanceMethodCallExpressionSlim5(ExpressionSlim @object, MethodInfoSlim method, ExpressionSlim arg0, ExpressionSlim arg1, ExpressionSlim arg2, ExpressionSlim arg3, ExpressionSlim arg4)
     : base(@object, method)
 {
     _arg0 = arg0;
     _arg1 = arg1;
     _arg2 = arg2;
     _arg3 = arg3;
     _arg4 = arg4;
 }