summaryrefslogtreecommitdiff
path: root/tiger-compiler/src/assert/desugar-visitor.hxx
blob: 9e839c1898deb5438434587e62546a997a4f8b0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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();
  }

}