about summary refs log tree commit diff
path: root/src/libexpr/parser.y
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-04-04T15·53+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-04-04T16·59+0200
commitb72c8d2e5b5bbdc218f7c00694027cdd75b6a584 (patch)
tree7173dfa3232031d57e12348d16e5255006f1f03d /src/libexpr/parser.y
parent3f8e1f56825f3ec2a9d99715609e362fe5e5a218 (diff)
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'
Diffstat (limited to 'src/libexpr/parser.y')
-rw-r--r--src/libexpr/parser.y6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libexpr/parser.y b/src/libexpr/parser.y
index ab0b862246a0..b8d4d7ca0101 100644
--- a/src/libexpr/parser.y
+++ b/src/libexpr/parser.y
@@ -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; }
   ;