aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/eval.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libexpr/eval.cc')
-rw-r--r--src/libexpr/eval.cc157
1 files changed, 0 insertions, 157 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc
index 12f7e8979..f286cbeec 100644
--- a/src/libexpr/eval.cc
+++ b/src/libexpr/eval.cc
@@ -619,75 +619,7 @@ std::optional<EvalState::Doc> EvalState::getDoc(Value & v)
return {};
}
-// typedef std::map<std::string, Value *> valmap;
-
-/*void addEnv(Value * v, valmap &vmap)
-{
- if (v.isThunk()) {
- Env * env = v.thunk.env;
-
- Expr * expr = v.thunk.expr;
-
-}
-*/
-// LocalNoInline(valmap * map0())
-// {
-// return new valmap();
-// }
-
-// LocalNoInline(valmap * map1(const char *name, Value *v))
-// {
-// return new valmap({{name, v}});
-// }
-
-// LocalNoInline(valmap * map2(const char *name1, Value *v1, const char *name2, Value *v2))
-// {
-// return new valmap({{name1, v1}, {name2, v2}});
-// }
-
-// LocalNoInline(valmap * mapBindings(Bindings &b))
-// {
-// auto map = new valmap();
-// for (auto i = b.begin(); i != b.end(); ++i)
-// {
-// std::string s = i->name;
-// (*map)[s] = i->value;
-// }
-// return map;
-// }
-
-// LocalNoInline(void addBindings(string prefix, Bindings &b, valmap &valmap))
-// {
-// for (auto i = b.begin(); i != b.end(); ++i)
-// {
-// std::string s = prefix;
-// s += i->name;
-// valmap[s] = i->value;
-// }
-// }
-
-void printEnvBindings(const Env &env, int lv )
-{
- std::cout << "env " << lv << " type: " << env.type << std::endl;
- if (env.values[0]->type() == nAttrs) {
- Bindings::iterator j = env.values[0]->attrs->begin();
-
-
- while (j != env.values[0]->attrs->end()) {
- std::cout << lv << " env binding: " << j->name << std::endl;
- // if (countCalls && j->pos) attrSelects[*j->pos]++;
- // return j->value;
- j++;
- }
-
- }
- std::cout << "next env : " << env.up << std::endl;
-
- if (env.up) {
- printEnvBindings(*env.up, ++lv);
- }
-}
void printStaticEnvBindings(const StaticEnv &se, int lvl)
{
@@ -740,95 +672,6 @@ valmap * mapStaticEnvBindings(const StaticEnv &se, const Env &env)
}
-void printEnvPosChain(const Env &env, int lv )
-{
- // std::cout << "printEnvPosChain " << lv << std::endl;
-
- // std::cout << "env" << env.values[0] << std::endl;
-
- if (env.values[0] && env.values[0]->type() == nAttrs) {
- // std::cout << "im in the loop" << std::endl;
- // std::cout << "pos " << env.values[0]->attrs->pos << std::endl;
- if (env.values[0]->attrs->pos) {
- ErrPos ep(*env.values[0]->attrs->pos);
- auto loc = getCodeLines(ep);
- if (loc)
- printCodeLines(std::cout,
- std::__cxx11::to_string(lv),
- ep,
- *loc);
- }
- }
-
- // std::cout << "next env : " << env.up << std::endl;
-
- if (env.up) {
- printEnvPosChain(*env.up, ++lv);
- }
-}
-
-void mapEnvBindings(const Env &env, valmap & vm)
-{
- // add bindings for the next level up first.
- if (env.up) {
- mapEnvBindings(*env.up, vm);
- }
-
- // merge - and write over - higher level bindings.
- // note; skipping HasWithExpr that haven't been evaled yet.
- if (env.values[0] && env.values[0]->type() == nAttrs) {
- auto map = valmap();
-
- Bindings::iterator j = env.values[0]->attrs->begin();
-
- while (j != env.values[0]->attrs->end()) {
- map[j->name] = j->value;
- j++;
- }
- vm.merge(map);
- }
-}
-
-
-valmap * mapEnvBindings(const Env &env)
-{
- auto vm = new valmap();
-
- mapEnvBindings(env, *vm);
-
- return vm;
-}
-
-// LocalNoInline(valmap * mapEnvBindings(Env &env))
-// {
-// // NOT going to use this
-// if (env.valuemap) {
-// std::cout << "got static env" << std::endl;
-// }
-
-// // std::cout << "envsize: " << env.values.size() << std::endl;
-
-// // std::cout << "size_t size: " << sizeof(size_t) << std::endl;
-// // std::cout << "envsize: " << env.size << std::endl;
-// // std::cout << "envup: " << env.up << std::endl;
-
-// valmap *vm = env.up ? mapEnvBindings(*env.up) : new valmap();
-
-// /*
-// size_t i=0;
-// do {
-// std::cout << "env: " << i << " value: " << showType(*env.values[i]) << std::endl;
-// // std::cout << *env.values[i] << std::endl;
-// ++i;
-// } while(i < (std::min(env.size, (size_t)100)));
-
-
-// if (env.values[0]->type() == nAttrs)
-// addBindings(std::to_string((int)env.size), *env.values[0]->attrs, *vm);
-// */
-// return vm;
-// }
-
/* Every "format" object (even temporary) takes up a few hundred bytes
of stack space, which is a real killer in the recursive
evaluator. So here are some helper functions for throwing