comparison dmd/StaticCtorDeclaration.d @ 98:5c859d5fbe27

and more
author Trass3r
date Tue, 31 Aug 2010 03:53:49 +0200
parents 43073c7c7769
children e28b18c23469
comparison
equal deleted inserted replaced
96:acd69f84627e 98:5c859d5fbe27
28 import dmd.ReturnStatement; 28 import dmd.ReturnStatement;
29 import dmd.IdentifierExp; 29 import dmd.IdentifierExp;
30 30
31 class StaticCtorDeclaration : FuncDeclaration 31 class StaticCtorDeclaration : FuncDeclaration
32 { 32 {
33 this(Loc loc, Loc endloc) 33 this(Loc loc, Loc endloc)
34 { 34 {
35 super(loc, endloc, Identifier.generateId("_staticCtor"), STCstatic, null); 35 super(loc, endloc, Identifier.generateId("_staticCtor"), STCstatic, null);
36 } 36 }
37 37
38 override Dsymbol syntaxCopy(Dsymbol) 38 override Dsymbol syntaxCopy(Dsymbol s)
39 { 39 {
40 assert(false); 40 assert(!s);
41 StaticCtorDeclaration scd = new StaticCtorDeclaration(loc, endloc);
42 return FuncDeclaration.syntaxCopy(scd);
41 } 43 }
42 44
43 override void semantic(Scope sc) 45 override void semantic(Scope sc)
44 { 46 {
45 //printf("StaticCtorDeclaration.semantic()\n"); 47 //printf("StaticCtorDeclaration.semantic()\n");
46 48
47 type = new TypeFunction(null, Type.tvoid, false, LINK.LINKd); 49 type = new TypeFunction(null, Type.tvoid, false, LINK.LINKd);
48 50
82 m = sc.module_; 84 m = sc.module_;
83 85
84 if (m) 86 if (m)
85 { 87 {
86 m.needmoduleinfo = 1; 88 m.needmoduleinfo = 1;
89 // writef("module1 %s needs moduleinfo\n", m.toChars());
87 version (IN_GCC) { 90 version (IN_GCC) {
88 m.strictlyneedmoduleinfo = 1; 91 m.strictlyneedmoduleinfo = 1;
89 } 92 }
90 } 93 }
91 } 94 }
92 95
93 override AggregateDeclaration isThis() 96 override AggregateDeclaration isThis()
94 { 97 {
95 return null; 98 return null;
96 } 99 }
97 100
98 override bool isStaticConstructor() 101 override bool isStaticConstructor()
99 { 102 {
100 return true; 103 return true;
101 } 104 }
102 105
103 override bool isVirtual() 106 override bool isVirtual()
104 { 107 {
105 return false; 108 return false;
106 } 109 }
107 110
108 override bool addPreInvariant() 111 override bool addPreInvariant()
109 { 112 {
110 return false; 113 return false;
111 } 114 }
112 115
113 override bool addPostInvariant() 116 override bool addPostInvariant()
114 { 117 {
115 return false; 118 return false;
116 } 119 }
117 120
118 override void emitComment(Scope sc) 121 override void emitComment(Scope sc)
119 { 122 {
120 assert(false);
121 } 123 }
122 124
123 override void toCBuffer(OutBuffer buf, HdrGenState* hgs) 125 override void toCBuffer(OutBuffer buf, HdrGenState* hgs)
124 { 126 {
125 assert(false); 127 if (hgs.hdrgen)
128 {
129 buf.writestring("static this();\n");
130 return;
131 }
132 buf.writestring("static this()");
133 bodyToCBuffer(buf, hgs);
126 } 134 }
127 135
128 override void toJsonBuffer(OutBuffer buf) 136 override void toJsonBuffer(OutBuffer buf)
129 { 137 {
130 } 138 }