struct return_types_gatherer { std::vector<type::type> result_types; // return จͷ node ͷ࣌ template<class Walker> void visit(ast::node::return_stmt const& ret, Walker const& w) { // ҾͰͬͯ͘ΔؔΦϒδΣΫτΛݺͼग़͢ͱࢠϊʔυ // Λ࠶ؼతʹ visit ͯ͘͠ΕΔ w(); result_types.push_back(ret->ret_type); } // ͦΕҎ֎ͷϊʔυͷͱ͖ template<class T, class W> void visit(T const&, W const& w) { w(); } }; // ͍ํ return_types_gatherer gatherer; ast::make_walker(gatherer).walk(some_ast_node);