void ITreeWalker.Visit(WhileStatement statement) { statement.Validate(this); statement.Condition.Accept(this); _loops.Push(statement); statement.Body.Accept(this); _loops.Pop(); }
void ITreeWalker.Visit(WhileStatement statement) { statement.Validate(this); InsertWhile(() => statement.Condition.Accept(this), () => { _loops.Push(true); statement.Body.Accept(this); _loops.Pop(); }); }
void ITreeWalker.Visit(WhileStatement statement) { statement.Validate(this); var start = _operations.Count; statement.Condition.Accept(this); _operations.Add(PopIfOperation.Instance); var jump = InsertMarker(); _loops.Push(new LoopInfo { Break = jump, Continue = start }); statement.Body.Accept(this); _loops.Pop(); _operations.Add(new JumpOperation(start - 1)); var end = _operations.Count; _operations[jump] = new JumpOperation(end - 1); }