Line data Source code
1 : #ifndef AST_FLOAT_H
2 : #define AST_FLOAT_H
3 :
4 : #include "../ast.h"
5 :
6 : namespace nicole {
7 :
8 : class AST_FLOAT final : public AST {
9 : private:
10 : float value_;
11 :
12 : public:
13 : explicit AST_FLOAT(const long long unsigned nodeId,
14 : const SourceLocation &srcLoc, const float value) noexcept
15 1 : : AST{nodeId, AST_TYPE::FLOAT, srcLoc}, value_{value} {}
16 :
17 : ~AST_FLOAT() noexcept = default;
18 :
19 9 : [[nodiscard]] float value() const noexcept { return value_; }
20 :
21 : [[nodiscard]] std::expected<std::string, Error>
22 0 : accept(const PrintTree &visitor) const noexcept override {
23 0 : return visitor.visit(this);
24 0 : }
25 :
26 : [[nodiscard]] std::expected<bool, Error>
27 0 : accept(const ValidateTree &visitor) const noexcept override {
28 0 : return visitor.visit(this);
29 0 : }
30 :
31 : [[nodiscard]] std::expected<std::monostate, Error>
32 0 : accept(const FillSemanticInfo &visitor) const noexcept override {
33 0 : return visitor.visit(this);
34 0 : }
35 :
36 : [[nodiscard]] std::expected<std::shared_ptr<Type>, Error>
37 0 : accept(const TypeAnalysis &visitor) const noexcept override {
38 0 : return visitor.visit(this);
39 0 : }
40 :
41 : [[nodiscard]] std::expected<std::monostate, Error>
42 0 : accept(const Monomorphize &visitor) const noexcept override {
43 0 : return visitor.visit(this);
44 0 : }
45 :
46 : [[nodiscard]] std::expected<std::shared_ptr<llvm::Value>, Error>
47 0 : accept(const CodeGeneration &visitor) const noexcept override {
48 0 : return visitor.visit(this);
49 0 : }
50 : };
51 :
52 : } // namespace nicole
53 :
54 : #endif // AST_H
|