public virtual JsStatement VisitDoWhileStatement(JsDoWhileStatement statement, TData data) { var condition = VisitExpression(statement.Condition, data); var body = VisitStatement(statement.Body, data); return(ReferenceEquals(condition, statement.Condition) && ReferenceEquals(body, statement.Body) ? statement : new JsDoWhileStatement(condition, body)); }
public override void VisitDoWhileStatement(JsDoWhileStatement node) { output.Append("do"); WriteMaybeBlock(node.Body, true); output.Append("while ("); node.Condition.Accept(this); output.AppendLine(");"); }
public JsNode VisitDoWhileStatement(DoWhileStatement node) { var node2 = new JsDoWhileStatement { Statement = VisitStatement(node.EmbeddedStatement), Condition = VisitExpression(node.Condition) }; return(node2); }
public virtual JsNode Visit(JsDoWhileStatement node) { return(DefaultVisit(node, x => { x.Condition = (JsExpression)x.Condition.Accept(this); x.Body = (JsStatement)x.Body.Accept(this); return x; })); }
public override JsStatement VisitDoWhileStatement(JsDoWhileStatement statement, object data) { bool old = _unnamedIsMatch; _unnamedIsMatch = false; VisitStatement(statement.Body, null); _unnamedIsMatch = old; return(statement); }
public override JsNode Visit(JsDoWhileStatement node) { if (loop != null) { return(node); } loop = node; node.Body = TransformBody((JsStatement)node.Body.Accept(this)); return(node); }
public object VisitDoWhileStatement(JsDoWhileStatement statement, bool addNewline) { _cb.Append("do" + _space); VisitStatement(statement.Body, false); _cb.Append(_space + "while" + _space + "("); VisitExpression(statement.Condition, false); _cb.Append(");"); if (addNewline) { _cb.AppendLine(); } return(null); }
private bool HandleDoWhileStatement(JsDoWhileStatement stmt, StackEntry location, ImmutableStack <StackEntry> stack, ImmutableStack <Tuple <string, State> > breakStack, ImmutableStack <Tuple <string, State> > continueStack, State currentState, State returnState, IList <JsStatement> currentBlock, bool isFirstStatement) { if (!isFirstStatement) { // We have to create a new block for the statement. var topOfLoopState = CreateNewStateValue(currentState.FinallyStack); Enqueue(stack.Push(location), breakStack, continueStack, topOfLoopState, returnState); currentBlock.Add(new JsGotoStateStatement(topOfLoopState, currentState)); return(false); } else { var beforeConditionState = CreateNewStateValue(currentState.FinallyStack); Tuple <State, bool> afterLoopState; string currentName = GetLabelForState(currentState); if (new ContainsBreakVisitor().Analyze(stmt.Body, currentName)) { afterLoopState = GetStateAfterStatement(location, stack, currentState.FinallyStack, returnState); breakStack = breakStack.Push(Tuple.Create(currentName, afterLoopState.Item1)); } else { afterLoopState = Tuple.Create(returnState, false); } currentBlock.AddRange(Handle(ImmutableStack <StackEntry> .Empty.Push(new StackEntry(stmt.Body, 0)), breakStack, continueStack.Push(Tuple.Create(GetLabelForState(currentState), beforeConditionState)), currentState, beforeConditionState, false, false)); if (afterLoopState.Item2) { Enqueue(PushFollowing(stack, location), breakStack, continueStack, afterLoopState.Item1, returnState); Enqueue(stack.Push(new StackEntry(JsStatement.Block(JsStatement.If(stmt.Condition, new JsGotoStateStatement(currentState, currentState), null)), 0)), breakStack, continueStack, beforeConditionState, afterLoopState.Item1); } else { Enqueue(PushFollowing(stack, location).Push(new StackEntry(JsStatement.Block(JsStatement.If(stmt.Condition, new JsGotoStateStatement(currentState, currentState), null)), 0)), breakStack, continueStack, beforeConditionState, returnState); } return(false); } }
public virtual void Visit(JsDoWhileStatement node) { DefaultVisit(node); node.Body.Accept(this); node.Condition.Accept(this); }
private bool HandleDoWhileStatement(JsDoWhileStatement stmt, StackEntry location, ImmutableStack<StackEntry> stack, ImmutableStack<Tuple<string, State>> breakStack, ImmutableStack<Tuple<string, State>> continueStack, State currentState, State returnState, IList<JsStatement> currentBlock) { if (currentBlock.Count > 0) { // We have to create a new block for the statement. var topOfLoopState = CreateNewStateValue(currentState.FinallyStack); Enqueue(stack.Push(location), breakStack, continueStack, topOfLoopState, returnState); currentBlock.Add(new JsGotoStateStatement(topOfLoopState, currentState)); return false; } else { var beforeConditionState = CreateNewStateValue(currentState.FinallyStack); Tuple<State, bool> afterLoopState; string currentName = GetLabelForState(currentState); if (new ContainsBreakVisitor().Analyze(stmt.Body, currentName)) { afterLoopState = GetStateAfterStatement(location, stack, currentState.FinallyStack, returnState); breakStack = breakStack.Push(Tuple.Create(currentName, afterLoopState.Item1)); } else { afterLoopState = Tuple.Create(returnState, false); } currentBlock.AddRange(Handle(ImmutableStack<StackEntry>.Empty.Push(new StackEntry(stmt.Body, 0)), breakStack, continueStack.Push(Tuple.Create(GetLabelForState(currentState), beforeConditionState)), currentState, beforeConditionState)); if (afterLoopState.Item2) { Enqueue(PushFollowing(stack, location), breakStack, continueStack, afterLoopState.Item1, returnState); Enqueue(stack.Push(new StackEntry(new JsBlockStatement(new JsIfStatement(stmt.Condition, new JsGotoStateStatement(currentState, currentState), null)), 0)), breakStack, continueStack, beforeConditionState, afterLoopState.Item1); } else { Enqueue(PushFollowing(stack, location).Push(new StackEntry(new JsBlockStatement(new JsIfStatement(stmt.Condition, new JsGotoStateStatement(currentState, currentState), null)), 0)), breakStack, continueStack, beforeConditionState, returnState); } return false; } }
public override JsStatement VisitDoWhileStatement(JsDoWhileStatement statement, object data) { var body = VisitLoopBody(statement.Body, data); return(ReferenceEquals(body, statement.Body) ? statement : new JsDoWhileStatement(statement.Condition, body)); }
public void Visit(JsDoWhileStatement node) { BeforeVisit(node); DefaultVisit(node, VisitDoWhileStatement); AfterVisit(node); }
public virtual void VisitDoWhileStatement(JsDoWhileStatement node) { }