mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-23 22:46:16 +02:00
more debug stuff
This commit is contained in:
parent
037d53d9d9
commit
c7e3d830c1
4 changed files with 45 additions and 5 deletions
|
@ -619,6 +619,10 @@ std::vector<std::shared_ptr<Installable>> SourceExprCommand::parseInstallables(
|
||||||
state->evalFile(lookupFileArg(*state, *file), *vFile);
|
state->evalFile(lookupFileArg(*state, *file), *vFile);
|
||||||
else {
|
else {
|
||||||
auto e = state->parseExprFromString(*expr, absPath("."));
|
auto e = state->parseExprFromString(*expr, absPath("."));
|
||||||
|
|
||||||
|
int x = 5;
|
||||||
|
std::cout << "x =" << x << std::endl;
|
||||||
|
|
||||||
state->eval(e, *vFile);
|
state->eval(e, *vFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -315,12 +315,16 @@ void ExprAttrs::bindVars(const std::shared_ptr<const StaticEnv> &env)
|
||||||
// auto dynamicEnv(env);
|
// auto dynamicEnv(env);
|
||||||
|
|
||||||
if (recursive) {
|
if (recursive) {
|
||||||
|
std::cout << "recursive" << std::endl;
|
||||||
// dynamicEnv = newEnv.get();
|
// dynamicEnv = newEnv.get();
|
||||||
auto newEnv = std::shared_ptr<StaticEnv>(new StaticEnv(false, env.get())); // also make shared_ptr?
|
// also make shared_ptr?
|
||||||
|
auto newEnv = std::shared_ptr<StaticEnv>(new StaticEnv(false, env.get()));
|
||||||
|
|
||||||
unsigned int displ = 0;
|
unsigned int displ = 0;
|
||||||
for (auto & i : attrs)
|
for (auto & i : attrs) {
|
||||||
|
std::cout << "newenvvar: " << i.first << std::endl;
|
||||||
newEnv->vars[i.first] = i.second.displ = displ++;
|
newEnv->vars[i.first] = i.second.displ = displ++;
|
||||||
|
}
|
||||||
|
|
||||||
for (auto & i : attrs)
|
for (auto & i : attrs)
|
||||||
i.second.e->bindVars(i.second.inherited ? env : newEnv);
|
i.second.e->bindVars(i.second.inherited ? env : newEnv);
|
||||||
|
@ -330,8 +334,8 @@ void ExprAttrs::bindVars(const std::shared_ptr<const StaticEnv> &env)
|
||||||
i.valueExpr->bindVars(newEnv);
|
i.valueExpr->bindVars(newEnv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
|
std::cout << "NOT recursive" << std::endl;
|
||||||
for (auto & i : attrs)
|
for (auto & i : attrs)
|
||||||
i.second.e->bindVars(env);
|
i.second.e->bindVars(env);
|
||||||
|
|
||||||
|
@ -409,7 +413,7 @@ void ExprWith::bindVars(const std::shared_ptr<const StaticEnv> &env)
|
||||||
body->show(std::cout);
|
body->show(std::cout);
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
|
|
||||||
std::cout << "ExprWith::newenv: " << newEnv->vars.size() << std::endl;
|
std::cout << "ExprWith::newenv: (iswith, size); (" << newEnv->isWith << ", " << newEnv->vars.size() << ") " << std::endl;
|
||||||
for (auto i = newEnv->vars.begin(); i != newEnv->vars.end(); ++i)
|
for (auto i = newEnv->vars.begin(); i != newEnv->vars.end(); ++i)
|
||||||
std::cout << "EvalState::parse newEnv " << i->first << std::endl;
|
std::cout << "EvalState::parse newEnv " << i->first << std::endl;
|
||||||
|
|
||||||
|
@ -418,6 +422,35 @@ void ExprWith::bindVars(const std::shared_ptr<const StaticEnv> &env)
|
||||||
std::cout << " ExprWith::bindVars 3" << std::endl;
|
std::cout << " ExprWith::bindVars 3" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
void ExprWith::bindVars(const StaticEnv & env)
|
||||||
|
{
|
||||||
|
// Does this `with' have an enclosing `with'? If so, record its
|
||||||
|
// level so that `lookupVar' can look up variables in the previous
|
||||||
|
// `with' if this one doesn't contain the desired attribute.
|
||||||
|
const StaticEnv * curEnv;
|
||||||
|
unsigned int level;
|
||||||
|
prevWith = 0;
|
||||||
|
for (curEnv = &env, level = 1; curEnv; curEnv = curEnv->up, level++)
|
||||||
|
if (curEnv->isWith) {
|
||||||
|
prevWith = level;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
attrs->bindVars(env);
|
||||||
|
std::cout << "ExprWith::bindVars env: " << env.vars.size(); // add std::endl;
|
||||||
|
for (auto i = env.vars.begin(); i != env.vars.end(); ++i)
|
||||||
|
{
|
||||||
|
std::cout << i->first << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
StaticEnv newEnv(true, &env);
|
||||||
|
body->bindVars(newEnv);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ExprIf::bindVars(const std::shared_ptr<const StaticEnv> &env)
|
void ExprIf::bindVars(const std::shared_ptr<const StaticEnv> &env)
|
||||||
{
|
{
|
||||||
cond->bindVars(env);
|
cond->bindVars(env);
|
||||||
|
|
|
@ -574,7 +574,7 @@ namespace nix {
|
||||||
Expr * EvalState::parse(const char * text, FileOrigin origin,
|
Expr * EvalState::parse(const char * text, FileOrigin origin,
|
||||||
const Path & path, const Path & basePath, std::shared_ptr<StaticEnv> & staticEnv)
|
const Path & path, const Path & basePath, std::shared_ptr<StaticEnv> & staticEnv)
|
||||||
{
|
{
|
||||||
std::cout << "EvalState::parse " << std::endl;
|
std::cout << "EvalState::parse " << text << std::endl;
|
||||||
for (auto i = staticEnv->vars.begin(); i != staticEnv->vars.end(); ++i)
|
for (auto i = staticEnv->vars.begin(); i != staticEnv->vars.end(); ++i)
|
||||||
std::cout << "EvalState::parse staticEnv " << i->first << std::endl;
|
std::cout << "EvalState::parse staticEnv " << i->first << std::endl;
|
||||||
|
|
||||||
|
|
|
@ -110,6 +110,9 @@ static void mkOutputString(EvalState & state, Value & v,
|
||||||
argument. */
|
argument. */
|
||||||
static void import(EvalState & state, const Pos & pos, Value & vPath, Value * vScope, Value & v)
|
static void import(EvalState & state, const Pos & pos, Value & vPath, Value * vScope, Value & v)
|
||||||
{
|
{
|
||||||
|
std::cout << " IMPORT " << std::endl;
|
||||||
|
std::cout << " import " << std::endl;
|
||||||
|
std::cout << " IMPORT " << std::endl;
|
||||||
std::cout << " import " << std::endl;
|
std::cout << " import " << std::endl;
|
||||||
|
|
||||||
PathSet context;
|
PathSet context;
|
||||||
|
|
Loading…
Reference in a new issue