mirror of
https://github.com/NixOS/nix
synced 2025-06-28 13:41:15 +02:00
use plain errPos instead of nixCode; fix tests
This commit is contained in:
parent
d0e78fbb03
commit
1d43a6e123
15 changed files with 116 additions and 153 deletions
|
@ -66,18 +66,17 @@ namespace nix {
|
|||
static void dupAttr(const AttrPath & attrPath, const Pos & pos, const Pos & prevPos)
|
||||
{
|
||||
throw ParseError({
|
||||
.hint = hintfmt("attribute '%1%' already defined at %2%",
|
||||
.hint = hintfmt("attribute '%1%' already defined at %2%",
|
||||
showAttrPath(attrPath), prevPos),
|
||||
.nixCode = NixCode { .errPos = pos },
|
||||
.errPos = pos
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
static void dupAttr(Symbol attr, const Pos & pos, const Pos & prevPos)
|
||||
{
|
||||
throw ParseError({
|
||||
.hint = hintfmt("attribute '%1%' already defined at %2%", attr, prevPos),
|
||||
.nixCode = NixCode { .errPos = pos },
|
||||
.errPos = pos
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -149,7 +148,7 @@ static void addFormal(const Pos & pos, Formals * formals, const Formal & formal)
|
|||
throw ParseError({
|
||||
.hint = hintfmt("duplicate formal function argument '%1%'",
|
||||
formal.name),
|
||||
.nixCode = NixCode { .errPos = pos },
|
||||
.errPos = pos
|
||||
});
|
||||
formals->formals.push_front(formal);
|
||||
}
|
||||
|
@ -260,7 +259,7 @@ void yyerror(YYLTYPE * loc, yyscan_t scanner, ParseData * data, const char * err
|
|||
{
|
||||
data->error = {
|
||||
.hint = hintfmt(error),
|
||||
.nixCode = NixCode { .errPos = makeCurPos(*loc, data) }
|
||||
.errPos = makeCurPos(*loc, data)
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -340,7 +339,7 @@ expr_function
|
|||
{ if (!$2->dynamicAttrs.empty())
|
||||
throw ParseError({
|
||||
.hint = hintfmt("dynamic attributes not allowed in let"),
|
||||
.nixCode = NixCode { .errPos = CUR_POS },
|
||||
.errPos = CUR_POS
|
||||
});
|
||||
$$ = new ExprLet($2, $4);
|
||||
}
|
||||
|
@ -420,7 +419,7 @@ expr_simple
|
|||
if (noURLLiterals)
|
||||
throw ParseError({
|
||||
.hint = hintfmt("URL literals are disabled"),
|
||||
.nixCode = NixCode { .errPos = CUR_POS }
|
||||
.errPos = CUR_POS
|
||||
});
|
||||
$$ = new ExprString(data->symbols.create($1));
|
||||
}
|
||||
|
@ -493,7 +492,7 @@ attrs
|
|||
} else
|
||||
throw ParseError({
|
||||
.hint = hintfmt("dynamic attributes not allowed in inherit"),
|
||||
.nixCode = NixCode { .errPos = makeCurPos(@2, data) },
|
||||
.errPos = makeCurPos(@2, data)
|
||||
});
|
||||
}
|
||||
| { $$ = new AttrPath; }
|
||||
|
@ -705,7 +704,7 @@ Path EvalState::findFile(SearchPath & searchPath, const string & path, const Pos
|
|||
? "cannot look up '<%s>' in pure evaluation mode (use '--impure' to override)"
|
||||
: "file '%s' was not found in the Nix search path (add it using $NIX_PATH or -I)",
|
||||
path),
|
||||
.nixCode = NixCode { .errPos = pos }
|
||||
.errPos = pos
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue