From 91248863bcfba4cc97ae1d3a196fd3f0b2512551 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Fri, 10 Jun 2016 13:36:12 +0800 Subject: HIR Typecheck - Hack up closure inferrence from Fn* traits --- src/debug.cpp | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/debug.cpp (limited to 'src/debug.cpp') diff --git a/src/debug.cpp b/src/debug.cpp new file mode 100644 index 00000000..a09fc648 --- /dev/null +++ b/src/debug.cpp @@ -0,0 +1,42 @@ + +#include + +TraceLog::TraceLog(const char* tag, ::std::string info, ::std::function ret): + m_tag(tag), + m_ret(ret) +{ + if(debug_enabled()) { + auto& os = debug_output(g_debug_indent_level, m_tag); + os << ">> (" << info << ")" << ::std::endl; + } + INDENT(); +} +TraceLog::TraceLog(const char* tag, ::std::string info): + m_tag(tag), + m_ret([](const auto&){}) +{ + if(debug_enabled()) { + auto& os = debug_output(g_debug_indent_level, m_tag); + os << ">> (" << info << ")" << ::std::endl; + } + INDENT(); +} +TraceLog::TraceLog(const char* tag): + m_tag(tag), + m_ret([](const auto&){}) +{ + if(debug_enabled()) { + auto& os = debug_output(g_debug_indent_level, m_tag); + os << ">>" << ::std::endl; + } + INDENT(); +} +TraceLog::~TraceLog() { + UNINDENT(); + if(debug_enabled()) { + auto& os = debug_output(g_debug_indent_level, m_tag); + os << "<< ("; + m_ret(os); + os << ")" << ::std::endl; + } +} -- cgit v1.2.3