public override void AfterVisit(WhileStatement node)
        {
            Expression loopBody = _expressionStack.Pop();
            Expression condition = _expressionStack.Pop();
            var loopContext = _loopContextStack.Pop();

            var loopController = Expression.IfThen(Expression.Not(RuntimeHelpers.EnsureBoolResult(condition)), Expression.Goto(loopContext.BreakLabel));

            var loopExprs = new List<Expression>
            {
                //Expression.Label(loopContext.ContinueLabel),
                loopController,
                loopBody,
                //Expression.Label(loopContext.BreakLabel)
            };

            _expressionStack.Push(node, Expression.Loop(MaybeBlock(loopExprs), loopContext.BreakLabel, loopContext.ContinueLabel));

            base.AfterVisit(node);
        }
Exemple #2
0
 public virtual void BeforeVisit(WhileStatement node)
 {
     this.BeforeVisitCatchAll(node);
 }
 public override void BeforeVisit(WhileStatement node)
 {
     base.BeforeVisit(node);
     pushLoopContext();
 }
Exemple #4
0
 public virtual void AfterVisit(WhileStatement node)
 {
     this.AfterVisitCatchAll(node);
 }