aboutsummaryrefslogtreecommitdiffstats
path: root/write.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'write.cpp')
-rw-r--r--write.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/write.cpp b/write.cpp
index 248e1e1..aab3fb1 100644
--- a/write.cpp
+++ b/write.cpp
@@ -20,23 +20,23 @@
ostream&
operator<<(ostream& out, const AST* ast)
{
- const ALiteral<float>* flit = dynamic_cast<const ALiteral<float>*>(ast);
+ const ALiteral<float>* flit = ast->to<const ALiteral<float>*>();
if (flit)
return out << showpoint << flit->val;
- const ALiteral<int32_t>* ilit = dynamic_cast<const ALiteral<int32_t>*>(ast);
+ const ALiteral<int32_t>* ilit = ast->to<const ALiteral<int32_t>*>();
if (ilit)
return out << ilit->val;
- const ALiteral<bool>* blit = dynamic_cast<const ALiteral<bool>*>(ast);
+ const ALiteral<bool>* blit = ast->to<const ALiteral<bool>*>();
if (blit)
return out << (blit->val ? "#t" : "#f");
- const ASymbol* sym = dynamic_cast<const ASymbol*>(ast);
+ const ASymbol* sym = ast->to<const ASymbol*>();
if (sym)
return out << sym->cppstr;
- const AType* type = dynamic_cast<const AType*>(ast);
+ const AType* type = ast->to<const AType*>();
if (type) {
switch (type->kind) {
case AType::VAR: return out << "?" << type->id;
@@ -45,7 +45,7 @@ operator<<(ostream& out, const AST* ast)
}
}
- const ATuple* tup = dynamic_cast<const ATuple*>(ast);
+ const ATuple* tup = ast->to<const ATuple*>();
if (tup) {
out << "(";
for (size_t i = 0; i != tup->size(); ++i)