From 274d65d2a76ed48cb618e25e0916e20ba3d5c87b Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 7 Jun 2021 11:55:09 +0200 Subject: Strip partition part from module name when forming imported partition name --- libbuild2/cc/parser.cxx | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'libbuild2/cc/parser.cxx') diff --git a/libbuild2/cc/parser.cxx b/libbuild2/cc/parser.cxx index 61d62b7..dc5093f 100644 --- a/libbuild2/cc/parser.cxx +++ b/libbuild2/cc/parser.cxx @@ -195,7 +195,7 @@ namespace build2 if (!u_->module_info.name.empty ()) fail (l) << "multiple module declarations"; - u_->type =np.second + u_->type = np.second ? (ex ? unit_type::module_intf_part : unit_type::module_impl_part) : (ex ? unit_type::module_intf : unit_type::module_impl); u_->module_info.name = move (np.first); @@ -226,22 +226,28 @@ namespace build2 } case type::colon: { + // Add the module name to the partition so that code that doesn't + // need to distinguish between different kinds of imports doesn't + // have to. + // + // Note that if this itself is a partition, then we need to strip + // the partition part from the module name. + // switch (u_->type) { case unit_type::module_intf: case unit_type::module_impl: + un = u_->module_info.name; + break; case unit_type::module_intf_part: case unit_type::module_impl_part: + un.assign (u_->module_info.name, 0, u_->module_info.name.find (':')); break; default: fail (t) << "partition importation out of module purview"; } - // Add the module name to the partition so that code that doesn't - // need to distinguish beetween different kinds of imports doesn't - // have to. - // - un = u_->module_info.name + parse_module_part (t); + parse_module_part (t, un); ut = import_type::module_part; break; } -- cgit v1.1