aboutsummaryrefslogtreecommitdiff
path: root/build2/prerequisite.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-01-23 10:53:33 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-01-23 10:53:33 +0200
commit1c7d67d9895c2bdbef13541b154ea17d25b8d515 (patch)
treeac06cf710a0104c51fdb4c4c47db3e245ac2c793 /build2/prerequisite.cxx
parent91495e646c688eade6b46f21bb40e3da8b8d6f1a (diff)
Go back to storing scope instead of target in prerequisite
Turns out this was semantically the right way to do it.
Diffstat (limited to 'build2/prerequisite.cxx')
-rw-r--r--build2/prerequisite.cxx28
1 files changed, 6 insertions, 22 deletions
diff --git a/build2/prerequisite.cxx b/build2/prerequisite.cxx
index 469bdf9..3bffa3d 100644
--- a/build2/prerequisite.cxx
+++ b/build2/prerequisite.cxx
@@ -51,38 +51,22 @@ namespace build2
// prerequisite
//
prerequisite::
- prerequisite (const prerequisite& p, target_type& w)
- : proj (p.proj),
- type (p.type),
- dir (p.dir),
- out (p.out),
- name (p.name),
- ext (p.ext),
- owner (w),
- target (nullptr)
- {
- assert (&w.base_scope () == &p.owner.base_scope ());
- }
-
- // Make a prerequisite from a target.
- //
- prerequisite::
- prerequisite (target_type& t, target_type& w)
+ prerequisite (target_type& t)
: proj (nullopt),
type (t.type ()),
dir (t.dir),
out (t.out), // @@ If it's empty, then we treat as undetermined?
name (t.name),
ext (t.ext),
- owner (w),
+ scope (t.base_scope ()),
target (&t)
{
}
- prerequisite_key prerequisite::
- key () const
+ bool prerequisite::
+ belongs (const target_type& t) const
{
- return prerequisite_key {
- proj, {&type, &dir, &out, &name, ext}, &owner.base_scope ()};
+ const auto& p (t.prerequisites);
+ return !(p.empty () || this < &p.front () || this > &p.back ());
}
}