1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-07 18:31:49 +02:00

Make function arguments retain position info

This allows querying the location of function arguments. E.g.

  builtins.unsafeGetAttrPos "x" (builtins.functionArgs ({ x }: null))

  => { column = 57; file = "/home/infinisil/src/nix/inst/test.nix"; line = 1; }
This commit is contained in:
Silvan Mosberger 2020-04-02 05:03:58 +02:00
parent a7540294cf
commit c34e96f7e0
No known key found for this signature in database
GPG key ID: E8F1E9EAD284E17D
5 changed files with 14 additions and 5 deletions

View file

@ -0,0 +1,4 @@
let
fun = { foo }: {};
pos = builtins.unsafeGetAttrPos "foo" (builtins.functionArgs fun);
in { inherit (pos) column line; file = baseNameOf pos.file; }