xo-expression: + Lambda::type_str

This commit is contained in:
Roland Conybeare 2024-06-17 17:00:16 -04:00
commit b18de1b0ce
2 changed files with 29 additions and 2 deletions

View file

@ -4,7 +4,30 @@
#include "xo/indentlog/print/vector.hpp"
namespace xo {
using std::stringstream;
namespace ast {
Lambda::Lambda(const std::string & name,
const std::vector<std::string> & argv,
const ref::rp<Expression> & body)
: Expression(exprtype::lambda),
name_{name},
argv_{argv},
body_{body}
{
stringstream ss;
ss << "double";
ss << "(";
for (std::size_t i = 0; i < argv.size(); ++i) {
if (i > 0)
ss << ",";
ss << "double";
}
ss << ")";
type_str_ = ss.str();
} /*ctor*/
void
Lambda::display(std::ostream & os) const {
os << "<Lambda"