Mercurial > projects > dil
annotate trunk/src/dil/semantic/Symbols.d @ 758:f4b9680c0e16
Revised module dil.SettingsLoader.
author | Aziz K?ksal <aziz.koeksal@gmail.com> |
---|---|
date | Thu, 14 Feb 2008 03:31:19 +0100 |
parents | 00f872d949ea |
children | c24be8d4f6ab |
rev | line source |
---|---|
517 | 1 /++ |
2 Author: Aziz Köksal | |
3 License: GPL3 | |
4 +/ | |
590
641041912670
Moved dil.Symbols to dil.semantic.Symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
589
diff
changeset
|
5 module dil.semantic.Symbols; |
560
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
6 |
707
efa5fcb9aa14
Added semantic code related to enums.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
688
diff
changeset
|
7 import dil.ast.Expression; |
589
de365ddcfbd4
Moved dil.Symbol to dil.semantic.Symbol.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
584
diff
changeset
|
8 import dil.semantic.Symbol; |
591
26addda6365b
Moved dil.SymbolTable to dil.semantic.SymbolTable.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
590
diff
changeset
|
9 import dil.semantic.SymbolTable; |
600
041eae272362
Moved dil.Identifier to dil.lexer.Identifier.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
591
diff
changeset
|
10 import dil.semantic.Types; |
580
fa6d3c52757d
Moved SyntaxTree.d to new package 'ast'.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
573
diff
changeset
|
11 import dil.ast.Node; |
758
f4b9680c0e16
Revised module dil.SettingsLoader.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
747
diff
changeset
|
12 import dil.lexer.IdTable; |
560
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
13 import dil.Enums; |
517 | 14 import common; |
15 | |
560
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
16 /// A symbol that has its own scope with a symbol table. |
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
17 class ScopeSymbol : Symbol |
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
18 { |
614 | 19 SymbolTable symbolTable; /// The symbol table. |
20 Symbol[] members; /// The member symbols (in lexical order.) | |
560
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
21 |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
22 this(SYM sid, Identifier* name, Node node) |
560
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
23 { |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
24 super(sid, name, node); |
562
b0533550d64c
Added semantic() to VariableDeclaration.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
561
diff
changeset
|
25 } |
b0533550d64c
Added semantic() to VariableDeclaration.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
561
diff
changeset
|
26 |
747
00f872d949ea
Added method scanCommentText() to DDocEmitter.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
707
diff
changeset
|
27 /// Look up name in the table. |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
28 Symbol lookup(Identifier* name) |
562
b0533550d64c
Added semantic() to VariableDeclaration.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
561
diff
changeset
|
29 { |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
30 return symbolTable.lookup(name); |
562
b0533550d64c
Added semantic() to VariableDeclaration.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
561
diff
changeset
|
31 } |
b0533550d64c
Added semantic() to VariableDeclaration.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
561
diff
changeset
|
32 |
758
f4b9680c0e16
Revised module dil.SettingsLoader.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
747
diff
changeset
|
33 /// Look up name in the table. |
f4b9680c0e16
Revised module dil.SettingsLoader.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
747
diff
changeset
|
34 Symbol lookup(string name) |
f4b9680c0e16
Revised module dil.SettingsLoader.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
747
diff
changeset
|
35 { |
f4b9680c0e16
Revised module dil.SettingsLoader.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
747
diff
changeset
|
36 auto id = IdTable.lookup(name); |
f4b9680c0e16
Revised module dil.SettingsLoader.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
747
diff
changeset
|
37 return id ? symbolTable.lookup(id) : null; |
f4b9680c0e16
Revised module dil.SettingsLoader.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
747
diff
changeset
|
38 } |
f4b9680c0e16
Revised module dil.SettingsLoader.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
747
diff
changeset
|
39 |
562
b0533550d64c
Added semantic() to VariableDeclaration.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
561
diff
changeset
|
40 /// Insert a symbol into the table. |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
41 void insert(Symbol s, Identifier* name) |
562
b0533550d64c
Added semantic() to VariableDeclaration.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
561
diff
changeset
|
42 { |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
43 symbolTable.insert(s, name); |
614 | 44 members ~= s; |
560
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
45 } |
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
46 } |
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
47 |
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
48 /// Aggregates have function and field members. |
615
a05457530ac2
Added member ident to class Symbol.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
614
diff
changeset
|
49 abstract class Aggregate : ScopeSymbol |
517 | 50 { |
51 Function[] funcs; | |
52 Variable[] fields; | |
562
b0533550d64c
Added semantic() to VariableDeclaration.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
561
diff
changeset
|
53 |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
54 this(SYM sid, Identifier* name, Node node) |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
55 { |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
56 super(sid, name, node); |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
57 } |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
58 |
562
b0533550d64c
Added semantic() to VariableDeclaration.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
561
diff
changeset
|
59 override void insert(Symbol s, Identifier* ident) |
b0533550d64c
Added semantic() to VariableDeclaration.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
561
diff
changeset
|
60 { |
567
ab9f5020cd02
Added 'is-methods' to class Symbol.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
565
diff
changeset
|
61 if (s.isVariable) |
562
b0533550d64c
Added semantic() to VariableDeclaration.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
561
diff
changeset
|
62 // Append variable to fields. |
b0533550d64c
Added semantic() to VariableDeclaration.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
561
diff
changeset
|
63 fields ~= cast(Variable)cast(void*)s; |
567
ab9f5020cd02
Added 'is-methods' to class Symbol.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
565
diff
changeset
|
64 else if (s.isFunction) |
562
b0533550d64c
Added semantic() to VariableDeclaration.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
561
diff
changeset
|
65 // Append function to funcs. |
b0533550d64c
Added semantic() to VariableDeclaration.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
561
diff
changeset
|
66 funcs ~= cast(Function)cast(void*)s; |
b0533550d64c
Added semantic() to VariableDeclaration.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
561
diff
changeset
|
67 super.insert(s, ident); |
b0533550d64c
Added semantic() to VariableDeclaration.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
561
diff
changeset
|
68 } |
517 | 69 } |
70 | |
71 class Class : Aggregate | |
72 { | |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
73 this(Identifier* name, Node classNode) |
560
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
74 { |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
75 super(SYM.Class, name, classNode); |
560
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
76 } |
517 | 77 } |
78 | |
561
302e50e71ec2
Added Interface symbol.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
560
diff
changeset
|
79 class Interface : Aggregate |
302e50e71ec2
Added Interface symbol.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
560
diff
changeset
|
80 { |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
81 this(Identifier* name, Node interfaceNode) |
561
302e50e71ec2
Added Interface symbol.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
560
diff
changeset
|
82 { |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
83 super(SYM.Interface, name, interfaceNode); |
561
302e50e71ec2
Added Interface symbol.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
560
diff
changeset
|
84 } |
302e50e71ec2
Added Interface symbol.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
560
diff
changeset
|
85 } |
302e50e71ec2
Added Interface symbol.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
560
diff
changeset
|
86 |
517 | 87 class Union : Aggregate |
88 { | |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
89 this(Identifier* name, Node unionNode) |
560
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
90 { |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
91 super(SYM.Union, name, unionNode); |
560
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
92 } |
517 | 93 } |
94 | |
95 class Struct : Aggregate | |
96 { | |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
97 this(Identifier* name, Node structNode) |
560
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
98 { |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
99 super(SYM.Struct, name, structNode); |
560
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
100 } |
517 | 101 } |
102 | |
614 | 103 class Enum : ScopeSymbol |
104 { | |
688
839c0c61af2b
Renamed some semantic types.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
683
diff
changeset
|
105 TypeEnum type; |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
106 this(Identifier* name, Node enumNode) |
614 | 107 { |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
108 super(SYM.Enum, name, enumNode); |
614 | 109 } |
617
0749f30ef2d0
Added member 'EnumType type' to class Enum.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
615
diff
changeset
|
110 |
688
839c0c61af2b
Renamed some semantic types.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
683
diff
changeset
|
111 void setType(TypeEnum type) |
617
0749f30ef2d0
Added member 'EnumType type' to class Enum.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
615
diff
changeset
|
112 { |
0749f30ef2d0
Added member 'EnumType type' to class Enum.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
615
diff
changeset
|
113 this.type = type; |
0749f30ef2d0
Added member 'EnumType type' to class Enum.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
615
diff
changeset
|
114 } |
614 | 115 } |
116 | |
623
e2cd28cfc6ae
Added dil.semantic.Template.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
617
diff
changeset
|
117 class Template : ScopeSymbol |
e2cd28cfc6ae
Added dil.semantic.Template.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
617
diff
changeset
|
118 { |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
119 this(Identifier* name, Node templateNode) |
623
e2cd28cfc6ae
Added dil.semantic.Template.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
617
diff
changeset
|
120 { |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
121 super(SYM.Template, name, templateNode); |
623
e2cd28cfc6ae
Added dil.semantic.Template.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
617
diff
changeset
|
122 } |
e2cd28cfc6ae
Added dil.semantic.Template.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
617
diff
changeset
|
123 } |
e2cd28cfc6ae
Added dil.semantic.Template.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
617
diff
changeset
|
124 |
560
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
125 class Function : ScopeSymbol |
517 | 126 { |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
127 Protection prot; /// The protection. |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
128 StorageClass stc; /// The storage classes. |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
129 LinkageType linkType; /// The linkage type. |
517 | 130 |
560
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
131 Type returnType; |
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
132 Variable[] params; |
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
133 |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
134 this(Identifier* name, Node functionNode) |
560
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
135 { |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
136 super(SYM.Function, name, functionNode); |
560
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
137 } |
517 | 138 } |
139 | |
140 class Variable : Symbol | |
141 { | |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
142 Protection prot; /// The protection. |
615
a05457530ac2
Added member ident to class Symbol.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
614
diff
changeset
|
143 StorageClass stc; /// The storage classes. |
a05457530ac2
Added member ident to class Symbol.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
614
diff
changeset
|
144 LinkageType linkType; /// The linkage type. |
517 | 145 |
615
a05457530ac2
Added member ident to class Symbol.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
614
diff
changeset
|
146 Type type; /// The type of this variable. |
707
efa5fcb9aa14
Added semantic code related to enums.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
688
diff
changeset
|
147 Expression value; /// The value of this variable. |
560
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
148 |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
149 this(Identifier* name, |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
150 Protection prot, StorageClass stc, LinkageType linkType, |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
151 Node variableNode) |
560
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
152 { |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
153 super(SYM.Variable, name, variableNode); |
560
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
154 |
707
efa5fcb9aa14
Added semantic code related to enums.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
688
diff
changeset
|
155 this.prot = prot; |
560
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
156 this.stc = stc; |
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
157 this.linkType = linkType; |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
158 } |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
159 } |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
160 |
707
efa5fcb9aa14
Added semantic code related to enums.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
688
diff
changeset
|
161 class EnumMember : Variable |
efa5fcb9aa14
Added semantic code related to enums.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
688
diff
changeset
|
162 { |
efa5fcb9aa14
Added semantic code related to enums.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
688
diff
changeset
|
163 this(Identifier* name, |
efa5fcb9aa14
Added semantic code related to enums.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
688
diff
changeset
|
164 Protection prot, StorageClass stc, LinkageType linkType, |
efa5fcb9aa14
Added semantic code related to enums.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
688
diff
changeset
|
165 Node enumMemberNode) |
efa5fcb9aa14
Added semantic code related to enums.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
688
diff
changeset
|
166 { |
efa5fcb9aa14
Added semantic code related to enums.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
688
diff
changeset
|
167 super(name, prot, stc, linkType, enumMemberNode); |
efa5fcb9aa14
Added semantic code related to enums.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
688
diff
changeset
|
168 this.sid = SYM.EnumMember; |
efa5fcb9aa14
Added semantic code related to enums.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
688
diff
changeset
|
169 } |
efa5fcb9aa14
Added semantic code related to enums.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
688
diff
changeset
|
170 } |
efa5fcb9aa14
Added semantic code related to enums.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
688
diff
changeset
|
171 |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
172 class Alias : Symbol |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
173 { |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
174 this(Identifier* name, Node aliasNode) |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
175 { |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
176 super(SYM.Alias, name, aliasNode); |
560
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
177 } |
517 | 178 } |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
179 |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
180 /++ |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
181 A list of symbols that share the same identifier. |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
182 These can be functions, templates and aggregates with template parameter lists. |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
183 +/ |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
184 class OverloadSet : Symbol |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
185 { |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
186 Symbol[] symbols; |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
187 |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
188 this(Identifier* name, Node node) |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
189 { |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
190 super(SYM.OverloadSet, name, node); |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
191 } |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
192 |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
193 void add(Symbol s) |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
194 { |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
195 symbols ~= s; |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
196 } |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
197 } |