mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-11 00:36:20 +02:00
comment out debugs
This commit is contained in:
parent
98eb13691a
commit
427fb8d158
5 changed files with 41 additions and 41 deletions
|
@ -618,10 +618,10 @@ std::vector<std::shared_ptr<Installable>> SourceExprCommand::parseInstallables(
|
||||||
if (file)
|
if (file)
|
||||||
state->evalFile(lookupFileArg(*state, *file), *vFile);
|
state->evalFile(lookupFileArg(*state, *file), *vFile);
|
||||||
else {
|
else {
|
||||||
std::cout << "pre parseExprFromString" << std::endl;
|
// std::cout << "pre parseExprFromString" << std::endl;
|
||||||
auto e = state->parseExprFromString(*expr, absPath("."));
|
auto e = state->parseExprFromString(*expr, absPath("."));
|
||||||
|
|
||||||
std::cout << "pre eval" << std::endl;
|
// std::cout << "pre eval" << std::endl;
|
||||||
|
|
||||||
state->eval(e, *vFile);
|
state->eval(e, *vFile);
|
||||||
}
|
}
|
||||||
|
|
|
@ -742,13 +742,13 @@ valmap * mapStaticEnvBindings(const StaticEnv &se, const Env &env)
|
||||||
|
|
||||||
void printEnvPosChain(const Env &env, int lv )
|
void printEnvPosChain(const Env &env, int lv )
|
||||||
{
|
{
|
||||||
std::cout << "printEnvPosChain " << lv << std::endl;
|
// std::cout << "printEnvPosChain " << lv << std::endl;
|
||||||
|
|
||||||
std::cout << "env" << env.values[0] << std::endl;
|
// std::cout << "env" << env.values[0] << std::endl;
|
||||||
|
|
||||||
if (env.values[0] && env.values[0]->type() == nAttrs) {
|
if (env.values[0] && env.values[0]->type() == nAttrs) {
|
||||||
std::cout << "im in the loop" << std::endl;
|
// std::cout << "im in the loop" << std::endl;
|
||||||
std::cout << "pos " << env.values[0]->attrs->pos << std::endl;
|
// std::cout << "pos " << env.values[0]->attrs->pos << std::endl;
|
||||||
if (env.values[0]->attrs->pos) {
|
if (env.values[0]->attrs->pos) {
|
||||||
ErrPos ep(*env.values[0]->attrs->pos);
|
ErrPos ep(*env.values[0]->attrs->pos);
|
||||||
auto loc = getCodeLines(ep);
|
auto loc = getCodeLines(ep);
|
||||||
|
@ -760,7 +760,7 @@ void printEnvPosChain(const Env &env, int lv )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "next env : " << env.up << std::endl;
|
// std::cout << "next env : " << env.up << std::endl;
|
||||||
|
|
||||||
if (env.up) {
|
if (env.up) {
|
||||||
printEnvPosChain(*env.up, ++lv);
|
printEnvPosChain(*env.up, ++lv);
|
||||||
|
@ -970,7 +970,7 @@ LocalNoInlineNoReturn(void throwAssertionError(const Pos & pos, const char * s,
|
||||||
|
|
||||||
LocalNoInlineNoReturn(void throwUndefinedVarError(const Pos & pos, const char * s, const string & s1, Env & env, Expr *expr))
|
LocalNoInlineNoReturn(void throwUndefinedVarError(const Pos & pos, const char * s, const string & s1, Env & env, Expr *expr))
|
||||||
{
|
{
|
||||||
std::cout << "throwUndefinedVarError" << std::endl;
|
// std::cout << "throwUndefinedVarError" << std::endl;
|
||||||
|
|
||||||
// auto delenv = std::unique_ptr<valmap>(env);
|
// auto delenv = std::unique_ptr<valmap>(env);
|
||||||
auto error = UndefinedVarError({
|
auto error = UndefinedVarError({
|
||||||
|
@ -978,7 +978,7 @@ LocalNoInlineNoReturn(void throwUndefinedVarError(const Pos & pos, const char *
|
||||||
.errPos = pos
|
.errPos = pos
|
||||||
});
|
});
|
||||||
|
|
||||||
std::cout << "pre debuggerHook" << std::endl;
|
// std::cout << "pre debuggerHook" << std::endl;
|
||||||
|
|
||||||
if (debuggerHook && expr)
|
if (debuggerHook && expr)
|
||||||
debuggerHook(error, env, *expr);
|
debuggerHook(error, env, *expr);
|
||||||
|
@ -1038,7 +1038,7 @@ void mkPath(Value & v, const char * s)
|
||||||
|
|
||||||
inline Value * EvalState::lookupVar(Env * env, const ExprVar & var, bool noEval)
|
inline Value * EvalState::lookupVar(Env * env, const ExprVar & var, bool noEval)
|
||||||
{
|
{
|
||||||
std::cout << " EvalState::lookupVar" << var << std::endl;
|
// std::cout << " EvalState::lookupVar" << var << std::endl;
|
||||||
|
|
||||||
for (size_t l = var.level; l; --l, env = env->up) ;
|
for (size_t l = var.level; l; --l, env = env->up) ;
|
||||||
|
|
||||||
|
@ -1058,7 +1058,7 @@ inline Value * EvalState::lookupVar(Env * env, const ExprVar & var, bool noEval)
|
||||||
return j->value;
|
return j->value;
|
||||||
}
|
}
|
||||||
if (!env->prevWith) {
|
if (!env->prevWith) {
|
||||||
std::cout << "pre throwUndefinedVarError" << std::endl;
|
// std::cout << "pre throwUndefinedVarError" << std::endl;
|
||||||
throwUndefinedVarError(var.pos, "undefined variable '%1%'", var.name, *env, 0);
|
throwUndefinedVarError(var.pos, "undefined variable '%1%'", var.name, *env, 0);
|
||||||
}
|
}
|
||||||
for (size_t l = env->prevWith; l; --l, env = env->up) ;
|
for (size_t l = env->prevWith; l; --l, env = env->up) ;
|
||||||
|
|
|
@ -274,12 +274,12 @@ void ExprVar::bindVars(const std::shared_ptr<const StaticEnv> &env)
|
||||||
/* Check whether the variable appears in the environment. If so,
|
/* Check whether the variable appears in the environment. If so,
|
||||||
set its level and displacement. */
|
set its level and displacement. */
|
||||||
|
|
||||||
std::cout << "ExprVar::bindVars " << name << std::endl;
|
// std::cout << "ExprVar::bindVars " << name << std::endl;
|
||||||
|
|
||||||
int a = 10;
|
int a = 10;
|
||||||
if (name == "callPackage") {
|
if (name == "callPackage") {
|
||||||
a++; // try to make code that I can put a breakpoint on...
|
a++; // try to make code that I can put a breakpoint on...
|
||||||
std::cout << "meh" << a + 10 << std::endl;
|
// std::cout << "meh" << a + 10 << std::endl;
|
||||||
int withLevel = -1;
|
int withLevel = -1;
|
||||||
fromWith = true;
|
fromWith = true;
|
||||||
// this->level = withLevel;
|
// this->level = withLevel;
|
||||||
|
@ -310,7 +310,7 @@ void ExprVar::bindVars(const std::shared_ptr<const StaticEnv> &env)
|
||||||
"undefined variable" error now. */
|
"undefined variable" error now. */
|
||||||
if (withLevel == -1)
|
if (withLevel == -1)
|
||||||
{
|
{
|
||||||
std::cout << " throw UndefinedVarError({" << std::endl;
|
// std::cout << " throw UndefinedVarError({" << std::endl;
|
||||||
throw UndefinedVarError({
|
throw UndefinedVarError({
|
||||||
.msg = hintfmt("undefined variable (ExprVar bindvars) '%1%'", name),
|
.msg = hintfmt("undefined variable (ExprVar bindvars) '%1%'", name),
|
||||||
.errPos = pos
|
.errPos = pos
|
||||||
|
@ -349,18 +349,18 @@ void ExprAttrs::bindVars(const std::shared_ptr<const StaticEnv> &env)
|
||||||
if (debuggerHook)
|
if (debuggerHook)
|
||||||
staticenv = env;
|
staticenv = env;
|
||||||
|
|
||||||
std::cout << "ExprAttrs::bindVars" << std::endl;
|
// std::cout << "ExprAttrs::bindVars" << std::endl;
|
||||||
// auto dynamicEnv(env);
|
// auto dynamicEnv(env);
|
||||||
|
|
||||||
if (recursive) {
|
if (recursive) {
|
||||||
std::cout << "recursive" << std::endl;
|
// std::cout << "recursive" << std::endl;
|
||||||
// dynamicEnv = newEnv.get();
|
// dynamicEnv = newEnv.get();
|
||||||
// also make shared_ptr?
|
// also make shared_ptr?
|
||||||
auto newEnv = std::shared_ptr<StaticEnv>(new StaticEnv(false, env.get()));
|
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;
|
// std::cout << "newenvvar: " << i.first << std::endl;
|
||||||
newEnv->vars[i.first] = i.second.displ = displ++;
|
newEnv->vars[i.first] = i.second.displ = displ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -373,7 +373,7 @@ void ExprAttrs::bindVars(const std::shared_ptr<const StaticEnv> &env)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
std::cout << "NOT recursive" << std::endl;
|
// std::cout << "NOT recursive" << std::endl;
|
||||||
for (auto & i : attrs)
|
for (auto & i : attrs)
|
||||||
i.second.e->bindVars(env);
|
i.second.e->bindVars(env);
|
||||||
|
|
||||||
|
@ -383,7 +383,7 @@ void ExprAttrs::bindVars(const std::shared_ptr<const StaticEnv> &env)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "ExprAttrs::bindVars end" << std::endl;
|
// std::cout << "ExprAttrs::bindVars end" << std::endl;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -440,7 +440,7 @@ void ExprWith::bindVars(const std::shared_ptr<const StaticEnv> &env)
|
||||||
if (debuggerHook)
|
if (debuggerHook)
|
||||||
staticenv = env;
|
staticenv = env;
|
||||||
|
|
||||||
std::cout << " ExprWith::bindVars " << std::endl;
|
// std::cout << " ExprWith::bindVars " << std::endl;
|
||||||
/* Does this `with' have an enclosing `with'? If so, record its
|
/* Does this `with' have an enclosing `with'? If so, record its
|
||||||
level so that `lookupVar' can look up variables in the previous
|
level so that `lookupVar' can look up variables in the previous
|
||||||
`with' if this one doesn't contain the desired attribute. */
|
`with' if this one doesn't contain the desired attribute. */
|
||||||
|
@ -453,24 +453,24 @@ void ExprWith::bindVars(const std::shared_ptr<const StaticEnv> &env)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << " ExprWith::bindVars 1" << std::endl;
|
// std::cout << " ExprWith::bindVars 1" << std::endl;
|
||||||
attrs->show(std::cout);
|
// attrs->show(std::cout);
|
||||||
std::cout << std::endl;
|
// std::cout << std::endl;
|
||||||
attrs->bindVars(env);
|
attrs->bindVars(env);
|
||||||
auto newEnv = std::shared_ptr<StaticEnv>(new StaticEnv(true, env.get())); // also make shared_ptr?
|
auto newEnv = std::shared_ptr<StaticEnv>(new StaticEnv(true, env.get())); // also make shared_ptr?
|
||||||
std::cout << " ExprWith::bindVars 2" << std::endl;
|
// std::cout << " ExprWith::bindVars 2" << std::endl;
|
||||||
std::cout << " body: " << std::endl;
|
// std::cout << " body: " << std::endl;
|
||||||
body->show(std::cout);
|
// body->show(std::cout);
|
||||||
std::cout << std::endl;
|
// std::cout << std::endl;
|
||||||
|
|
||||||
std::cout << "ExprWith::newenv: (iswith, size); (" << newEnv->isWith << ", " << 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;
|
||||||
|
|
||||||
|
|
||||||
std::cout << " body->bindVars(newEnv), iswith: " << newEnv->isWith << std::endl;
|
// std::cout << " body->bindVars(newEnv), iswith: " << newEnv->isWith << std::endl;
|
||||||
body->bindVars(newEnv);
|
body->bindVars(newEnv);
|
||||||
std::cout << " ExprWith::bindVars 3" << std::endl;
|
// std::cout << " ExprWith::bindVars 3" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -574,9 +574,9 @@ 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 " << text << 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;
|
||||||
|
|
||||||
yyscan_t scanner;
|
yyscan_t scanner;
|
||||||
ParseData data(*this);
|
ParseData data(*this);
|
||||||
|
@ -602,11 +602,11 @@ Expr * EvalState::parse(const char * text, FileOrigin origin,
|
||||||
if (res) throw ParseError(data.error.value());
|
if (res) throw ParseError(data.error.value());
|
||||||
|
|
||||||
|
|
||||||
std::cout << "EvalState::parse pre bindvars " << std::endl;
|
// std::cout << "EvalState::parse pre bindvars " << std::endl;
|
||||||
|
|
||||||
data.result->bindVars(staticEnv);
|
data.result->bindVars(staticEnv);
|
||||||
|
|
||||||
std::cout << "EvalState::parse post bindVars " << std::endl;
|
// std::cout << "EvalState::parse post bindVars " << std::endl;
|
||||||
|
|
||||||
return data.result;
|
return data.result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,10 +110,10 @@ 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;
|
// std::cout << " IMPORT " << std::endl;
|
||||||
std::cout << " import " << std::endl;
|
// std::cout << " import " << std::endl;
|
||||||
|
|
||||||
PathSet context;
|
PathSet context;
|
||||||
Path path = state.coerceToPath(pos, vPath, context);
|
Path path = state.coerceToPath(pos, vPath, context);
|
||||||
|
|
Loading…
Reference in a new issue