brewery
notashelf /
59fedbe78d66b13c17c3d657dc171c2768f1c0db

nixir

public

Import-resolving Nix IR plugin

Star0tarball
clone
ssh://git@git.notashelf.dev:33/notashelf/nixir.git

Commit 59fedbe78d66

tarball

NotAShelf <raf@notashelf.dev> · 2026-02-21 21:07 UTC

unverified1 files changed+13-1
types: add `hasAttrNode` for `?` operator support

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I73691d86c8ce277bacc0dd7ed33939c96a6a6964
diff --git a/src/irc/types.h b/src/irc/types.hindex 68aedbe..50f1cb9 100644--- a/src/irc/types.h+++ b/src/irc/types.h@@ -29,7 +29,8 @@ enum class NodeType : uint8_t {     UNARY_OP = 0x23,     ATTRSET = 0x30,     SELECT = 0x31,-    WITH = 0x32,+    HAS_ATTR = 0x32,+    WITH = 0x33,     IF = 0x40,     LET = 0x50,     LETREC = 0x51,@@ -134,6 +135,13 @@ struct SelectNode {     SelectNode(std::shared_ptr<Node> e, std::shared_ptr<Node> a, uint32_t l = 0); }; +struct HasAttrNode {+    std::shared_ptr<Node> expr;+    std::shared_ptr<Node> attr;+    uint32_t line = 0;+    HasAttrNode(std::shared_ptr<Node> e, std::shared_ptr<Node> a, uint32_t l = 0);+};+ struct WithNode {     std::shared_ptr<Node> attrs;     std::shared_ptr<Node> body;@@ -198,6 +206,7 @@ public:         UnaryOpNode,         AttrsetNode,         SelectNode,+        HasAttrNode,         WithNode,         IfNode,         LetNode,@@ -238,6 +247,9 @@ inline UnaryOpNode::UnaryOpNode(UnaryOp o, std::shared_ptr<Node> operand, uint32 inline SelectNode::SelectNode(std::shared_ptr<Node> e, std::shared_ptr<Node> a, uint32_t l)     : expr(e), attr(a), line(l) {} +inline HasAttrNode::HasAttrNode(std::shared_ptr<Node> e, std::shared_ptr<Node> a, uint32_t l)+    : expr(e), attr(a), line(l) {}+ inline WithNode::WithNode(std::shared_ptr<Node> a, std::shared_ptr<Node> b, uint32_t l)     : attrs(a), body(b), line(l) {}