From f24e445bc024cfd3c26be5f061280af549321c22 Mon Sep 17 00:00:00 2001 From: pennae <82953136+pennae@users.noreply.github.com> Date: Mon, 26 Feb 2024 15:43:51 +0100 Subject: [PATCH] add doc comment justifying ExprInheritFrom Co-authored-by: Robert Hensing --- src/libexpr/nixexpr.hh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/libexpr/nixexpr.hh b/src/libexpr/nixexpr.hh index 2390c4286..94356759b 100644 --- a/src/libexpr/nixexpr.hh +++ b/src/libexpr/nixexpr.hh @@ -135,6 +135,11 @@ struct ExprVar : Expr COMMON_METHODS }; +/** + * A pseudo-expression for the purpose of evaluating the `from` expression in `inherit (from)` syntax. + * Unlike normal variable references, the displacement is set during parsing, and always refers to + * `ExprAttrs::inheritFromExprs` (by itself or in `ExprLet`), whose values are put into their own `Env`. + */ struct ExprInheritFrom : ExprVar { ExprInheritFrom(PosIdx pos, Displacement displ): ExprVar(pos, {})