From 1c7d67d9895c2bdbef13541b154ea17d25b8d515 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 23 Jan 2017 10:53:33 +0200 Subject: Go back to storing scope instead of target in prerequisite Turns out this was semantically the right way to do it. --- build2/parser.cxx | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'build2/parser.cxx') diff --git a/build2/parser.cxx b/build2/parser.cxx index 9d118e8..ec9d9e4 100644 --- a/build2/parser.cxx +++ b/build2/parser.cxx @@ -693,14 +693,16 @@ namespace build2 dir_path (), move (pn.value), move (e), - tgs.back ()); + *scope_); - // Move last prerequisite (which will normally be the only one). - // - for (target& t: tgs) - t.prerequisites.push_back (&t == &p.owner - ? move (p) - : prerequisite (p, t)); + for (auto i (tgs.begin ()), e (tgs.end ()); i != e; ) + { + // Move last prerequisite (which will normally be the only + // one). + // + target& t (*i); + t.prerequisites.push_back (++i == e ? move (p) : p); + } } } @@ -3552,7 +3554,7 @@ namespace build2 false, // Enter as real (not implied). trace).first); - ct.prerequisites.emplace_back (dt, ct); + ct.prerequisites.emplace_back (prerequisite (dt)); } void parser:: -- cgit v1.1