From 0a4737f519caf6ddd551f53f57af76c577225f56 Mon Sep 17 00:00:00 2001 From: eldritch horrors Date: Fri, 8 Mar 2024 09:52:42 +0100 Subject: [PATCH] add doc comment justifying ExprInheritFrom Co-authored-by: Robert Hensing (cherry picked from commit f24e445bc024cfd3c26be5f061280af549321c22) Change-Id: I7acda5d5c34c0914a78adc2385d32782c4c275cd --- src/libexpr/nixexpr.hh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/libexpr/nixexpr.hh b/src/libexpr/nixexpr.hh index 73ccfe7bd..f0265a896 100644 --- a/src/libexpr/nixexpr.hh +++ b/src/libexpr/nixexpr.hh @@ -129,6 +129,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, {})