forked from lix-project/lix
more pos reporting
This commit is contained in:
parent
631642c5b4
commit
7c3138844c
|
@ -267,8 +267,12 @@ void ExprVar::bindVars(const StaticEnv & env)
|
||||||
/* 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) throw UndefinedVarError("undefined variable '%1%' at %2%", name, pos);
|
if (withLevel == -1)
|
||||||
|
throw UndefinedVarError(
|
||||||
|
ErrorInfo {
|
||||||
|
.hint = hintfmt("undefined variable '%1%'", name),
|
||||||
|
.nixCode = NixCode { .errPos = pos }
|
||||||
|
});
|
||||||
fromWith = true;
|
fromWith = true;
|
||||||
this->level = withLevel;
|
this->level = withLevel;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ namespace nix {
|
||||||
Expr * result;
|
Expr * result;
|
||||||
Path basePath;
|
Path basePath;
|
||||||
Symbol path;
|
Symbol path;
|
||||||
string error;
|
ErrorInfo error;
|
||||||
Symbol sLetBody;
|
Symbol sLetBody;
|
||||||
ParseData(EvalState & state)
|
ParseData(EvalState & state)
|
||||||
: state(state)
|
: state(state)
|
||||||
|
@ -261,8 +261,10 @@ static inline Pos makeCurPos(const YYLTYPE & loc, ParseData * data)
|
||||||
|
|
||||||
void yyerror(YYLTYPE * loc, yyscan_t scanner, ParseData * data, const char * error)
|
void yyerror(YYLTYPE * loc, yyscan_t scanner, ParseData * data, const char * error)
|
||||||
{
|
{
|
||||||
data->error = (format("%1%, at %2%")
|
data->error = ErrorInfo {
|
||||||
% error % makeCurPos(*loc, data)).str();
|
.hint = hintfmt(error),
|
||||||
|
.nixCode = NixCode { .errPos = makeCurPos(*loc, data) }
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue