summaryrefslogtreecommitdiff
path: root/tiger-compiler/src/ast/assert-exp.hh
blob: 6650ca4ecc37be38e2d1a6c204df4f272783e05f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/**
 ** \file ast/assert-exp.hh
 ** \brief Declaration of ast::AssertExp.
 */

#pragma once

#include <ast/exp.hh>

namespace ast
{
    // AssertExp
    class AssertExp : public Exp
    {
    public:
        /// Construct an AssertExp node.
        AssertExp(const Location& location, Exp* cond);
        AssertExp(const AssertExp&) = delete;
        AssertExp& operator=(const AssertExp&) = delete;

        /// Destroy an AssertExp node.
        ~AssertExp() override;


        // Here are the visitor methods
        /// Accept a const visitor \a v.
        void accept(ConstVisitor& v) const override;
        /// Accept a non-const visitor \a v.
        void accept(Visitor& v) override;

        // Some basic getters
        // Return the asserted condition in const form
        const Exp& cond_get() const;
        // Return the asserted condition
        Exp& cond_get();

    protected:
        // The condition that the assertion will evaluate
        Exp* cond_;
    };
} // namespace ast
#include <ast/assert-exp.hxx>