nixd
Loading...
Searching...
No Matches
Kinds.h
Go to the documentation of this file.
1/// \file
2/// \brief Determine the kind of `nix::Expr`.
3
4#pragma once
5
6namespace nix {
7class Expr;
8} // namespace nix
9
10namespace nixt {
11
12/// \brief "ek" is short for "ExprKind".
13///
14/// This namespace contains all kinds of
15/// unscoped enum `ExprKind`.
16/// For convenience, you can `using namespace ek;` to ref these names directly.
17namespace ek {
18
19/// \brief Enumeration of all kinds of `nix::Expr`.
20///
21/// The name is prefixed with `EK_` to avoid name clashes with the AST nodes.
22/// e.g. `EK_ExprInt`. These entries are generated by including `Nodes.inc`, so
23/// members may not shown in generated docs.
25
26/// \cond PRIVATE
27#define NIX_EXPR(EXPR) EK_##EXPR,
28#include "Nodes.inc"
29#undef NIX_EXPR
30 /// \endcond
31 LastExprKind, // should not be used.
32};
33
34} // namespace ek
35
36/// \brief Determine the kind of `nix::Expr`.
37/// \note This is based on dynamic_cast, so it is not very efficient.
38ek::ExprKind kindOf(const nix::Expr &E);
39
40/// \brief Get printable name of some kind.
41const char *nameOf(ek::ExprKind Kind);
42
43} // namespace nixt
Definition Kinds.h:6
ExprKind
Enumeration of all kinds of nix::Expr.
Definition Kinds.h:24
@ LastExprKind
Definition Kinds.h:31
Access EvalCache in nix::EvalState.
Definition ArrayRef.h:7
ek::ExprKind kindOf(const nix::Expr &E)
Determine the kind of nix::Expr.
Definition Kinds.cpp:9
const char * nameOf(ek::ExprKind Kind)
Get printable name of some kind.
Definition Kinds.cpp:22