Yume
src
yume
diagnostic
visitor
hash_visitor.cpp
Go to the documentation of this file.
1
#include "
hash_visitor.hpp
"
2
#include "
ast/ast.hpp
"
3
#include <cstddef>
4
5
namespace
yume::diagnostic
{
6
inline
auto
HashVisitor::visit
(
const
ast::AST
& expr, string_view label) ->
HashVisitor
& {
7
hash_combine
(m_seed, label);
8
hash_combine
(m_seed, expr.kind_name());
9
hash_combine
(m_seed, expr.describe());
10
expr.visit(*
this
);
11
12
return
*
this
;
13
}
14
15
inline
auto
HashVisitor::visit
(
const
string
& str, string_view label) ->
HashVisitor
& {
16
hash_combine
(m_seed, label);
17
hash_combine
(m_seed, str);
18
19
return
*
this
;
20
}
21
22
inline
auto
HashVisitor::visit
(std::nullptr_t, string_view label) ->
HashVisitor
& {
23
hash_combine
(m_seed, label);
24
hash_combine
(m_seed,
nullptr
);
25
26
return
*
this
;
27
}
28
}
// namespace yume::diagnostic
ast.hpp
yume::ast::AST
All nodes in the AST tree of the program inherit from this class.
Definition:
ast.hpp:224
yume::diagnostic::HashVisitor
Definition:
hash_visitor.hpp:14
yume::diagnostic::HashVisitor::visit
auto visit(const ast::AST &expr, string_view label) -> HashVisitor &override
Definition:
hash_visitor.cpp:6
hash_visitor.hpp
yume::diagnostic
Definition:
ast.hpp:28
yume::hash_combine
static void hash_combine(uint64_t &seed, const T &v)
Definition:
util.hpp:112
Generated by
1.9.4