Mercurial > projects > dil
comparison trunk/src/dil/semantic/Symbol.d @ 711:4f971f6382c7
Added enum Status to class Symbol.
author | Aziz K?ksal <aziz.koeksal@gmail.com> |
---|---|
date | Wed, 30 Jan 2008 18:28:21 +0100 |
parents | efa5fcb9aa14 |
children | 8caf18892c1b |
comparison
equal
deleted
inserted
replaced
710:c89ffd930727 | 711:4f971f6382c7 |
---|---|
29 /++ | 29 /++ |
30 A symbol represents an object with semantic code information. | 30 A symbol represents an object with semantic code information. |
31 +/ | 31 +/ |
32 class Symbol | 32 class Symbol |
33 { | 33 { |
34 SYM sid; | 34 enum Status : ushort |
35 { | |
36 Declared, /// The symbol has been declared. | |
37 Completing, /// The symbol is being processed. | |
38 Complete /// The symbol is complete. | |
39 } | |
40 | |
41 SYM sid; /// The ID of this symbol. | |
42 Status status; /// The semantic status of this symbol. | |
35 Symbol parent; /// The parent this symbol belongs to. | 43 Symbol parent; /// The parent this symbol belongs to. |
36 Identifier* name; /// The name of this symbol. | 44 Identifier* name; /// The name of this symbol. |
37 /// The AST node that produced this symbol. | 45 /// The syntax tree node that produced this symbol. |
38 /// Useful for source code location info and retrieval of doc comments. | 46 /// Useful for source code location info and retrieval of doc comments. |
39 Node node; | 47 Node node; |
40 | 48 |
41 this(SYM sid, Identifier* name, Node node) | 49 this(SYM sid, Identifier* name, Node node) |
42 { | 50 { |
43 this.sid = sid; | 51 this.sid = sid; |
44 this.name = name; | 52 this.name = name; |
45 this.node = node; | 53 this.node = node; |
46 } | 54 } |
55 | |
56 void setCompleting() | |
57 { status = Status.Completing; } | |
58 | |
59 void setComplete() | |
60 { status = Status.Complete; } | |
61 | |
62 bool isCompleting() | |
63 { return status == Status.Completing; } | |
64 | |
65 bool isComplete() | |
66 { return status == Status.Complete; } | |
47 | 67 |
48 // A template macro for building isXYZ() methods. | 68 // A template macro for building isXYZ() methods. |
49 private template isX(char[] kind) | 69 private template isX(char[] kind) |
50 { | 70 { |
51 const char[] isX = `bool is`~kind~`(){ return sid == SYM.`~kind~`; }`; | 71 const char[] isX = `bool is`~kind~`(){ return sid == SYM.`~kind~`; }`; |