mirror of
https://github.com/NixOS/nix.git
synced 2024-11-22 23:02:27 +00:00
c34e96f7e0
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; }
5 lines
156 B
Nix
5 lines
156 B
Nix
let
|
|
fun = { foo }: {};
|
|
pos = builtins.unsafeGetAttrPos "foo" (builtins.functionArgs fun);
|
|
in { inherit (pos) column line; file = baseNameOf pos.file; }
|