aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/nixexpr.hh
diff options
context:
space:
mode:
authorBen Burdette <bburdette@gmail.com>2022-01-03 16:08:28 -0700
committerBen Burdette <bburdette@gmail.com>2022-01-03 16:08:28 -0700
commita47de1ac37841c29e1a4a7d3a9c50e96390ebaf6 (patch)
tree54819b34b9e090cf32c1ba6865ab9a0af60a9182 /src/libexpr/nixexpr.hh
parent5954cbf3e9dca0e3b84e4bf2def74abb3d6f80cd (diff)
parent96d08fcd66e2c38598bab4f39a37a98d58347467 (diff)
Merge branch 'master' into debug-exploratory-PR
Diffstat (limited to 'src/libexpr/nixexpr.hh')
-rw-r--r--src/libexpr/nixexpr.hh11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/libexpr/nixexpr.hh b/src/libexpr/nixexpr.hh
index bfa215fda..c4c459f0b 100644
--- a/src/libexpr/nixexpr.hh
+++ b/src/libexpr/nixexpr.hh
@@ -354,8 +354,8 @@ struct ExprConcatStrings : Expr
{
Pos pos;
bool forceString;
- vector<Expr *> * es;
- ExprConcatStrings(const Pos & pos, bool forceString, vector<Expr *> * es)
+ vector<std::pair<Pos, Expr *> > * es;
+ ExprConcatStrings(const Pos & pos, bool forceString, vector<std::pair<Pos, Expr *> > * es)
: pos(pos), forceString(forceString), es(es) { };
Pos* getPos() { return &pos; }
COMMON_METHODS
@@ -392,6 +392,13 @@ struct StaticEnv
[](const Vars::value_type & a, const Vars::value_type & b) { return a.first < b.first; });
}
+ void deduplicate()
+ {
+ const auto last = std::unique(vars.begin(), vars.end(),
+ [] (const Vars::value_type & a, const Vars::value_type & b) { return a.first == b.first; });
+ vars.erase(last, vars.end());
+ }
+
Vars::const_iterator find(const Symbol & name) const
{
Vars::value_type key(name, 0);