+/** Verifies flow control constructs. Functions returning non-void must have
+return statements. Warnings are given about dead code. */
+class FlowControlValidator: private Validator
+{
+private:
+ bool reachable = true;
+
+public:
+ void apply(Stage &s) { stage = &s; s.content.visit(*this); }
+
+private:
+ virtual void visit(Block &);
+ virtual void visit(FunctionDeclaration &);
+ virtual void visit(Conditional &);
+ virtual void visit(Iteration &);
+ virtual void visit(Return &) { reachable = false; }
+ virtual void visit(Jump &) { reachable = false; }
+};
+