![]() |
Spicy
|
#include <visitor-types.h>
Public Types | |
using | Erased = typename std::decay< E >::type |
Public Member Functions | |
auto | pathLength () const |
E | parent (unsigned int parent_nr=1) const |
template<typename T > | |
std::optional< std::reference_wrapper< const T > > | findParent () const |
Public Attributes | |
E | node |
const std::vector< Location< E > > & | path |
Represents the path to a node inside an AST during iteration.
|
inline |
Returns the first parent that has a given type.
|
inline |
Returns a parent.
parent_nr | number of the parent to return; 1 returns immediate parent, 2 the 2nd, etc. |
<tt>std::out_of_range</tt> | if the requested parent does not exist |
|
inline |
Returns the length of the AST path to the current node if we're indeed traversing an AST. If we're just dispatching a single node, this will return zero.
E hilti::visitor::Position< E >::node |
Node the position refers to.
const std::vector<Location<E> >& hilti::visitor::Position< E >::path |
Path to reach the node. The node itself is the last element inside the path.