Mercurial > projects > dil
comparison trunk/src/dil/semantic/Pass1.d @ 692:d33895f679eb
Tidied up the class Scope a bit.
author | Aziz K?ksal <aziz.koeksal@gmail.com> |
---|---|
date | Tue, 22 Jan 2008 18:32:39 +0100 |
parents | eaf6444b6284 |
children | c67d2c3c0b3d |
comparison
equal
deleted
inserted
replaced
691:276e2866f5fd | 692:d33895f679eb |
---|---|
55 /// Start semantic analysis. | 55 /// Start semantic analysis. |
56 void start() | 56 void start() |
57 { | 57 { |
58 assert(modul.root !is null); | 58 assert(modul.root !is null); |
59 // Create module scope. | 59 // Create module scope. |
60 scop = new Scope(); | 60 scop = new Scope(null, modul); |
61 scop.symbol = modul; // Set this module as the scope's symbol. | |
62 scop.infoMan = modul.infoMan; | |
63 visit(modul.root); | 61 visit(modul.root); |
64 } | 62 } |
65 | 63 |
66 void enterScope(ScopeSymbol s) | 64 void enterScope(ScopeSymbol s) |
67 { | 65 { |
296 { return null; } | 294 { return null; } |
297 | 295 |
298 D visit(VariablesDeclaration vd) | 296 D visit(VariablesDeclaration vd) |
299 { | 297 { |
300 // Error if we are in an interface. | 298 // Error if we are in an interface. |
301 if (scop.isInterface) | 299 if (scop.symbol.isInterface) |
302 return error(vd.begin, MSG.InterfaceCantHaveVariables), vd; | 300 return error(vd.begin, MSG.InterfaceCantHaveVariables), vd; |
303 | 301 |
304 // Insert variable symbols in this declaration into the symbol table. | 302 // Insert variable symbols in this declaration into the symbol table. |
305 foreach (name; vd.names) | 303 foreach (name; vd.names) |
306 { | 304 { |