Esempio n. 1
0
        /// <summary>
        /// 条件。
        /// </summary>
        /// <param name="node">节点。</param>
        /// <returns></returns>
        protected virtual internal void VisitCondition(MethodCallExpression node)
        {
            if (node.Arguments.Count == 1)
            {
                bool isPlainVariable = IsPlainVariableEx(node.Object);

                if (!isPlainVariable)
                {
                    Visit(node.Object);
                }

                Workflow(whereIsNotEmpty =>
                {
                    if (isPlainVariable)
                    {
                        Visit(node.Object);
                    }

                    if (whereIsNotEmpty)
                    {
                        whereSwitch.Execute();
                    }
                }, () => VisitIsBoolean(node.Arguments[0]));
            }
            else
            {
                bool isPlainVariable = IsPlainVariableEx(node.Arguments[0]);

                if (!isPlainVariable)
                {
                    Visit(node.Arguments[0]);
                }

                Workflow(whereIsNotEmpty =>
                {
                    if (isPlainVariable)
                    {
                        Visit(node.Arguments[0]);
                    }

                    if (whereIsNotEmpty)
                    {
                        whereSwitch.Execute();
                    }
                }, () => VisitIsBoolean(node.Arguments[1]));
            }
        }