blob: 5f18a078689d64d70c361d556b4cd24793ec184f (
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
|
/**
** \file assert/desugar-visitor.cc
** \brief Implementation of assert::DesugarVisitor.
*/
#include <assert/desugar-visitor.hh>
namespace assert
{
DesugarVisitor::DesugarVisitor(const bool desugar_for_p,
const bool desugar_string_cmp_p)
: super_type(desugar_for_p, desugar_string_cmp_p)
{}
void DesugarVisitor::operator()(const ast::AssertExp& e)
{
// FIXME DONE: Some code was deleted here. (replace the AssertExp to a CallExp)
const ast::Location location = e.location_get();
const auto args = new ast::exps_type;
const std::string condition_text = get_formatted_assert_cond(e);
const std::string filename = get_formatted_location(e.location_get());
args->push_back(recurse(e.cond_get()));
args->push_back(new ast::StringExp(location, condition_text));
args->push_back(new ast::StringExp(location, filename));
result_ = new ast::CallExp(location, "assertion", args);
}
} // namespace assert
|