Mercurial > projects > dang
comparison sema/Scope.d @ 99:857f0d530789 new_gen
Imports and improved module statement
Allow "module a.b.c"
Supports most forms of D's import.
import A, B;
import A, B = C;
import A, B : a = b, c;
author | Anders Halager <halager@gmail.com> |
---|---|
date | Tue, 06 May 2008 21:59:22 +0200 |
parents | 621cedba53ea |
children | fea8d61a2451 |
comparison
equal
deleted
inserted
replaced
98:7f9240d4ddc1 | 99:857f0d530789 |
---|---|
1 module sema.Scope; | 1 module sema.Scope; |
2 | 2 |
3 import tango.io.Stdout; | 3 import tango.io.Stdout; |
4 | 4 |
5 import lexer.Token, | 5 import lexer.Token, |
6 ast.Module, | |
6 ast.Decl, | 7 ast.Decl, |
7 ast.Exp; | 8 ast.Exp; |
8 | 9 |
9 public | 10 public |
10 import sema.DType; | 11 import sema.DType; |
14 this() {} | 15 this() {} |
15 this(Scope enclosing) | 16 this(Scope enclosing) |
16 { | 17 { |
17 this.enclosing = enclosing; | 18 this.enclosing = enclosing; |
18 this.func = enclosing.func; | 19 this.func = enclosing.func; |
20 this.inModule = enclosing.inModule; | |
19 } | 21 } |
20 | 22 |
21 Scope enclosing; | 23 Scope enclosing; |
24 Module inModule; | |
22 | 25 |
23 void add(Identifier id) | 26 void add(Identifier id) |
24 { | 27 { |
25 // auto s = new Symbol; | |
26 // s.id = id; | |
27 symbols[id] = id; | 28 symbols[id] = id; |
28 // return s; | |
29 } | 29 } |
30 | 30 |
31 Identifier find(Identifier id) | 31 Identifier find(Identifier id) |
32 { | 32 { |
33 if(!id) | 33 if(!id) |