annotate dmd/SymOffExp.d @ 135:af1bebfd96a4 dmd2037

dmd 2.038
author Eldar Insafutdinov <e.insafutdinov@gmail.com>
date Mon, 13 Sep 2010 22:19:42 +0100
parents 60bb0fe4563e
children af724d3510d7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 64
diff changeset
1 module dmd.SymOffExp;
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 64
diff changeset
2
114
e28b18c23469 added a module dmd.common for commonly used stuff
Trass3r
parents: 108
diff changeset
3 import dmd.common;
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 64
diff changeset
4 import dmd.Expression;
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 64
diff changeset
5 import dmd.Declaration;
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 64
diff changeset
6 import dmd.MATCH;
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 64
diff changeset
7 import dmd.Type;
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 64
diff changeset
8 import dmd.OutBuffer;
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 64
diff changeset
9 import dmd.Loc;
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 64
diff changeset
10 import dmd.Scope;
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 64
diff changeset
11 import dmd.InlineDoState;
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 64
diff changeset
12 import dmd.HdrGenState;
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 64
diff changeset
13 import dmd.backend.dt_t;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
14 import dmd.SymbolExp;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
15 import dmd.VarDeclaration;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
16 import dmd.DelegateExp;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
17 import dmd.ThisExp;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
18 import dmd.FuncDeclaration;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
19 import dmd.IntegerExp;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
20 import dmd.ErrorExp;
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 64
diff changeset
21 import dmd.TY;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
22 import dmd.TOK;
135
af1bebfd96a4 dmd 2.038
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 130
diff changeset
23 import dmd.STC;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
24
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
25 import dmd.backend.Symbol;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
26 import dmd.backend.Util;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
27 import dmd.backend.TYM;
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 64
diff changeset
28
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
29 class SymOffExp : SymbolExp
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
30 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
31 uint offset;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
32
73
ef02e2e203c2 Updating to dmd2.033
korDen
parents: 72
diff changeset
33 this(Loc loc, Declaration var, uint offset, bool hasOverloads = false)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
34 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
35 super(loc, TOK.TOKsymoff, SymOffExp.sizeof, var, hasOverloads);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
36
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
37 this.offset = offset;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
38 VarDeclaration v = var.isVarDeclaration();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
39 if (v && v.needThis())
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
40 error("need 'this' for address of %s", v.toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
41 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
42
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 64
diff changeset
43 override Expression semantic(Scope sc)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
44 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
45 version(LOGSEMANTIC) {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
46 printf("SymOffExp::semantic('%s')\n", toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
47 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
48 //var.semantic(sc);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
49 if (!type)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
50 type = var.type.pointerTo();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
51 VarDeclaration v = var.isVarDeclaration();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
52 if (v)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
53 v.checkNestedReference(sc, loc);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
54 return this;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
55 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
56
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 64
diff changeset
57 override void checkEscape()
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
58 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
59 VarDeclaration v = var.isVarDeclaration();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
60 if (v)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
61 {
135
af1bebfd96a4 dmd 2.038
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 130
diff changeset
62 if (!v.isDataseg() && !(v.storage_class & (STC.STCref | STC.STCout)))
130
60bb0fe4563e dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 129
diff changeset
63 { /* BUG: This should be allowed:
60bb0fe4563e dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 129
diff changeset
64 * void foo()
60bb0fe4563e dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 129
diff changeset
65 * { int a;
60bb0fe4563e dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 129
diff changeset
66 * int* bar() { return &a; }
60bb0fe4563e dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 129
diff changeset
67 * }
60bb0fe4563e dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 129
diff changeset
68 */
135
af1bebfd96a4 dmd 2.038
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 130
diff changeset
69 error("escaping reference to local %s", v.toChars());
130
60bb0fe4563e dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 129
diff changeset
70 }
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
71 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
72 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
73
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 64
diff changeset
74 override void toCBuffer(OutBuffer buf, HdrGenState* hgs)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
75 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
76 assert(false);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
77 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
78
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 64
diff changeset
79 override int isConst()
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
80 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
81 return 2;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
82 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
83
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 64
diff changeset
84 override bool isBool(bool result)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
85 {
129
010eb8f0e18d further work on dmd test suite
korDen
parents: 114
diff changeset
86 return result;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
87 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
88
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 64
diff changeset
89 override Expression doInline(InlineDoState ids)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
90 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
91 int i;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
92
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
93 //printf("SymOffExp.doInline(%s)\n", toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
94 for (i = 0; i < ids.from.dim; i++)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
95 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
96 if (var is cast(Declaration)ids.from.data[i])
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
97 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
98 SymOffExp se = cast(SymOffExp)copy();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
99
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
100 se.var = cast(Declaration)ids.to.data[i];
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
101 return se;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
102 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
103 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
104 return this;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
105 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
106
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 64
diff changeset
107 override MATCH implicitConvTo(Type t)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
108 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
109 static if (false) {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
110 printf("SymOffExp::implicitConvTo(this=%s, type=%s, t=%s)\n", toChars(), type.toChars(), t.toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
111 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
112 MATCH result = type.implicitConvTo(t);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
113 //printf("\tresult = %d\n", result);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
114
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
115 if (result == MATCHnomatch)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
116 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
117 // Look for pointers to functions where the functions are overloaded.
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
118 FuncDeclaration f;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
119
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
120 t = t.toBasetype();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
121 if (type.ty == Tpointer && type.nextOf().ty == Tfunction &&
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
122 (t.ty == Tpointer || t.ty == Tdelegate) && t.nextOf().ty == Tfunction)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
123 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
124 f = var.isFuncDeclaration();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
125 if (f)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
126 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
127 f = f.overloadExactMatch(t.nextOf());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
128 if (f)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
129 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
130 if ((t.ty == Tdelegate && (f.needThis() || f.isNested())) ||
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
131 (t.ty == Tpointer && !(f.needThis() || f.isNested())))
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
132 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
133 result = MATCHexact;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
134 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
135 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
136 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
137 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
138 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
139 //printf("\tresult = %d\n", result);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
140 return result;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
141 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
142
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 64
diff changeset
143 override Expression castTo(Scope sc, Type t)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
144 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
145 static if (false) {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
146 printf("SymOffExp::castTo(this=%s, type=%s, t=%s)\n", toChars(), type.toChars(), t.toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
147 }
73
ef02e2e203c2 Updating to dmd2.033
korDen
parents: 72
diff changeset
148 if (type == t && !hasOverloads)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
149 return this;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
150
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
151 Expression e;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
152 Type tb = t.toBasetype();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
153 Type typeb = type.toBasetype();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
154
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
155 if (tb != typeb)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
156 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
157 // Look for pointers to functions where the functions are overloaded.
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
158 FuncDeclaration f;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
159
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
160 if (hasOverloads &&
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
161 typeb.ty == Tpointer && typeb.nextOf().ty == Tfunction &&
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
162 (tb.ty == Tpointer || tb.ty == Tdelegate) && tb.nextOf().ty == Tfunction)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
163 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
164 f = var.isFuncDeclaration();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
165 if (f)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
166 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
167 f = f.overloadExactMatch(tb.nextOf());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
168 if (f)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
169 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
170 if (tb.ty == Tdelegate)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
171 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
172 if (f.needThis() && hasThis(sc))
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
173 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
174 e = new DelegateExp(loc, new ThisExp(loc), f);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
175 e = e.semantic(sc);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
176 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
177 else if (f.isNested())
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
178 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
179 e = new DelegateExp(loc, new IntegerExp(0), f);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
180 e = e.semantic(sc);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
181 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
182 else if (f.needThis())
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
183 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
184 error("no 'this' to create delegate for %s", f.toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
185 e = new ErrorExp();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
186 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
187 else
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
188 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
189 error("cannot cast from function pointer to delegate");
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
190 e = new ErrorExp();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
191 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
192 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
193 else
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
194 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
195 e = new SymOffExp(loc, f, 0);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
196 e.type = t;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
197 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
198 version (DMDV2) {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
199 f.tookAddressOf++;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
200 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
201 return e;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
202 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
203 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
204 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
205 e = Expression.castTo(sc, t);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
206 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
207 else
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
208 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
209 e = copy();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
210 e.type = t;
73
ef02e2e203c2 Updating to dmd2.033
korDen
parents: 72
diff changeset
211 (cast(SymOffExp)e).hasOverloads = false;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
212 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
213 return e;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
214 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
215
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 64
diff changeset
216 override void scanForNestedRef(Scope sc)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
217 {
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 64
diff changeset
218 //printf("SymOffExp.scanForNestedRef(%s)\n", toChars());
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 64
diff changeset
219 VarDeclaration v = var.isVarDeclaration();
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 64
diff changeset
220 if (v)
64
4290d870944a More fixes
korDen
parents: 0
diff changeset
221 v.checkNestedReference(sc, Loc(0));
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
222 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
223
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 64
diff changeset
224 override dt_t** toDt(dt_t** pdt)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
225 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
226 //printf("SymOffExp.toDt('%s')\n", var.toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
227 assert(var);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
228 if (!(var.isDataseg() || var.isCodeseg()) ||
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
229 var.needThis() ||
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
230 var.isThreadlocal()
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
231 )
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
232 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
233 debug writef("SymOffExp.toDt()\n");
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
234 error("non-constant expression %s", toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
235 return pdt;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
236 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
237
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
238 Symbol* s = var.toSymbol();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
239 return dtxoff(pdt, s, offset, TYnptr);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
240 }
108
6da99741178e e2ir.c changes, mainly accounts for static arrays being value types now
Trass3r
parents: 73
diff changeset
241
6da99741178e e2ir.c changes, mainly accounts for static arrays being value types now
Trass3r
parents: 73
diff changeset
242 static if (false)
6da99741178e e2ir.c changes, mainly accounts for static arrays being value types now
Trass3r
parents: 73
diff changeset
243 {
6da99741178e e2ir.c changes, mainly accounts for static arrays being value types now
Trass3r
parents: 73
diff changeset
244 override elem* toElem(IRState* irs)
6da99741178e e2ir.c changes, mainly accounts for static arrays being value types now
Trass3r
parents: 73
diff changeset
245 {
6da99741178e e2ir.c changes, mainly accounts for static arrays being value types now
Trass3r
parents: 73
diff changeset
246 assert(false); // this function is #if 0'ed out in dmd
6da99741178e e2ir.c changes, mainly accounts for static arrays being value types now
Trass3r
parents: 73
diff changeset
247 }
6da99741178e e2ir.c changes, mainly accounts for static arrays being value types now
Trass3r
parents: 73
diff changeset
248 }
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
249 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
250