types: add hasAttrNode for ? operator support
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I73691d86c8ce277bacc0dd7ed33939c96a6a6964
This commit is contained in:
parent
32f74c29fd
commit
59fedbe78d
1 changed files with 13 additions and 1 deletions
|
|
@ -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) {}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue