Do not wrap simple expressions in braces.
This commit is contained in:
parent
d8a895773a
commit
eb072a063d
14
Nodes.cpp
14
Nodes.cpp
|
@ -161,9 +161,19 @@ void Assignment::emit(std::ostream &stream, int indent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Print::emit(std::ostream &stream, int indent) {
|
void Print::emit(std::ostream &stream, int indent) {
|
||||||
stream << "std::cout << (";
|
bool simpleExpression = (dynamic_cast<SimpleExpression*>(expression.get()) != nullptr);
|
||||||
|
|
||||||
|
stream << "std::cout << ";
|
||||||
|
if (!simpleExpression) {
|
||||||
|
stream << '(';
|
||||||
|
}
|
||||||
|
|
||||||
expression->emit(stream);
|
expression->emit(stream);
|
||||||
stream << ") << std::endl";
|
|
||||||
|
if (!simpleExpression) {
|
||||||
|
stream << ')';
|
||||||
|
}
|
||||||
|
stream << " << std::endl";
|
||||||
}
|
}
|
||||||
|
|
||||||
void Input::emit(std::ostream &stream, int indent) {
|
void Input::emit(std::ostream &stream, int indent) {
|
||||||
|
|
Reference in New Issue
Block a user