about summary refs log tree commit diff
path: root/src/libexpr/eval.hh
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2010-04-13T12·25+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2010-04-13T12·25+0000
commitac1e8f40d4a5c380d68bb6f1c7cef6f1e7987c1a (patch)
treebcdb22f27c39948cdb254afd560ac198ae675f56 /src/libexpr/eval.hh
parent10e8b1fd15d59dc541c15f6da56f8baf58eb3aa3 (diff)
* Use a symbol table to represent identifiers and attribute names
  efficiently.  The symbol table ensures that there is only one copy
  of each symbol, thus allowing symbols to be compared efficiently
  using a pointer equality test.

Diffstat (limited to 'src/libexpr/eval.hh')
-rw-r--r--src/libexpr/eval.hh16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/libexpr/eval.hh b/src/libexpr/eval.hh
index cbdd09085d7d..fe91db2efd70 100644
--- a/src/libexpr/eval.hh
+++ b/src/libexpr/eval.hh
@@ -4,6 +4,7 @@
 #include <map>
 
 #include "nixexpr.hh"
+#include "symbol-table.hh"
 
 
 namespace nix {
@@ -14,9 +15,7 @@ class EvalState;
 struct Env;
 struct Value;
 
-typedef string Sym;
-
-typedef std::map<Sym, Value> Bindings;
+typedef std::map<Symbol, Value> Bindings;
 
 
 struct Env
@@ -161,6 +160,10 @@ class EvalState
 public:
     DrvHashes drvHashes; /* normalised derivation hashes */
 
+    SymbolTable symbols;
+
+    const Symbol sWith, sOutPath, sDrvPath, sType, sMeta, sName;
+
 private:
     SrcToStore srcToStore; 
 
@@ -235,6 +238,13 @@ private:
     void addPrimOp(const string & name,
         unsigned int arity, PrimOp primOp);
 
+    Value * lookupVar(Env * env, const Symbol & name);
+    
+    Value * lookupWith(Env * env, const Symbol & name);
+
+    friend class ExprVar;
+    friend class ExprAttrs;
+
 public:
     
     /* Do a deep equality test between two values.  That is, list