aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/symbol-table.hh
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2013-05-16 19:08:02 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-05-16 19:08:02 +0200
commit18a48d80a0686ba81959057e8becc6272acd6c46 (patch)
treee3f1fabe22a2c2da63c0ea7880cedee6bdb55a87 /src/libexpr/symbol-table.hh
parent1b3a03f1610b714adca41637ccd85a8157e236ab (diff)
Show function names in error messages
Functions in Nix are anonymous, but if they're assigned to a variable/attribute, we can use the variable/attribute name in error messages, e.g. while evaluating `concatMapStrings' at `/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/pkgs/lib/strings.nix:18:25': ...
Diffstat (limited to 'src/libexpr/symbol-table.hh')
-rw-r--r--src/libexpr/symbol-table.hh13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/libexpr/symbol-table.hh b/src/libexpr/symbol-table.hh
index 143fc495b..ccdabb028 100644
--- a/src/libexpr/symbol-table.hh
+++ b/src/libexpr/symbol-table.hh
@@ -28,17 +28,17 @@ private:
public:
Symbol() : s(0) { };
-
+
bool operator == (const Symbol & s2) const
{
return s == s2.s;
}
-
+
bool operator != (const Symbol & s2) const
{
return s != s2.s;
}
-
+
bool operator < (const Symbol & s2) const
{
return s < s2.s;
@@ -49,6 +49,11 @@ public:
return *s;
}
+ bool set() const
+ {
+ return s;
+ }
+
bool empty() const
{
return s->empty();
@@ -66,7 +71,7 @@ inline std::ostream & operator << (std::ostream & str, const Symbol & sym)
class SymbolTable
{
private:
-#if HAVE_TR1_UNORDERED_SET
+#if HAVE_TR1_UNORDERED_SET
typedef std::tr1::unordered_set<string> Symbols;
#else
typedef std::set<string> Symbols;