nixd
Loading...
Searching...
No Matches
Classes | Namespaces | Macros
Visitor.h File Reference

Describe how to traverse upon nix::Expr * nodes. More...

#include <nix/nixexpr.hh>
#include <nix/symbol-table.hh>
#include "Nodes.inc"
#include "Traverse.inc"

Go to the source code of this file.

Classes

struct  nixt::RecursiveASTVisitor< Derived >
 A CRTP base class for traversing nix::Expr * nodes. More...
 

Namespaces

namespace  nixt
 Access EvalCache in nix::EvalState.
 

Macros

#define NIX_EXPR(EXPR)   bool traverse##EXPR(const nix::EXPR *E);
 
#define NIX_EXPR(EXPR)    bool visit##EXPR(const nix::EXPR *E) { return getDerived().visitExpr(E); }
 
#define NIX_EXPR(EXPR)
 
#define TRY_TO(CALL_EXPR)
 
#define TRY_TO_TRAVERSE(EXPR)   TRY_TO(traverseExpr(EXPR))
 
#define DEF_TRAVERSE_TYPE(TYPE, CODE)
 

Detailed Description

Describe how to traverse upon nix::Expr * nodes.

This file contains a CRTP base class for traversing nix::Expr * nodes.

Definition in file Visitor.h.

Macro Definition Documentation

◆ DEF_TRAVERSE_TYPE

#define DEF_TRAVERSE_TYPE ( TYPE,
CODE )
Value:
template <typename Derived> \
bool RecursiveASTVisitor<Derived>::traverse##TYPE(const nix::TYPE *T) { \
if (!getDerived().shouldTraversePostOrder()) \
TRY_TO(visit##TYPE(T)); \
{ CODE; } \
if (getDerived().shouldTraversePostOrder()) \
TRY_TO(visit##TYPE(T)); \
return true; \
}

Definition at line 87 of file Visitor.h.

◆ NIX_EXPR [1/3]

#define NIX_EXPR ( EXPR)    bool traverse##EXPR(const nix::EXPR *E);

Definition at line 54 of file Visitor.h.

◆ NIX_EXPR [2/3]

#define NIX_EXPR ( EXPR)     bool visit##EXPR(const nix::EXPR *E) { return getDerived().visitExpr(E); }

Definition at line 54 of file Visitor.h.

◆ NIX_EXPR [3/3]

#define NIX_EXPR ( EXPR)
Value:
if (auto CE = dynamic_cast<const nix::EXPR *>(E)) { \
return getDerived().traverse##EXPR(CE); \
}
#define EXPR(NAME)
Definition Basic.h:19

Definition at line 54 of file Visitor.h.

◆ TRY_TO

#define TRY_TO ( CALL_EXPR)
Value:
do { \
if (!getDerived().CALL_EXPR) \
return false; \
} while (false)

Definition at line 79 of file Visitor.h.

◆ TRY_TO_TRAVERSE

#define TRY_TO_TRAVERSE ( EXPR)    TRY_TO(traverseExpr(EXPR))

Definition at line 85 of file Visitor.h.