+ graph.files.add self
+ end
+
+ # If the file contains some classes in the root namespace, add an implicit
+ # module to handle them.
+ #
+ # This method is called by `ProjectGraph.add_global_modules` and assumes
+ # that all the namespaces are already fully set and put in the graph.
+ fun declare_root_namespace do
+ if has_globals then
+ declare_namespace("", "")
+ inner_namespaces.last.put_in_graph
+ end
+ end
+
+ # Does this file contain classes in the root namespace?
+ private fun has_globals: Bool do
+ var root = graph.by_id[""]
+ for c in inner_classes do
+ if graph.class_to_ns[c] == root then return true
+ end
+ return false