void
Dump::visit (Module &module)
{
- emit_visibility (module.get_visibility ());
- stream << "mod " << module.get_name () << " {\n";
+ // Syntax:
+ // mod IDENTIFIER ;
+ // | mod IDENTIFIER {
+ // InnerAttribute*
+ // Item*
+ // }
- indentation.increment ();
+ emit_visibility (module.get_visibility ());
+ stream << "mod " << module.get_name ();
- for (auto &item : module.get_items ())
+ if (module.get_kind () == Module::UNLOADED)
{
- stream << indentation;
- item->accept_vis (*this);
- stream << '\n';
+ stream << ";\n";
}
+ else /* Module::LOADED */
+ {
+ stream << " {\n";
- indentation.decrement ();
+ indentation.increment ();
- stream << indentation << "}\n";
+ for (auto &item : module.get_inner_attrs ())
+ {
+ stream << indentation;
+ emit_attrib (item);
+ stream << '\n';
+ }
+
+ for (auto &item : module.get_items ())
+ {
+ stream << indentation;
+ item->accept_vis (*this);
+ stream << '\n';
+ }
+
+ indentation.decrement ();
+
+ stream << indentation << "}\n";
+ }
}
void