aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/scope.ixx
diff options
context:
space:
mode:
Diffstat (limited to 'libbuild2/scope.ixx')
-rw-r--r--libbuild2/scope.ixx40
1 files changed, 40 insertions, 0 deletions
diff --git a/libbuild2/scope.ixx b/libbuild2/scope.ixx
index 01d239b..c8214f6 100644
--- a/libbuild2/scope.ixx
+++ b/libbuild2/scope.ixx
@@ -65,6 +65,46 @@ namespace build2
}
inline scope* scope::
+ bundle_scope ()
+ {
+ if (auto r = root_)
+ {
+ for (auto s (r), a (strong_scope ()); s != a; )
+ {
+ s = s->parent_scope ()->root_scope ();
+
+ if (s->root_extra != nullptr &&
+ s->root_extra->project &&
+ *s->root_extra->project != nullptr &&
+ !(*s->root_extra->project)->empty ())
+ r = s; // Last named.
+ }
+
+ return r;
+ }
+ }
+
+ inline const scope* scope::
+ bundle_scope () const
+ {
+ if (const auto* r = root_)
+ {
+ for (auto s (r), a (strong_scope ()); s != a; )
+ {
+ s = s->parent_scope ()->root_scope ();
+
+ if (s->root_extra != nullptr &&
+ s->root_extra->project &&
+ *s->root_extra->project != nullptr &&
+ !(*s->root_extra->project)->empty ())
+ r = s; // Last named.
+ }
+
+ return r;
+ }
+ }
+
+ inline scope* scope::
weak_scope ()
{
scope* r (root_);