diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2010-03-30T22·39+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2010-03-30T22·39+0000 |
commit | 7f19e03c65693ae6a5eefc7e681b3003676d38eb (patch) | |
tree | 80328ff57eef8b1c208e74bb270361c456b829f6 /src/libexpr/eval.cc | |
parent | 47df476daa568af9f645b6a039c028e602a7e44b (diff) |
* More primops.
Diffstat (limited to 'src/libexpr/eval.cc')
-rw-r--r-- | src/libexpr/eval.cc | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index 47a2b93b307f..1365faf8c0d2 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -254,6 +254,13 @@ void EvalState::mkList(Value & v, unsigned int length) } +void EvalState::mkAttrs(Value & v) +{ + v.type = tAttrs; + v.attrs = new Bindings; +} + + void EvalState::evalFile(const Path & path, Value & v) { startNest(nest, lvlTalkative, format("evaluating file `%1%'") % path); @@ -308,8 +315,7 @@ void EvalState::eval(Env & env, Expr e, Value & v) mkPath(v, ATgetName(ATgetAFun(s))); else if (matchAttrs(e, es)) { - v.type = tAttrs; - v.attrs = new Bindings; + mkAttrs(v); ATerm e2, pos; for (ATermIterator i(es); i; ++i) { if (!matchBind(*i, name, e2, pos)) abort(); /* can't happen */ @@ -468,8 +474,7 @@ void EvalState::eval(Env & env, Expr e, Value & v) /* Attribute set update (//). */ else if (matchOpUpdate(e, e1, e2)) { - v.type = tAttrs; - v.attrs = new Bindings; + mkAttrs(v); Value v2; eval(env, e2, v2); |