Mercurial > projects > ddmd
comparison dmd/Scope.d @ 178:e3afd1303184
Many small bugs fixed
Made all classes derive from TObject to detect memory leaks (functionality is disabled for now)
Began work on overriding backend memory allocations (to avoid memory leaks)
author | korDen |
---|---|
date | Sun, 17 Oct 2010 07:42:00 +0400 |
parents | 96c0fff6897d |
children | b0d41ff5e0df |
comparison
equal
deleted
inserted
replaced
177:1475fd394c9e | 178:e3afd1303184 |
---|---|
34 SCOPEctor = 1, // constructor type | 34 SCOPEctor = 1, // constructor type |
35 SCOPEstaticif = 2, // inside static if | 35 SCOPEstaticif = 2, // inside static if |
36 SCOPEfree = 4, // is on free list | 36 SCOPEfree = 4, // is on free list |
37 } | 37 } |
38 | 38 |
39 class Scope | 39 import dmd.TObject; |
40 | |
41 class Scope : TObject | |
40 { | 42 { |
41 Scope enclosing; // enclosing Scope | 43 Scope enclosing; // enclosing Scope |
42 | 44 |
43 Module module_; // Root module | 45 Module module_; // Root module |
44 ScopeDsymbol scopesym; // current symbol | 46 ScopeDsymbol scopesym; // current symbol |
110 return sc; | 112 return sc; |
111 } | 113 } |
112 | 114 |
113 this() | 115 this() |
114 { | 116 { |
117 register(); | |
115 // Create root scope | 118 // Create root scope |
116 | 119 |
117 //printf("Scope.Scope() %p\n", this); | 120 //printf("Scope.Scope() %p\n", this); |
118 this.docbuf = new OutBuffer; | 121 this.docbuf = new OutBuffer; |
119 this.structalign = global.structalign; | 122 this.structalign = global.structalign; |
120 } | 123 } |
121 | 124 |
122 this(Module module_) | 125 this(Module module_) |
123 { | 126 { |
127 register(); | |
124 assert(false); | 128 assert(false); |
125 this.docbuf = new OutBuffer; | 129 this.docbuf = new OutBuffer; |
126 } | 130 } |
127 | 131 |
128 this(Scope enclosing) | 132 this(Scope enclosing) |
129 { | 133 { |
134 register(); | |
130 //printf("Scope.Scope(enclosing = %p) %p\n", enclosing, this); | 135 //printf("Scope.Scope(enclosing = %p) %p\n", enclosing, this); |
131 assert(!(enclosing.flags & SCOPE.SCOPEfree)); | 136 assert(!(enclosing.flags & SCOPE.SCOPEfree)); |
132 this.module_ = enclosing.module_; | 137 this.module_ = enclosing.module_; |
133 this.func = enclosing.func; | 138 this.func = enclosing.func; |
134 this.parent = enclosing.parent; | 139 this.parent = enclosing.parent; |