brewery
notashelf /
b319ef6f3f9fc1123b7cd9c1f5df414e163d674c

nixir

public

Import-resolving Nix IR plugin

Star0tarball
clone
ssh://git@git.notashelf.dev:33/notashelf/nixir.git
src/irc/types.cppCpp62 lines2.4 KB
1
#include "types.h"
2
3
namespace nix_irc {
4
5
// LambdaNode constructor
6
LambdaNode::LambdaNode(uint32_t a, std::shared_ptr<Node> b, uint32_t l)
7
    : arity(a), body(std::move(b)), line(l) {}
8
9
// AppNode constructor
10
AppNode::AppNode(std::shared_ptr<Node> f, std::shared_ptr<Node> a, uint32_t l)
11
    : func(std::move(f)), arg(std::move(a)), line(l) {}
12
13
// BinaryOpNode constructor
14
BinaryOpNode::BinaryOpNode(BinaryOp o, std::shared_ptr<Node> l, std::shared_ptr<Node> r,
15
                           uint32_t ln)
16
    : op(o), left(std::move(l)), right(std::move(r)), line(ln) {}
17
18
// UnaryOpNode constructor
19
UnaryOpNode::UnaryOpNode(UnaryOp o, std::shared_ptr<Node> operand_ptr, uint32_t l)
20
    : op(o), operand(std::move(operand_ptr)), line(l) {}
21
22
// SelectNode constructor
23
SelectNode::SelectNode(std::shared_ptr<Node> e, std::shared_ptr<Node> a, uint32_t l)
24
    : expr(std::move(e)), attr(std::move(a)), line(l) {}
25
26
// HasAttrNode constructor
27
HasAttrNode::HasAttrNode(std::shared_ptr<Node> e, std::shared_ptr<Node> a, uint32_t l)
28
    : expr(std::move(e)), attr(std::move(a)), line(l) {}
29
30
// WithNode constructor
31
WithNode::WithNode(std::shared_ptr<Node> a, std::shared_ptr<Node> b, uint32_t l)
32
    : attrs(std::move(a)), body(std::move(b)), line(l) {}
33
34
// IfNode constructor
35
IfNode::IfNode(std::shared_ptr<Node> c, std::shared_ptr<Node> t, std::shared_ptr<Node> e,
36
               uint32_t l)
37
    : cond(std::move(c)), then_branch(std::move(t)), else_branch(std::move(e)), line(l) {}
38
39
// LetNode constructor
40
LetNode::LetNode(std::shared_ptr<Node> b, uint32_t l) : body(std::move(b)), line(l) {}
41
42
// LetRecNode constructor
43
LetRecNode::LetRecNode(std::shared_ptr<Node> b, uint32_t l) : body(std::move(b)), line(l) {}
44
45
// AssertNode constructor
46
AssertNode::AssertNode(std::shared_ptr<Node> c, std::shared_ptr<Node> b, uint32_t l)
47
    : cond(std::move(c)), body(std::move(b)), line(l) {}
48
49
// ImportNode constructor
50
ImportNode::ImportNode(std::shared_ptr<Node> p, uint32_t l) : path(std::move(p)), line(l) {}
51
52
// ThunkNode constructor
53
ThunkNode::ThunkNode(std::shared_ptr<Node> e, uint32_t l) : expr(std::move(e)), line(l) {}
54
55
// ForceNode constructor
56
ForceNode::ForceNode(std::shared_ptr<Node> e, uint32_t l) : expr(std::move(e)), line(l) {}
57
58
// LambdaPatternNode constructor
59
LambdaPatternNode::LambdaPatternNode(std::shared_ptr<Node> b, uint32_t l)
60
    : allow_extra(false), body(std::move(b)), line(l) {}
61
62
} // namespace nix_irc