forked from lix-project/lix
Document ExprLambda fields
We got confused what formals did and had to briefly figure it out. We
should just have docs, so these are some.
Change-Id: If3e794a401e69d022785cbfa0b0c2e2284f41f58
This commit is contained in:
parent
6646b80396
commit
817322fbfb
|
@ -243,6 +243,7 @@ struct Formal
|
||||||
Expr * def;
|
Expr * def;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** Attribute set destructuring in arguments of a lambda, if present */
|
||||||
struct Formals
|
struct Formals
|
||||||
{
|
{
|
||||||
typedef std::vector<Formal> Formals_;
|
typedef std::vector<Formal> Formals_;
|
||||||
|
@ -270,9 +271,18 @@ struct Formals
|
||||||
|
|
||||||
struct ExprLambda : Expr
|
struct ExprLambda : Expr
|
||||||
{
|
{
|
||||||
|
/** Where the lambda is defined in Nix code. May be falsey if the
|
||||||
|
* position is not known. */
|
||||||
PosIdx pos;
|
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;
|
Symbol name;
|
||||||
|
/** The argument name of this particular lambda. Is a falsey symbol if there
|
||||||
|
* is no such argument. */
|
||||||
Symbol arg;
|
Symbol arg;
|
||||||
|
/** Formals are present when the lambda destructures an attr set as
|
||||||
|
* argument, with or without ellipsis */
|
||||||
Formals * formals;
|
Formals * formals;
|
||||||
Expr * body;
|
Expr * body;
|
||||||
ExprLambda(PosIdx pos, Symbol arg, Formals * formals, Expr * body)
|
ExprLambda(PosIdx pos, Symbol arg, Formals * formals, Expr * body)
|
||||||
|
|
Loading…
Reference in a new issue