mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-23 14:36:16 +02:00
more cleanup
This commit is contained in:
parent
4610e02d04
commit
5954cbf3e9
5 changed files with 18 additions and 49 deletions
|
@ -73,14 +73,6 @@ ref<EvalState> EvalCommand::getEvalState()
|
|||
debuggerHook = [evalState{ref<EvalState>(evalState)}](const Error & error, const Env & env, const Expr & expr) {
|
||||
printError("%s\n\n" ANSI_BOLD "Starting REPL to allow you to inspect the current state of the evaluator.\n" ANSI_NORMAL, error.what());
|
||||
|
||||
// printStaticEnvBindings(expr);
|
||||
|
||||
// std::cout << evalState->vCallFlake << std::endl;
|
||||
|
||||
// std::cout << "expr: " << std::endl;
|
||||
// expr.show(std::cout);
|
||||
// std::cout << std::endl;
|
||||
|
||||
if (expr.staticenv)
|
||||
{
|
||||
auto vm = mapStaticEnvBindings(*expr.staticenv.get(), env);
|
||||
|
|
|
@ -434,7 +434,6 @@ bool NixRepl::processLine(string line)
|
|||
<< " :doc <expr> Show documentation of a builtin function\n"
|
||||
<< " :d <cmd> Debug mode commands\n"
|
||||
<< " :d stack Show call stack\n"
|
||||
// << " :d stack <int> Detail for stack level N\n"
|
||||
<< " :d env Show env stack\n"
|
||||
<< " :d error Show current error\n";
|
||||
}
|
||||
|
@ -708,19 +707,6 @@ void NixRepl::addVarToScope(const Symbol & name, Value & v)
|
|||
varNames.insert((string) name);
|
||||
}
|
||||
|
||||
// version from master.
|
||||
// void NixRepl::addVarToScope(const Symbol & name, Value & v)
|
||||
// {
|
||||
// if (displ >= envSize)
|
||||
// throw Error("environment full; cannot add more variables");
|
||||
// if (auto oldVar = staticEnv.find(name); oldVar != staticEnv.vars.end())
|
||||
// staticEnv.vars.erase(oldVar);
|
||||
// staticEnv.vars.emplace_back(name, displ);
|
||||
// staticEnv.sort();
|
||||
// env->values[displ++] = &v;
|
||||
// varNames.insert((string) name);
|
||||
// }
|
||||
|
||||
Expr * NixRepl::parseString(string s)
|
||||
{
|
||||
Expr * e = state->parseExprFromString(s, curDir, staticEnv);
|
||||
|
|
|
@ -672,8 +672,6 @@ std::optional<EvalState::Doc> EvalState::getDoc(Value & v)
|
|||
return {};
|
||||
}
|
||||
|
||||
|
||||
|
||||
void printStaticEnvBindings(const StaticEnv &se, int lvl)
|
||||
{
|
||||
std::cout << "Env level " << lvl << std::endl;
|
||||
|
@ -1112,8 +1110,6 @@ void EvalState::resetFileCache()
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void EvalState::cacheFile(
|
||||
const Path & path,
|
||||
const Path & resolvedPath,
|
||||
|
|
|
@ -99,10 +99,9 @@ struct ExprInt : Expr
|
|||
NixInt n;
|
||||
Value v;
|
||||
ExprInt(NixInt n) : n(n) { mkInt(v, n); };
|
||||
COMMON_METHODS
|
||||
Value * maybeThunk(EvalState & state, Env & env);
|
||||
|
||||
Pos* getPos() { return 0; }
|
||||
COMMON_METHODS
|
||||
};
|
||||
|
||||
struct ExprFloat : Expr
|
||||
|
@ -110,10 +109,9 @@ struct ExprFloat : Expr
|
|||
NixFloat nf;
|
||||
Value v;
|
||||
ExprFloat(NixFloat nf) : nf(nf) { mkFloat(v, nf); };
|
||||
COMMON_METHODS
|
||||
Value * maybeThunk(EvalState & state, Env & env);
|
||||
|
||||
Pos* getPos() { return 0; }
|
||||
COMMON_METHODS
|
||||
};
|
||||
|
||||
struct ExprString : Expr
|
||||
|
@ -121,10 +119,9 @@ struct ExprString : Expr
|
|||
Symbol s;
|
||||
Value v;
|
||||
ExprString(const Symbol & s) : s(s) { mkString(v, s); };
|
||||
COMMON_METHODS
|
||||
Value * maybeThunk(EvalState & state, Env & env);
|
||||
|
||||
Pos* getPos() { return 0; }
|
||||
COMMON_METHODS
|
||||
};
|
||||
|
||||
/* Temporary class used during parsing of indented strings. */
|
||||
|
@ -132,7 +129,6 @@ struct ExprIndStr : Expr
|
|||
{
|
||||
string s;
|
||||
ExprIndStr(const string & s) : s(s) { };
|
||||
|
||||
Pos* getPos() { return 0; }
|
||||
};
|
||||
|
||||
|
@ -141,9 +137,9 @@ struct ExprPath : Expr
|
|||
string s;
|
||||
Value v;
|
||||
ExprPath(const string & s) : s(s) { v.mkPath(this->s.c_str()); };
|
||||
COMMON_METHODS
|
||||
Value * maybeThunk(EvalState & state, Env & env);
|
||||
Pos* getPos() { return 0; }
|
||||
COMMON_METHODS
|
||||
};
|
||||
|
||||
typedef uint32_t Level;
|
||||
|
@ -169,9 +165,9 @@ struct ExprVar : Expr
|
|||
|
||||
ExprVar(const Symbol & name) : name(name) { };
|
||||
ExprVar(const Pos & pos, const Symbol & name) : pos(pos), name(name) { };
|
||||
COMMON_METHODS
|
||||
Value * maybeThunk(EvalState & state, Env & env);
|
||||
Pos* getPos() { return &pos; }
|
||||
COMMON_METHODS
|
||||
};
|
||||
|
||||
struct ExprSelect : Expr
|
||||
|
@ -181,8 +177,8 @@ struct ExprSelect : Expr
|
|||
AttrPath attrPath;
|
||||
ExprSelect(const Pos & pos, Expr * e, const AttrPath & attrPath, Expr * def) : pos(pos), e(e), def(def), attrPath(attrPath) { };
|
||||
ExprSelect(const Pos & pos, Expr * e, const Symbol & name) : pos(pos), e(e), def(0) { attrPath.push_back(AttrName(name)); };
|
||||
COMMON_METHODS
|
||||
Pos* getPos() { return &pos; }
|
||||
COMMON_METHODS
|
||||
};
|
||||
|
||||
struct ExprOpHasAttr : Expr
|
||||
|
@ -190,8 +186,8 @@ struct ExprOpHasAttr : Expr
|
|||
Expr * e;
|
||||
AttrPath attrPath;
|
||||
ExprOpHasAttr(Expr * e, const AttrPath & attrPath) : e(e), attrPath(attrPath) { };
|
||||
COMMON_METHODS
|
||||
Pos* getPos() { return e->getPos(); }
|
||||
COMMON_METHODS
|
||||
};
|
||||
|
||||
struct ExprAttrs : Expr
|
||||
|
@ -219,16 +215,16 @@ struct ExprAttrs : Expr
|
|||
DynamicAttrDefs dynamicAttrs;
|
||||
ExprAttrs(const Pos &pos) : recursive(false), pos(pos) { };
|
||||
ExprAttrs() : recursive(false), pos(noPos) { };
|
||||
COMMON_METHODS
|
||||
Pos* getPos() { return &pos; }
|
||||
COMMON_METHODS
|
||||
};
|
||||
|
||||
struct ExprList : Expr
|
||||
{
|
||||
std::vector<Expr *> elems;
|
||||
ExprList() { };
|
||||
COMMON_METHODS
|
||||
Pos* getPos() { return 0; }
|
||||
COMMON_METHODS
|
||||
};
|
||||
|
||||
struct Formal
|
||||
|
@ -266,8 +262,8 @@ struct ExprLambda : Expr
|
|||
void setName(Symbol & name);
|
||||
string showNamePos() const;
|
||||
inline bool hasFormals() const { return formals != nullptr; }
|
||||
COMMON_METHODS
|
||||
Pos* getPos() { return &pos; }
|
||||
COMMON_METHODS
|
||||
};
|
||||
|
||||
struct ExprCall : Expr
|
||||
|
@ -278,8 +274,8 @@ struct ExprCall : Expr
|
|||
ExprCall(const Pos & pos, Expr * fun, std::vector<Expr *> && args)
|
||||
: fun(fun), args(args), pos(pos)
|
||||
{ }
|
||||
COMMON_METHODS
|
||||
Pos* getPos() { return &pos; }
|
||||
COMMON_METHODS
|
||||
};
|
||||
|
||||
struct ExprLet : Expr
|
||||
|
@ -287,8 +283,8 @@ struct ExprLet : Expr
|
|||
ExprAttrs * attrs;
|
||||
Expr * body;
|
||||
ExprLet(ExprAttrs * attrs, Expr * body) : attrs(attrs), body(body) { };
|
||||
COMMON_METHODS
|
||||
Pos* getPos() { return 0; }
|
||||
COMMON_METHODS
|
||||
};
|
||||
|
||||
struct ExprWith : Expr
|
||||
|
@ -297,8 +293,8 @@ struct ExprWith : Expr
|
|||
Expr * attrs, * body;
|
||||
size_t prevWith;
|
||||
ExprWith(const Pos & pos, Expr * attrs, Expr * body) : pos(pos), attrs(attrs), body(body) { };
|
||||
COMMON_METHODS
|
||||
Pos* getPos() { return &pos; }
|
||||
COMMON_METHODS
|
||||
};
|
||||
|
||||
struct ExprIf : Expr
|
||||
|
@ -306,8 +302,8 @@ struct ExprIf : Expr
|
|||
Pos pos;
|
||||
Expr * cond, * then, * else_;
|
||||
ExprIf(const Pos & pos, Expr * cond, Expr * then, Expr * else_) : pos(pos), cond(cond), then(then), else_(else_) { };
|
||||
COMMON_METHODS
|
||||
Pos* getPos() { return &pos; }
|
||||
COMMON_METHODS
|
||||
};
|
||||
|
||||
struct ExprAssert : Expr
|
||||
|
@ -315,16 +311,16 @@ struct ExprAssert : Expr
|
|||
Pos pos;
|
||||
Expr * cond, * body;
|
||||
ExprAssert(const Pos & pos, Expr * cond, Expr * body) : pos(pos), cond(cond), body(body) { };
|
||||
COMMON_METHODS
|
||||
Pos* getPos() { return &pos; }
|
||||
COMMON_METHODS
|
||||
};
|
||||
|
||||
struct ExprOpNot : Expr
|
||||
{
|
||||
Expr * e;
|
||||
ExprOpNot(Expr * e) : e(e) { };
|
||||
COMMON_METHODS
|
||||
Pos* getPos() { return 0; }
|
||||
COMMON_METHODS
|
||||
};
|
||||
|
||||
#define MakeBinOp(name, s) \
|
||||
|
@ -361,16 +357,16 @@ struct ExprConcatStrings : Expr
|
|||
vector<Expr *> * es;
|
||||
ExprConcatStrings(const Pos & pos, bool forceString, vector<Expr *> * es)
|
||||
: pos(pos), forceString(forceString), es(es) { };
|
||||
COMMON_METHODS
|
||||
Pos* getPos() { return &pos; }
|
||||
COMMON_METHODS
|
||||
};
|
||||
|
||||
struct ExprPos : Expr
|
||||
{
|
||||
Pos pos;
|
||||
ExprPos(const Pos & pos) : pos(pos) { };
|
||||
COMMON_METHODS
|
||||
Pos* getPos() { return &pos; }
|
||||
COMMON_METHODS
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -38,7 +38,6 @@ typedef uint64_t ActivityId;
|
|||
struct LoggerSettings : Config
|
||||
{
|
||||
Setting<bool> showTrace{
|
||||
// this, false, "show-trace",
|
||||
this, false, "show-trace",
|
||||
R"(
|
||||
Where Nix should print out a stack trace in case of Nix
|
||||
|
|
Loading…
Reference in a new issue