0
|
1 module dmd.SymbolDeclaration;
|
|
2
|
114
|
3 import dmd.common;
|
0
|
4 import dmd.Declaration;
|
|
5 import dmd.StructDeclaration;
|
|
6 import dmd.Loc;
|
|
7 import dmd.TOK;
|
|
8 import dmd.STC;
|
|
9 import dmd.Identifier;
|
|
10
|
|
11 import dmd.backend.Symbol;
|
|
12
|
|
13 import core.stdc.string;
|
|
14 import std.stdio;
|
|
15
|
|
16 // This is a shell around a back end symbol
|
|
17
|
|
18 class SymbolDeclaration : Declaration
|
|
19 {
|
|
20 Symbol* sym;
|
|
21 StructDeclaration dsym;
|
|
22
|
|
23 this(Loc loc, Symbol* s, StructDeclaration dsym)
|
|
24 {
|
|
25 int len = strlen(s.Sident.ptr);
|
|
26 string name = s.Sident.ptr[0..len].idup;
|
|
27
|
|
28 super(new Identifier(name, TOK.TOKidentifier));
|
|
29
|
|
30 this.loc = loc;
|
|
31 sym = s;
|
|
32 this.dsym = dsym;
|
|
33 storage_class |= STCconst;
|
|
34 }
|
|
35
|
72
|
36 override Symbol* toSymbol()
|
0
|
37 {
|
|
38 return sym;
|
|
39 }
|
|
40
|
|
41 // Eliminate need for dynamic_cast
|
72
|
42 override SymbolDeclaration isSymbolDeclaration() { return this; }
|
|
43 }
|