Yume
hash_visitor.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "util.hpp"
4#include "visitor.hpp"
5#include <cstddef>
6#include <cstdint>
7#include <string>
8
9namespace yume::ast {
10class AST;
11}
12
13namespace yume::diagnostic {
14class HashVisitor : public Visitor {
15 uint64_t& m_seed;
16
17public:
18 explicit HashVisitor(uint64_t& seed) : m_seed(seed) {}
19 ~HashVisitor() override = default;
20
21 HashVisitor(const HashVisitor&) = delete;
23 auto operator=(const HashVisitor&) -> HashVisitor& = delete;
24 auto operator=(HashVisitor&&) -> HashVisitor& = delete;
25
26 auto visit(const ast::AST& expr, string_view label) -> HashVisitor& override;
27 auto visit(std::nullptr_t null, string_view label) -> HashVisitor& override;
28 auto visit(const string& str, string_view label) -> HashVisitor& override;
29};
30} // namespace yume::diagnostic
All nodes in the AST tree of the program inherit from this class.
Definition: ast.hpp:224
HashVisitor(const HashVisitor &)=delete
auto operator=(const HashVisitor &) -> HashVisitor &=delete
~HashVisitor() override=default
auto visit(const ast::AST &expr, string_view label) -> HashVisitor &override
Definition: hash_visitor.cpp:6
auto operator=(HashVisitor &&) -> HashVisitor &=delete
HashVisitor(HashVisitor &&)=delete
Definition: ast.cpp:8