diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2021-06-07 11:55:09 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2021-06-07 11:55:09 +0200 |
commit | 274d65d2a76ed48cb618e25e0916e20ba3d5c87b (patch) | |
tree | a172075cfcfea41488bad95066f77c8085030ae8 /libbuild2/cc/parser.cxx | |
parent | e3a05597ec42ed02230918fe0bcada3dbb521209 (diff) |
Strip partition part from module name when forming imported partition name
Diffstat (limited to 'libbuild2/cc/parser.cxx')
-rw-r--r-- | libbuild2/cc/parser.cxx | 18 |
1 files changed, 12 insertions, 6 deletions
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; } |