#include #include namespace pslang::ast { namespace { struct get_location_visitor : const_statement_visitor { using const_statement_visitor::apply; location apply(expression_ptr const & node) { return get_location(*node); } location apply(assignment const & node) { return node.location; } location apply(variable_declaration const & node) { return node.location; } location apply(if_block const & node) { return node.location; } location apply(else_block const & node) { return node.location; } location apply(else_if_block const & node) { return node.location; } location apply(if_chain const & node) { return node.location; } location apply(while_block const & node) { return node.location; } location apply(function_definition const & node) { return node.location; } location apply(foreign_function_declaration const & node) { return node.location; } location apply(return_statement const & node) { return node.location; } location apply(field_definition const & node) { return node.location; } location apply(struct_definition const & node) { return node.location; } }; } location get_location(statement const & statement) { return get_location_visitor{}.apply(statement); } }