git subrepo clone (merge) git@github.com:Rconybea/xo-expression.git xo-expression
subrepo: subdir: "xo-expression" merged: "fbc5b619" upstream: origin: "git@github.com:Rconybea/xo-expression.git" branch: "main" commit: "fbc5b619" git-subrepo: version: "0.4.9" origin: "???" commit: "???"
This commit is contained in:
parent
2b0859f339
commit
043b2d7efc
62 changed files with 5370 additions and 0 deletions
61
xo-expression/src/expression/ConvertExpr.cpp
Normal file
61
xo-expression/src/expression/ConvertExpr.cpp
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
/* file ConvertExpr.cpp
|
||||
*
|
||||
* author: Roland Conybeare
|
||||
*/
|
||||
|
||||
#include "ConvertExpr.hpp"
|
||||
#include "pretty_expression.hpp"
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
rp<ConvertExpr>
|
||||
ConvertExpr::make(TypeDescr dest_type,
|
||||
rp<Expression> arg)
|
||||
{
|
||||
return new ConvertExpr(dest_type,
|
||||
std::move(arg));
|
||||
}
|
||||
|
||||
std::set<std::string>
|
||||
ConvertExpr::get_free_variables() const {
|
||||
if (this->arg_)
|
||||
return this->arg_->get_free_variables();
|
||||
else
|
||||
return std::set<std::string>();
|
||||
}
|
||||
|
||||
void
|
||||
ConvertExpr::display(std::ostream & os) const {
|
||||
os << "<Convert"
|
||||
<< xtag("dest_type", this->valuetype()->short_name())
|
||||
<< xtag("arg", arg_)
|
||||
<< ">";
|
||||
}
|
||||
|
||||
std::uint32_t
|
||||
ConvertExpr::pretty_print(const ppindentinfo & ppii) const {
|
||||
return ppii.pps()->pretty_struct(ppii, "Convert",
|
||||
rtag("dest_type", print::quot(this->valuetype()->short_name())),
|
||||
refrtag("arg", arg_));
|
||||
}
|
||||
|
||||
// ----- ConvertExprAccess -----
|
||||
|
||||
rp<ConvertExprAccess>
|
||||
ConvertExprAccess::make(TypeDescr dest_type,
|
||||
rp<Expression> arg)
|
||||
{
|
||||
return new ConvertExprAccess(dest_type,
|
||||
std::move(arg));
|
||||
}
|
||||
|
||||
rp<ConvertExprAccess>
|
||||
ConvertExprAccess::make_empty() {
|
||||
return new ConvertExprAccess(nullptr /*dest_type*/,
|
||||
nullptr /*arg*/);
|
||||
}
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
|
||||
/* end ConvertExpr.cpp */
|
||||
Loading…
Add table
Add a link
Reference in a new issue