mirror of
https://github.com/NixOS/nix
synced 2025-06-28 17:51:15 +02:00
Include position info in function application
This allows error messages like: error: the anonymous function at `/etc/nixos/configuration.nix:1:1' called without required argument `foo', at `/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix:77:59'
This commit is contained in:
parent
3f8e1f5682
commit
b72c8d2e5b
7 changed files with 45 additions and 22 deletions
|
@ -224,7 +224,7 @@ void backToString(yyscan_t scanner);
|
|||
void backToIndString(yyscan_t scanner);
|
||||
|
||||
|
||||
static Pos makeCurPos(const YYLTYPE & loc, ParseData * data)
|
||||
static inline Pos makeCurPos(const YYLTYPE & loc, ParseData * data)
|
||||
{
|
||||
return Pos(data->path, loc.first_line, loc.first_column);
|
||||
}
|
||||
|
@ -355,7 +355,7 @@ expr_op
|
|||
|
||||
expr_app
|
||||
: expr_app expr_select
|
||||
{ $$ = new ExprApp($1, $2); }
|
||||
{ $$ = new ExprApp(CUR_POS, $1, $2); }
|
||||
| expr_select { $$ = $1; }
|
||||
;
|
||||
|
||||
|
@ -367,7 +367,7 @@ expr_select
|
|||
| /* Backwards compatibility: because Nixpkgs has a rarely used
|
||||
function named ‘or’, allow stuff like ‘map or [...]’. */
|
||||
expr_simple OR_KW
|
||||
{ $$ = new ExprApp($1, new ExprVar(CUR_POS, data->symbols.create("or"))); }
|
||||
{ $$ = new ExprApp(CUR_POS, $1, new ExprVar(CUR_POS, data->symbols.create("or"))); }
|
||||
| expr_simple { $$ = $1; }
|
||||
;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue