mainmodule = mmodules.first
else
# We need a main module, so we build it by importing all modules
- mainmodule = new MModule(modelbuilder.model, null, "<main>", new Location(null, 0, 0, 0, 0))
+ mainmodule = new MModule(modelbuilder.model, null, mmodules.first.name, new Location(null, 0, 0, 0, 0))
mainmodule.set_imported_mmodules(mmodules)
end
for phase in phases_list do
# Called by the `ToolContext::run_global_phases`.
#
# `mainmodule` is the main module of the program.
- # It could be an implicit module (called "<main>").
+ # It could be an implicit module (called like the first given_mmodules).
#
# `given_modules` is the list of explicitely requested modules.
# from the command-line for instance.
mgroup = new MGroup(pn, parent.mproject, parent)
toolcontext.info("found sub group `{mgroup.full_name}` at {dirpath}", 2)
end
+ var readme = dirpath.join_path("README")
+ if readme.file_exists then
+ var mdoc = new MDoc
+ var s = new IFStream.open(readme)
+ while not s.eof do
+ mdoc.content.add(s.read_line)
+ end
+ mgroup.mdoc = mdoc
+ mdoc.original_mentity = mgroup
+ end
mgroup.filepath = dirpath
mgroups[rdp] = mgroup
return mgroup
if decl != null then
var ndoc = decl.n_doc
- if ndoc != null then mmodule.mdoc = ndoc.to_mdoc
+ if ndoc != null then
+ var mdoc = ndoc.to_mdoc
+ mmodule.mdoc = mdoc
+ mdoc.original_mentity = mmodule
+ end
end
return mmodule