std::string visit(class_scope const& cl, size_t const i) const { return indent(i) + c.green("CLASS_SCOPE: ") + cl->name + visit_symbols(cl->member_var_symbols, i+1, "SYMBOL: ") + visit_scopes(cl->member_func_scopes, i+1) + visit_scopes(cl->inherited_class_scopes, i+1); }
std::string visit(local_scope const& l, size_t const i) const { return indent(i) + c.green("LOCAL_SCOPE") + visit_symbols(l->local_vars, i+1, "SYMBOL: ") + visit_scopes(l->children, i+1) + visit_scopes(l->unnamed_funcs, i+1); }
std::string visit(global_scope const& g, size_t const i) const { return indent(i) + c.green("GLOBAL_SCOPE") + visit_symbols(g->const_symbols, i+1, "SYMBOL: ") + visit_scopes(g->functions, i+1) + visit_scopes(g->classes, i+1); }
std::string visit(func_scope const& f, size_t const i) const { return indent(i) + c.green("FUNCTION_SCOPE: ") + f->to_string() + visit_symbols(f->params, i+1, "SYMBOL: ") + '\n' + visit(f->body, i+1); }