Beispiel #1
0
            public override void VisitWhileStatement(WhileStatement node)
            {
                switch (state)
                {
                case State.Initializer:
                    if (!VariableMatcher.FindVariableInExpression(variable, node.Condition))
                    {
                        break;
                    }

                    state     = State.Condition;
                    condition = node.Condition;

                    var body = node.Body;

                    if (body.Statements.Count == 0)
                    {
                        break;
                    }

                    Visit(body.Statements [body.Statements.Count - 1]);

                    if (!Match)
                    {
                        break;
                    }

                    CreateForStatement(body);
                    break;
                }

                Continue = false;
            }
Beispiel #2
0
        public static bool FindVariableInExpression(VariableReference variable, Expression expression)
        {
            var matcher = new VariableMatcher(variable);

            matcher.Visit(expression);
            return(matcher.Match);
        }
		public static bool FindVariableInExpression (VariableReference variable, Expression expression)
		{
			var matcher = new VariableMatcher (variable);
			matcher.Visit (expression);
			return matcher.Match;
		}