Freeing Function objects before destroying program.

This commit is contained in:
Stefano Sanfilippo 2014-11-28 19:15:36 +01:00
parent 72b6c0253a
commit e93fef76f1

View File

@ -264,6 +264,8 @@ class Function: public Emittable {
public:
Function(Id *n, IdList *a, StatementList *b):
name(n), args(a), body(b) {}
virtual ~Function() {}
virtual void emit(std::ostream &stream, int indent = 0);
private:
@ -274,6 +276,12 @@ private:
class Program: public Emittable {
public:
virtual ~Program() {
for (Function *f: functions) {
delete f;
}
}
virtual void emit(std::ostream &stream, int indent = 0);
void setMain(Main *m) {