ChaiScript
chaiscript_tracer.hpp
1 // This file is distributed under the BSD License.
2 // See "license.txt" for details.
3 // Copyright 2009-2012, Jonathan Turner (jonathan@emptycrate.com)
4 // Copyright 2009-2018, Jason Turner (jason@emptycrate.com)
5 // http://www.chaiscript.com
6 
7 #ifndef CHAISCRIPT_TRACER_HPP_
8 #define CHAISCRIPT_TRACER_HPP_
9 
10 namespace chaiscript::eval {
12  template<typename T>
13  constexpr void trace(const chaiscript::detail::Dispatch_State &, const AST_Node_Impl<T> *) noexcept {
14  }
15  };
16 
17  template<typename... T>
18  struct Tracer : T... {
19  Tracer() = default;
20  constexpr explicit Tracer(T... t)
21  : T(std::move(t))... {
22  }
23 
24  void do_trace(const chaiscript::detail::Dispatch_State &ds, const AST_Node_Impl<Tracer<T...>> *node) {
25  (static_cast<T &>(*this).trace(ds, node), ...);
26  }
27 
28  static void trace(const chaiscript::detail::Dispatch_State &ds, const AST_Node_Impl<Tracer<T...>> *node) {
29  ds->get_parser().get_tracer<Tracer<T...>>().do_trace(ds, node);
30  }
31  };
32 
34 
35 } // namespace chaiscript::eval
36 
37 #endif
Definition: chaiscript_eval.hpp:44
Definition: chaiscript_tracer.hpp:11
Definition: chaiscript_tracer.hpp:18
Classes and functions that are part of the runtime eval system.
Definition: chaiscript_common.hpp:627
Definition: dispatchkit.hpp:1166