diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2012-01-07T17·26+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2012-01-07T17·26+0000 |
commit | 9fe24c5a0d1e694c6338d584a101034cfbff10bf (patch) | |
tree | f938de94275a6a3337a60a111c0c74cd15fb6991 /src/libexpr/nixexpr.hh | |
parent | d4e6b9f2d62ef77ff46397bd130350f03723ce50 (diff) |
* Don't create thunks for simple constants (integers, strings, paths)
and allocate them only once. * Move Value and related functions into value.hh.
Diffstat (limited to 'src/libexpr/nixexpr.hh')
-rw-r--r-- | src/libexpr/nixexpr.hh | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/libexpr/nixexpr.hh b/src/libexpr/nixexpr.hh index 1c5cc07afe18..6eb771a726b4 100644 --- a/src/libexpr/nixexpr.hh +++ b/src/libexpr/nixexpr.hh @@ -1,6 +1,7 @@ #ifndef __NIXEXPR_H #define __NIXEXPR_H +#include "value.hh" #include "symbol-table.hh" #include <map> @@ -66,15 +67,19 @@ std::ostream & operator << (std::ostream & str, Expr & e); struct ExprInt : Expr { int n; - ExprInt(int n) : n(n) { }; + Value v; + ExprInt(int n) : n(n) { mkInt(v, n); }; COMMON_METHODS + Value * maybeThunk(EvalState & state, Env & env); }; struct ExprString : Expr { Symbol s; - ExprString(const Symbol & s) : s(s) { }; + Value v; + ExprString(const Symbol & s) : s(s) { mkString(v, s); }; COMMON_METHODS + Value * maybeThunk(EvalState & state, Env & env); }; /* Temporary class used during parsing of indented strings. */ @@ -87,8 +92,10 @@ struct ExprIndStr : Expr struct ExprPath : Expr { string s; - ExprPath(const string & s) : s(s) { }; + Value v; + ExprPath(const string & s) : s(s) { mkPathNoCopy(v, this->s.c_str()); }; COMMON_METHODS + Value * maybeThunk(EvalState & state, Env & env); }; struct VarRef |