Fixing two NPEs in case of missing else and missing main.
This commit is contained in:
parent
764e21abd6
commit
d0f3d30643
|
@ -89,11 +89,13 @@ void Branch::emit(std::ostream &stream, int indent) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (els != nullptr) {
|
||||||
stream << " else {\n";
|
stream << " else {\n";
|
||||||
els->emit(stream, indent + 1);
|
els->emit(stream, indent + 1);
|
||||||
emitIndent(stream, indent);
|
emitIndent(stream, indent);
|
||||||
stream << "}";
|
stream << "}";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void VarDeclaration::emit(std::ostream &stream, int indent) {
|
void VarDeclaration::emit(std::ostream &stream, int indent) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
@ -186,6 +188,8 @@ void Program::emit(std::ostream &stream, int indent) {
|
||||||
f->emit(stream);
|
f->emit(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (main != nullptr) {
|
||||||
main->emit(stream);
|
main->emit(stream);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Reference in New Issue
Block a user