Freeing Function objects before destroying program.
This commit is contained in:
parent
72b6c0253a
commit
e93fef76f1
|
@ -264,6 +264,8 @@ class Function: public Emittable {
|
||||||
public:
|
public:
|
||||||
Function(Id *n, IdList *a, StatementList *b):
|
Function(Id *n, IdList *a, StatementList *b):
|
||||||
name(n), args(a), body(b) {}
|
name(n), args(a), body(b) {}
|
||||||
|
virtual ~Function() {}
|
||||||
|
|
||||||
virtual void emit(std::ostream &stream, int indent = 0);
|
virtual void emit(std::ostream &stream, int indent = 0);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -274,6 +276,12 @@ private:
|
||||||
|
|
||||||
class Program: public Emittable {
|
class Program: public Emittable {
|
||||||
public:
|
public:
|
||||||
|
virtual ~Program() {
|
||||||
|
for (Function *f: functions) {
|
||||||
|
delete f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
virtual void emit(std::ostream &stream, int indent = 0);
|
virtual void emit(std::ostream &stream, int indent = 0);
|
||||||
|
|
||||||
void setMain(Main *m) {
|
void setMain(Main *m) {
|
||||||
|
|
Reference in New Issue
Block a user