aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr
diff options
context:
space:
mode:
authorjade <lix@jade.fyi>2024-03-30 03:22:53 +0000
committerGerrit Code Review <gerrit@lix>2024-03-30 03:22:53 +0000
commita4f5bb951dbc6fa4ffa2bb56376b38f38b6e9154 (patch)
treebba6147ea60b1a6962d7fea00e784593470518c1 /src/libexpr
parent0b4e7389446de61166aeafa6068d9daf60fd4238 (diff)
parent817322fbfb2a76289d3af9f2810cb01a5cb6ab88 (diff)
Merge "Document ExprLambda fields" into main
Diffstat (limited to 'src/libexpr')
-rw-r--r--src/libexpr/nixexpr.hh10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libexpr/nixexpr.hh b/src/libexpr/nixexpr.hh
index e5755bb99..64a9ddeec 100644
--- a/src/libexpr/nixexpr.hh
+++ b/src/libexpr/nixexpr.hh
@@ -243,6 +243,7 @@ struct Formal
Expr * def;
};
+/** Attribute set destructuring in arguments of a lambda, if present */
struct Formals
{
typedef std::vector<Formal> Formals_;
@@ -270,9 +271,18 @@ struct Formals
struct ExprLambda : Expr
{
+ /** Where the lambda is defined in Nix code. May be falsey if the
+ * position is not known. */
PosIdx pos;
+ /** Name of the lambda. This is set if the lambda is defined in a
+ * let-expression or an attribute set, such that there is a name.
+ * Lambdas may have a falsey symbol as the name if they are anonymous */
Symbol name;
+ /** The argument name of this particular lambda. Is a falsey symbol if there
+ * is no such argument. */
Symbol arg;
+ /** Formals are present when the lambda destructures an attr set as
+ * argument, with or without ellipsis */
Formals * formals;
Expr * body;
ExprLambda(PosIdx pos, Symbol arg, Formals * formals, Expr * body)