diff options
| author | Tuowen Zhao <ztuowen@gmail.com> | 2016-10-06 23:41:15 -0600 | 
|---|---|---|
| committer | Tuowen Zhao <ztuowen@gmail.com> | 2016-10-06 23:41:15 -0600 | 
| commit | 7414769da6aaff79887b5ba53406f442df9da33f (patch) | |
| tree | 949765e0a6884d25c044cc2bf6313321ada5890c /src/printer | |
| parent | f329ee2b4cfdde656d2fe30f2a2789d8a3774203 (diff) | |
| download | chill-7414769da6aaff79887b5ba53406f442df9da33f.tar.gz chill-7414769da6aaff79887b5ba53406f442df9da33f.tar.bz2 chill-7414769da6aaff79887b5ba53406f442df9da33f.zip  | |
further cleanup
Diffstat (limited to 'src/printer')
| -rw-r--r-- | src/printer/cfamily.cpp | 7 | 
1 files changed, 5 insertions, 2 deletions
diff --git a/src/printer/cfamily.cpp b/src/printer/cfamily.cpp index d0f8030..552947a 100644 --- a/src/printer/cfamily.cpp +++ b/src/printer/cfamily.cpp @@ -180,9 +180,9 @@ void CFamily::printS(std::string ident, chillAST_ForStmt *n, std::ostream &o) {      o << "// " << n->metacomment << "\n";    o << "for (";    print(ident, n->getInit(), o); -  o << ";"; +  o << "; ";    print(ident, n->getCond(), o); -  o << ";"; +  o << "; ";    print(ident, n->getInc(), o);    o << ") ";    if (n->getBody()->isCompoundStmt()) { @@ -232,6 +232,9 @@ void CFamily::printS(std::string ident, chillAST_IfStmt *n, std::ostream &o) {    if (!(n->getThen()->isCompoundStmt()))      CHILL_ERROR("Then part is not a CompoundStmt!\n");    if (n->getElse()) { +    if (n->getThen()->getNumChildren() == 1) +      o<<std::endl<<ident; +    else o<<" ";      o << "else ";      print(ident, n->getElse(), o);    }  | 
