summaryrefslogtreecommitdiff
path: root/tiger-compiler/src/assert/desugar-visitor.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'tiger-compiler/src/assert/desugar-visitor.hxx')
-rw-r--r--tiger-compiler/src/assert/desugar-visitor.hxx39
1 files changed, 39 insertions, 0 deletions
diff --git a/tiger-compiler/src/assert/desugar-visitor.hxx b/tiger-compiler/src/assert/desugar-visitor.hxx
new file mode 100644
index 0000000..9e839c1
--- /dev/null
+++ b/tiger-compiler/src/assert/desugar-visitor.hxx
@@ -0,0 +1,39 @@
+/**
+ ** \file assert/desugar-visitor.hxx
+ ** \brief Implementation of assert::DesugarVisitor (inlined methods).
+ */
+
+#pragma once
+
+#include <assert/desugar-visitor.hh>
+
+#include <sstream>
+#include <string>
+
+#include <ast/pretty-printer.hh>
+
+namespace assert
+{
+
+ inline std::string
+ DesugarVisitor::get_formatted_assert_cond(const ast::AssertExp& e)
+ {
+ std::stringstream stream{};
+ ast::PrettyPrinter pretty_printer(stream);
+
+ pretty_printer(e.cond_get());
+
+ return stream.str();
+ }
+
+ inline std::string
+ DesugarVisitor::get_formatted_location(const ast::Location& loc)
+ {
+ std::stringstream stream{};
+
+ stream << loc;
+
+ return stream.str();
+ }
+
+}