forked from lix-project/lix
line endings
This commit is contained in:
parent
ca6cba8b81
commit
172a83d22a
|
@ -125,7 +125,7 @@ ref<EvalState> EvalCommand::getEvalState()
|
||||||
std::unique_ptr<DebugTraceStacker>(
|
std::unique_ptr<DebugTraceStacker>(
|
||||||
new DebugTraceStacker(
|
new DebugTraceStacker(
|
||||||
*evalState,
|
*evalState,
|
||||||
DebugTrace
|
DebugTrace
|
||||||
{.pos = (error->info().errPos ? *error->info().errPos : evalState->positions[expr.getPos()]),
|
{.pos = (error->info().errPos ? *error->info().errPos : evalState->positions[expr.getPos()]),
|
||||||
.expr = expr,
|
.expr = expr,
|
||||||
.env = env,
|
.env = env,
|
||||||
|
|
|
@ -276,10 +276,10 @@ void NixRepl::mainLoop(const std::vector<std::string> & files)
|
||||||
printMsg(lvlError, e.msg());
|
printMsg(lvlError, e.msg());
|
||||||
}
|
}
|
||||||
} catch (EvalError & e) {
|
} catch (EvalError & e) {
|
||||||
// in debugger mode, an EvalError should trigger another repl session.
|
// in debugger mode, an EvalError should trigger another repl session.
|
||||||
// when that session returns the exception will land here. No need to show it again;
|
// when that session returns the exception will land here. No need to show it again;
|
||||||
// show the error for this repl session instead.
|
// show the error for this repl session instead.
|
||||||
if (debuggerHook && !this->state->debugTraces.empty())
|
if (debuggerHook && !this->state->debugTraces.empty())
|
||||||
showDebugTrace(std::cout, this->state->positions, this->state->debugTraces.front());
|
showDebugTrace(std::cout, this->state->positions, this->state->debugTraces.front());
|
||||||
else
|
else
|
||||||
printMsg(lvlError, e.msg());
|
printMsg(lvlError, e.msg());
|
||||||
|
@ -511,7 +511,7 @@ bool NixRepl::processLine(std::string line)
|
||||||
if (arg == "stack") {
|
if (arg == "stack") {
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
for (auto iter = this->state->debugTraces.begin();
|
for (auto iter = this->state->debugTraces.begin();
|
||||||
iter != this->state->debugTraces.end();
|
iter != this->state->debugTraces.end();
|
||||||
++iter, ++idx) {
|
++iter, ++idx) {
|
||||||
std::cout << "\n" << ANSI_BLUE << idx << ANSI_NORMAL << ": ";
|
std::cout << "\n" << ANSI_BLUE << idx << ANSI_NORMAL << ": ";
|
||||||
showDebugTrace(std::cout, this->state->positions, *iter);
|
showDebugTrace(std::cout, this->state->positions, *iter);
|
||||||
|
@ -519,7 +519,7 @@ bool NixRepl::processLine(std::string line)
|
||||||
} else if (arg == "env") {
|
} else if (arg == "env") {
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
for (auto iter = this->state->debugTraces.begin();
|
for (auto iter = this->state->debugTraces.begin();
|
||||||
iter != this->state->debugTraces.end();
|
iter != this->state->debugTraces.end();
|
||||||
++iter, ++idx) {
|
++iter, ++idx) {
|
||||||
if (idx == this->debugTraceIndex)
|
if (idx == this->debugTraceIndex)
|
||||||
{
|
{
|
||||||
|
@ -539,7 +539,7 @@ bool NixRepl::processLine(std::string line)
|
||||||
|
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
for (auto iter = this->state->debugTraces.begin();
|
for (auto iter = this->state->debugTraces.begin();
|
||||||
iter != this->state->debugTraces.end();
|
iter != this->state->debugTraces.end();
|
||||||
++iter, ++idx) {
|
++iter, ++idx) {
|
||||||
if (idx == this->debugTraceIndex)
|
if (idx == this->debugTraceIndex)
|
||||||
{
|
{
|
||||||
|
|
|
@ -730,7 +730,7 @@ void printWithBindings(const SymbolTable &st, const Env &env)
|
||||||
{
|
{
|
||||||
if (env.type == Env::HasWithAttrs)
|
if (env.type == Env::HasWithAttrs)
|
||||||
{
|
{
|
||||||
std::cout << "with: ";
|
std::cout << "with: ";
|
||||||
std::cout << ANSI_MAGENTA;
|
std::cout << ANSI_MAGENTA;
|
||||||
Bindings::iterator j = env.values[0]->attrs->begin();
|
Bindings::iterator j = env.values[0]->attrs->begin();
|
||||||
while (j != env.values[0]->attrs->end()) {
|
while (j != env.values[0]->attrs->end()) {
|
||||||
|
@ -747,13 +747,13 @@ void printEnvBindings(const SymbolTable &st, const StaticEnv &se, const Env &env
|
||||||
std::cout << "Env level " << lvl << std::endl;
|
std::cout << "Env level " << lvl << std::endl;
|
||||||
|
|
||||||
if (se.up && env.up) {
|
if (se.up && env.up) {
|
||||||
std::cout << "static: ";
|
std::cout << "static: ";
|
||||||
printStaticEnvBindings(st, se);
|
printStaticEnvBindings(st, se);
|
||||||
printWithBindings(st, env);
|
printWithBindings(st, env);
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
printEnvBindings(st, *se.up, *env.up, ++lvl);
|
printEnvBindings(st, *se.up, *env.up, ++lvl);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cout << ANSI_MAGENTA;
|
std::cout << ANSI_MAGENTA;
|
||||||
// for the top level, don't print the double underscore ones; they are in builtins.
|
// for the top level, don't print the double underscore ones; they are in builtins.
|
||||||
|
@ -784,7 +784,7 @@ void mapStaticEnvBindings(const SymbolTable &st, const StaticEnv &se, const Env
|
||||||
{
|
{
|
||||||
// add bindings for the next level up first, so that the bindings for this level
|
// add bindings for the next level up first, so that the bindings for this level
|
||||||
// override the higher levels.
|
// override the higher levels.
|
||||||
// The top level bindings (builtins) are skipped since they are added for us by initEnv()
|
// The top level bindings (builtins) are skipped since they are added for us by initEnv()
|
||||||
if (env.up && se.up) {
|
if (env.up && se.up) {
|
||||||
mapStaticEnvBindings(st, *se.up, *env.up, vm);
|
mapStaticEnvBindings(st, *se.up, *env.up, vm);
|
||||||
|
|
||||||
|
@ -1086,13 +1086,13 @@ void EvalState::addErrorTrace(Error & e, const PosIdx pos, const char * s, const
|
||||||
e.addTrace(positions[pos], s, s2);
|
e.addTrace(positions[pos], s, s2);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<DebugTraceStacker> makeDebugTraceStacker(EvalState &state, Expr &expr, Env &env,
|
std::unique_ptr<DebugTraceStacker> makeDebugTraceStacker(EvalState &state, Expr &expr, Env &env,
|
||||||
std::optional<ErrPos> pos, const char * s, const std::string & s2)
|
std::optional<ErrPos> pos, const char * s, const std::string & s2)
|
||||||
{
|
{
|
||||||
return std::unique_ptr<DebugTraceStacker>(
|
return std::unique_ptr<DebugTraceStacker>(
|
||||||
new DebugTraceStacker(
|
new DebugTraceStacker(
|
||||||
state,
|
state,
|
||||||
DebugTrace
|
DebugTrace
|
||||||
{.pos = pos,
|
{.pos = pos,
|
||||||
.expr = expr,
|
.expr = expr,
|
||||||
.env = env,
|
.env = env,
|
||||||
|
|
|
@ -352,7 +352,7 @@ void ExprVar::bindVars(const EvalState & es, const std::shared_ptr<const StaticE
|
||||||
/* Otherwise, the variable must be obtained from the nearest
|
/* Otherwise, the variable must be obtained from the nearest
|
||||||
enclosing `with'. If there is no `with', then we can issue an
|
enclosing `with'. If there is no `with', then we can issue an
|
||||||
"undefined variable" error now. */
|
"undefined variable" error now. */
|
||||||
if (withLevel == -1)
|
if (withLevel == -1)
|
||||||
{
|
{
|
||||||
throw UndefinedVarError({
|
throw UndefinedVarError({
|
||||||
.msg = hintfmt("undefined variable '%1%'", es.symbols[name]),
|
.msg = hintfmt("undefined variable '%1%'", es.symbols[name]),
|
||||||
|
@ -392,7 +392,7 @@ void ExprAttrs::bindVars(const EvalState & es, const std::shared_ptr<const Stati
|
||||||
staticenv = env;
|
staticenv = env;
|
||||||
|
|
||||||
if (recursive) {
|
if (recursive) {
|
||||||
auto newEnv = std::shared_ptr<StaticEnv>(new StaticEnv(false, env.get(), recursive ? attrs.size() : 0));
|
auto newEnv = std::shared_ptr<StaticEnv>(new StaticEnv(false, env.get(), recursive ? attrs.size() : 0));
|
||||||
|
|
||||||
Displacement displ = 0;
|
Displacement displ = 0;
|
||||||
for (auto & i : attrs)
|
for (auto & i : attrs)
|
||||||
|
|
Loading…
Reference in a new issue