diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index e92ed50fd..1410e5144 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -21,7 +21,8 @@ int cacheTerms; bool shortCircuit; bool closedTerms; // don't substitute under terms known to be closed -bool substCache; // memoization of the term substitution function +bool substCache; // memoization of the term substitution function +bool posInfo; // attach position info to functions, assertions, attributes #define maxActiveCalls 4096 @@ -43,6 +44,7 @@ EvalState::EvalState() strictMode = getEnv("NIX_STRICT", "0") == "1"; closedTerms = getEnv("NIX_CLOSED_TERMS", "1") == "1"; substCache = getEnv("NIX_SUBST_CACHE", "1") == "1"; + posInfo = getEnv("NIX_POS_INFO", "1") == "1"; ATprotectMemory(activeCalls, maxActiveCalls); } diff --git a/src/libexpr/parser.y b/src/libexpr/parser.y index e943bdc97..93dd653c0 100644 --- a/src/libexpr/parser.y +++ b/src/libexpr/parser.y @@ -70,11 +70,13 @@ static Expr fixAttrs(int recursive, ATermList as) void backToString(yyscan_t scanner); + +extern bool posInfo; static Pos makeCurPos(YYLTYPE * loc, ParseData * data) { - return makePos(toATerm(data->path), - loc->first_line, loc->first_column); + return posInfo ? makePos(toATerm(data->path), + loc->first_line, loc->first_column) : makeNoPos(); } #define CUR_POS makeCurPos(yylocp, data)