diff options
author | Qyriad <qyriad@qyriad.me> | 2024-06-22 18:52:28 -0600 |
---|---|---|
committer | Qyriad <qyriad@qyriad.me> | 2024-06-22 18:52:57 -0600 |
commit | e09cc60df9698f268fa06ed1d9879101687b9eff (patch) | |
tree | c379bd27a39bb0f3116f1f5469f2b407cc873119 /src | |
parent | da4e46dd1fc04067b5ba4bc16dd68134fa7efad2 (diff) |
doc-comment ExprSelect's fields
Change-Id: I63e79991a4bab93421266785e9258e0f5bb89b8f
Diffstat (limited to 'src')
-rw-r--r-- | src/libexpr/nixexpr.hh | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/libexpr/nixexpr.hh b/src/libexpr/nixexpr.hh index 45d44d1d1..418f888b3 100644 --- a/src/libexpr/nixexpr.hh +++ b/src/libexpr/nixexpr.hh @@ -157,8 +157,18 @@ struct ExprInheritFrom : ExprVar struct ExprSelect : Expr { PosIdx pos; - std::unique_ptr<Expr> e, def; + + /** The expression attributes are being selected on. e.g. `foo` in `foo.bar.baz`. */ + std::unique_ptr<Expr> e; + + /** A default value specified with `or`, if the selected attr doesn't exist. + * e.g. `bix` in `foo.bar.baz or bix` + */ + std::unique_ptr<Expr> def; + + /** The path of attributes being selected. e.g. `bar.baz` in `foo.bar.baz.` */ AttrPath attrPath; + ExprSelect(const PosIdx & pos, std::unique_ptr<Expr> e, AttrPath attrPath, std::unique_ptr<Expr> def) : pos(pos), e(std::move(e)), def(std::move(def)), attrPath(std::move(attrPath)) { }; ExprSelect(const PosIdx & pos, std::unique_ptr<Expr> e, Symbol name) : pos(pos), e(std::move(e)) { attrPath.push_back(AttrName(name)); }; PosIdx getPos() const override { return pos; } |