Mercurial > projects > dil
annotate trunk/src/dil/semantic/Symbols.d @ 747:00f872d949ea
Added method scanCommentText() to DDocEmitter.
Added method writeParams() and scanCodeSection().
Added method scanMacro() to MacroParser.
Made fixes and improvements to the MacroExpander.
Applied other minor fixes.
author | Aziz K?ksal <aziz.koeksal@gmail.com> |
---|---|
date | Mon, 11 Feb 2008 03:15:45 +0100 |
parents | efa5fcb9aa14 |
children | f4b9680c0e16 |
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; |
600
041eae272362
Moved dil.Identifier to dil.lexer.Identifier.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
591
diff
changeset
|
12 import dil.lexer.Identifier; |
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 |
b0533550d64c
Added semantic() to VariableDeclaration.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
561
diff
changeset
|
33 /// Insert a symbol into the table. |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
34 void insert(Symbol s, Identifier* name) |
562
b0533550d64c
Added semantic() to VariableDeclaration.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
561
diff
changeset
|
35 { |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
36 symbolTable.insert(s, name); |
614 | 37 members ~= s; |
560
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
38 } |
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
39 } |
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
40 |
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
41 /// 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
|
42 abstract class Aggregate : ScopeSymbol |
517 | 43 { |
44 Function[] funcs; | |
45 Variable[] fields; | |
562
b0533550d64c
Added semantic() to VariableDeclaration.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
561
diff
changeset
|
46 |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
47 this(SYM sid, Identifier* name, Node node) |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
48 { |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
49 super(sid, name, node); |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
50 } |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
51 |
562
b0533550d64c
Added semantic() to VariableDeclaration.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
561
diff
changeset
|
52 override void insert(Symbol s, Identifier* ident) |
b0533550d64c
Added semantic() to VariableDeclaration.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
561
diff
changeset
|
53 { |
567
ab9f5020cd02
Added 'is-methods' to class Symbol.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
565
diff
changeset
|
54 if (s.isVariable) |
562
b0533550d64c
Added semantic() to VariableDeclaration.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
561
diff
changeset
|
55 // Append variable to fields. |
b0533550d64c
Added semantic() to VariableDeclaration.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
561
diff
changeset
|
56 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
|
57 else if (s.isFunction) |
562
b0533550d64c
Added semantic() to VariableDeclaration.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
561
diff
changeset
|
58 // Append function to funcs. |
b0533550d64c
Added semantic() to VariableDeclaration.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
561
diff
changeset
|
59 funcs ~= cast(Function)cast(void*)s; |
b0533550d64c
Added semantic() to VariableDeclaration.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
561
diff
changeset
|
60 super.insert(s, ident); |
b0533550d64c
Added semantic() to VariableDeclaration.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
561
diff
changeset
|
61 } |
517 | 62 } |
63 | |
64 class Class : Aggregate | |
65 { | |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
66 this(Identifier* name, Node classNode) |
560
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
67 { |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
68 super(SYM.Class, name, classNode); |
560
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
69 } |
517 | 70 } |
71 | |
561
302e50e71ec2
Added Interface symbol.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
560
diff
changeset
|
72 class Interface : Aggregate |
302e50e71ec2
Added Interface symbol.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
560
diff
changeset
|
73 { |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
74 this(Identifier* name, Node interfaceNode) |
561
302e50e71ec2
Added Interface symbol.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
560
diff
changeset
|
75 { |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
76 super(SYM.Interface, name, interfaceNode); |
561
302e50e71ec2
Added Interface symbol.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
560
diff
changeset
|
77 } |
302e50e71ec2
Added Interface symbol.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
560
diff
changeset
|
78 } |
302e50e71ec2
Added Interface symbol.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
560
diff
changeset
|
79 |
517 | 80 class Union : Aggregate |
81 { | |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
82 this(Identifier* name, Node unionNode) |
560
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
83 { |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
84 super(SYM.Union, name, unionNode); |
560
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
85 } |
517 | 86 } |
87 | |
88 class Struct : Aggregate | |
89 { | |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
90 this(Identifier* name, Node structNode) |
560
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
91 { |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
92 super(SYM.Struct, name, structNode); |
560
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
93 } |
517 | 94 } |
95 | |
614 | 96 class Enum : ScopeSymbol |
97 { | |
688
839c0c61af2b
Renamed some semantic types.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
683
diff
changeset
|
98 TypeEnum type; |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
99 this(Identifier* name, Node enumNode) |
614 | 100 { |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
101 super(SYM.Enum, name, enumNode); |
614 | 102 } |
617
0749f30ef2d0
Added member 'EnumType type' to class Enum.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
615
diff
changeset
|
103 |
688
839c0c61af2b
Renamed some semantic types.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
683
diff
changeset
|
104 void setType(TypeEnum type) |
617
0749f30ef2d0
Added member 'EnumType type' to class Enum.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
615
diff
changeset
|
105 { |
0749f30ef2d0
Added member 'EnumType type' to class Enum.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
615
diff
changeset
|
106 this.type = type; |
0749f30ef2d0
Added member 'EnumType type' to class Enum.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
615
diff
changeset
|
107 } |
614 | 108 } |
109 | |
623
e2cd28cfc6ae
Added dil.semantic.Template.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
617
diff
changeset
|
110 class Template : ScopeSymbol |
e2cd28cfc6ae
Added dil.semantic.Template.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
617
diff
changeset
|
111 { |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
112 this(Identifier* name, Node templateNode) |
623
e2cd28cfc6ae
Added dil.semantic.Template.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
617
diff
changeset
|
113 { |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
114 super(SYM.Template, name, templateNode); |
623
e2cd28cfc6ae
Added dil.semantic.Template.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
617
diff
changeset
|
115 } |
e2cd28cfc6ae
Added dil.semantic.Template.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
617
diff
changeset
|
116 } |
e2cd28cfc6ae
Added dil.semantic.Template.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
617
diff
changeset
|
117 |
560
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
118 class Function : ScopeSymbol |
517 | 119 { |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
120 Protection prot; /// The protection. |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
121 StorageClass stc; /// The storage classes. |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
122 LinkageType linkType; /// The linkage type. |
517 | 123 |
560
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
124 Type returnType; |
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
125 Variable[] params; |
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
126 |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
127 this(Identifier* name, Node functionNode) |
560
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
128 { |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
129 super(SYM.Function, name, functionNode); |
560
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
130 } |
517 | 131 } |
132 | |
133 class Variable : Symbol | |
134 { | |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
135 Protection prot; /// The protection. |
615
a05457530ac2
Added member ident to class Symbol.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
614
diff
changeset
|
136 StorageClass stc; /// The storage classes. |
a05457530ac2
Added member ident to class Symbol.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
614
diff
changeset
|
137 LinkageType linkType; /// The linkage type. |
517 | 138 |
615
a05457530ac2
Added member ident to class Symbol.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
614
diff
changeset
|
139 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
|
140 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
|
141 |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
142 this(Identifier* name, |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
143 Protection prot, StorageClass stc, LinkageType linkType, |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
144 Node variableNode) |
560
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
145 { |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
146 super(SYM.Variable, name, variableNode); |
560
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
147 |
707
efa5fcb9aa14
Added semantic code related to enums.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
688
diff
changeset
|
148 this.prot = prot; |
560
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
149 this.stc = stc; |
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
150 this.linkType = linkType; |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
151 } |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
152 } |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
153 |
707
efa5fcb9aa14
Added semantic code related to enums.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
688
diff
changeset
|
154 class EnumMember : Variable |
efa5fcb9aa14
Added semantic code related to enums.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
688
diff
changeset
|
155 { |
efa5fcb9aa14
Added semantic code related to enums.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
688
diff
changeset
|
156 this(Identifier* name, |
efa5fcb9aa14
Added semantic code related to enums.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
688
diff
changeset
|
157 Protection prot, StorageClass stc, LinkageType linkType, |
efa5fcb9aa14
Added semantic code related to enums.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
688
diff
changeset
|
158 Node enumMemberNode) |
efa5fcb9aa14
Added semantic code related to enums.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
688
diff
changeset
|
159 { |
efa5fcb9aa14
Added semantic code related to enums.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
688
diff
changeset
|
160 super(name, prot, stc, linkType, enumMemberNode); |
efa5fcb9aa14
Added semantic code related to enums.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
688
diff
changeset
|
161 this.sid = SYM.EnumMember; |
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 } |
efa5fcb9aa14
Added semantic code related to enums.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
688
diff
changeset
|
164 |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
165 class Alias : Symbol |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
166 { |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
167 this(Identifier* name, Node aliasNode) |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
168 { |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
169 super(SYM.Alias, name, aliasNode); |
560
709e223a8eb9
Added code related to symbols.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
517
diff
changeset
|
170 } |
517 | 171 } |
683
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
172 |
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 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
|
175 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
|
176 +/ |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
177 class OverloadSet : Symbol |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
178 { |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
179 Symbol[] symbols; |
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 this(Identifier* name, Node node) |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
182 { |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
183 super(SYM.OverloadSet, name, node); |
1ae72234db26
Implemented some methods in SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
623
diff
changeset
|
184 } |
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 void add(Symbol s) |
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 symbols ~= s; |
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 } |