public override void VisitWhileStatement(WhileStatementSyntax node) { var saveContinueLocation = this.continueLocation; var saveBreakLocation = this.breakLocation; // merge with any states that branch back to start (continue) this.JoinState(node.StartLocation(), this.lexicalState); TState trueState; TState falseState; this.VisitCondition(node.Condition, out trueState, out falseState); this.continueLocation = node.StartLocation(); this.breakLocation = node.EndLocation(); // statement only executes when condition is true this.SetState(node.Statement.StartLocation(), trueState); this.Visit(node.Statement); // at end of loop, branch back to top this.BranchToLocation(this.continueLocation, this.lexicalState); // merge with any states that branch to end (break & natural exit) this.JoinState(node.EndLocation(), falseState); this.continueLocation = saveContinueLocation; this.breakLocation = saveBreakLocation; }