annotate dmd/CatExp.d @ 63:cab4c37afb89

A bunch of implementations
author korDen
date Mon, 23 Aug 2010 16:52:24 +0400
parents 10317f0c89a5
children 2e2a5c3f943a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
1 module dmd.CatExp;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
2
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
3 import dmd.Expression;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
4 import dmd.Identifier;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
5 import dmd.InterState;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
6 import dmd.Loc;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
7 import dmd.Scope;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
8 import dmd.IRState;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
9 import dmd.BinExp;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
10 import dmd.TOK;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
11 import dmd.Type;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
12 import dmd.TY;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
13 import dmd.MATCH;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
14 import dmd.ArrayLiteralExp;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
15 import dmd.StringExp;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
16 import dmd.WANT;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
17 import dmd.Id;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
18 import dmd.GlobalExpressions;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
19
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
20 import dmd.backend.elem;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
21 import dmd.backend.Util;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
22 import dmd.backend.TYM;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
23 import dmd.backend.OPER;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
24 import dmd.backend.RTLSYM;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
25 import dmd.codegen.Util;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
26 import dmd.expression.Cat;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
27
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
28 class CatExp : BinExp
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
29 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
30 this(Loc loc, Expression e1, Expression e2)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
31 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
32 super(loc, TOK.TOKcat, CatExp.sizeof, e1, e2);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
33 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
34
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
35 Expression semantic(Scope sc)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
36 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
37 Expression e;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
38
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
39 //printf("CatExp.semantic() %s\n", toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
40 if (!type)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
41 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
42 BinExp.semanticp(sc);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
43 e = op_overload(sc);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
44 if (e)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
45 return e;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
46
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
47 Type tb1 = e1.type.toBasetype();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
48 Type tb2 = e2.type.toBasetype();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
49
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
50
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
51 /* BUG: Should handle things like:
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
52 * char c;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
53 * c ~ ' '
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
54 * ' ' ~ c;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
55 */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
56
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
57 static if (false) {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
58 e1.type.print();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
59 e2.type.print();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
60 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
61 if ((tb1.ty == Tsarray || tb1.ty == Tarray) &&
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
62 e2.type.implicitConvTo(tb1.nextOf()) >= MATCHconst)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
63 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
64 type = tb1.nextOf().arrayOf();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
65 if (tb2.ty == Tarray)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
66 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
67 // Make e2 into [e2]
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
68 e2 = new ArrayLiteralExp(e2.loc, e2);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
69 e2.type = type;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
70 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
71 return this;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
72 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
73 else if ((tb2.ty == Tsarray || tb2.ty == Tarray) &&
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
74 e1.type.implicitConvTo(tb2.nextOf()) >= MATCHconst)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
75 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
76 type = tb2.nextOf().arrayOf();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
77 if (tb1.ty == Tarray)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
78 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
79 // Make e1 into [e1]
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
80 e1 = new ArrayLiteralExp(e1.loc, e1);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
81 e1.type = type;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
82 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
83 return this;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
84 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
85
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
86 if ((tb1.ty == Tsarray || tb1.ty == Tarray) &&
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
87 (tb2.ty == Tsarray || tb2.ty == Tarray) &&
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
88 (tb1.nextOf().mod || tb2.nextOf().mod) &&
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
89 (tb1.nextOf().mod != tb2.nextOf().mod)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
90 )
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
91 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
92 Type t1 = tb1.nextOf().mutableOf().constOf().arrayOf();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
93 Type t2 = tb2.nextOf().mutableOf().constOf().arrayOf();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
94 if (e1.op == TOKstring && !(cast(StringExp)e1).committed)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
95 e1.type = t1;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
96 else
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
97 e1 = e1.castTo(sc, t1);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
98 if (e2.op == TOKstring && !(cast(StringExp)e2).committed)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
99 e2.type = t2;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
100 else
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
101 e2 = e2.castTo(sc, t2);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
102 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
103
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
104 typeCombine(sc);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
105 type = type.toHeadMutable();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
106
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
107 Type tb = type.toBasetype();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
108 if (tb.ty == Tsarray)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
109 type = tb.nextOf().arrayOf();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
110 if (type.ty == Tarray && tb1.nextOf() && tb2.nextOf() &&
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
111 tb1.nextOf().mod != tb2.nextOf().mod)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
112 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
113 type = type.nextOf().toHeadMutable().arrayOf();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
114 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
115 static if (false) {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
116 e1.type.print();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
117 e2.type.print();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
118 type.print();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
119 print();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
120 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
121 Type t1 = e1.type.toBasetype();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
122 Type t2 = e2.type.toBasetype();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
123 if (e1.op == TOKstring && e2.op == TOKstring)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
124 e = optimize(WANTvalue);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
125 else if ((t1.ty == Tarray || t1.ty == Tsarray) &&
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
126 (t2.ty == Tarray || t2.ty == Tsarray))
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
127 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
128 e = this;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
129 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
130 else
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
131 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
132 //printf("(%s) ~ (%s)\n", e1.toChars(), e2.toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
133 error("Can only concatenate arrays, not (%s ~ %s)",
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
134 e1.type.toChars(), e2.type.toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
135 type = Type.tint32;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
136 e = this;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
137 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
138 e.type = e.type.semantic(loc, sc);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
139 return e;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
140 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
141 return this;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
142 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
143
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
144 Expression optimize(int result)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
145 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
146 //printf("CatExp::optimize(%d) %s\n", result, toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
147 e1 = e1.optimize(result);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
148 e2 = e2.optimize(result);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
149 Expression e = Cat(type, e1, e2);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
150 if (e is EXP_CANT_INTERPRET)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
151 e = this;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
152
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
153 return e;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
154 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
155
63
cab4c37afb89 A bunch of implementations
korDen
parents: 0
diff changeset
156 Expression interpret(InterState istate)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
157 {
63
cab4c37afb89 A bunch of implementations
korDen
parents: 0
diff changeset
158 Expression e;
cab4c37afb89 A bunch of implementations
korDen
parents: 0
diff changeset
159 Expression e1;
cab4c37afb89 A bunch of implementations
korDen
parents: 0
diff changeset
160 Expression e2;
cab4c37afb89 A bunch of implementations
korDen
parents: 0
diff changeset
161
cab4c37afb89 A bunch of implementations
korDen
parents: 0
diff changeset
162 version (LOG) {
cab4c37afb89 A bunch of implementations
korDen
parents: 0
diff changeset
163 printf("CatExp.interpret() %.*s\n", toChars());
cab4c37afb89 A bunch of implementations
korDen
parents: 0
diff changeset
164 }
cab4c37afb89 A bunch of implementations
korDen
parents: 0
diff changeset
165 e1 = this.e1.interpret(istate);
cab4c37afb89 A bunch of implementations
korDen
parents: 0
diff changeset
166 if (e1 is EXP_CANT_INTERPRET)
cab4c37afb89 A bunch of implementations
korDen
parents: 0
diff changeset
167 {
cab4c37afb89 A bunch of implementations
korDen
parents: 0
diff changeset
168 goto Lcant;
cab4c37afb89 A bunch of implementations
korDen
parents: 0
diff changeset
169 }
cab4c37afb89 A bunch of implementations
korDen
parents: 0
diff changeset
170 e2 = this.e2.interpret(istate);
cab4c37afb89 A bunch of implementations
korDen
parents: 0
diff changeset
171 if (e2 is EXP_CANT_INTERPRET)
cab4c37afb89 A bunch of implementations
korDen
parents: 0
diff changeset
172 goto Lcant;
cab4c37afb89 A bunch of implementations
korDen
parents: 0
diff changeset
173 return Cat(type, e1, e2);
cab4c37afb89 A bunch of implementations
korDen
parents: 0
diff changeset
174
cab4c37afb89 A bunch of implementations
korDen
parents: 0
diff changeset
175 Lcant:
cab4c37afb89 A bunch of implementations
korDen
parents: 0
diff changeset
176 version (LOG) {
cab4c37afb89 A bunch of implementations
korDen
parents: 0
diff changeset
177 printf("CatExp.interpret() %.*s CANT\n", toChars());
cab4c37afb89 A bunch of implementations
korDen
parents: 0
diff changeset
178 }
cab4c37afb89 A bunch of implementations
korDen
parents: 0
diff changeset
179 return EXP_CANT_INTERPRET;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
180 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
181
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
182 Identifier opId()
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
183 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
184 return Id.cat;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
185 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
186
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
187 Identifier opId_r()
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
188 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
189 return Id.cat_r;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
190 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
191
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
192 elem* toElem(IRState* irs)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
193 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
194 elem *e;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
195
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
196 static if (false) {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
197 printf("CatExp::toElem()\n");
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
198 print();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
199 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
200
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
201 Type tb1 = e1.type.toBasetype();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
202 Type tb2 = e2.type.toBasetype();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
203 Type tn;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
204
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
205 ///static if (false) {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
206 /// if ((tb1.ty == Tarray || tb1.ty == Tsarray) &&
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
207 /// (tb2.ty == Tarray || tb2.ty == Tsarray)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
208 /// )
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
209 ///}
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
210
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
211 Type ta = tb1.nextOf() ? e1.type : e2.type;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
212 tn = tb1.nextOf() ? tb1.nextOf() : tb2.nextOf();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
213 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
214 if (e1.op == TOKcat)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
215 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
216 elem* ep;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
217 CatExp ce = this;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
218 int n = 2;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
219
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
220 ep = eval_Darray(irs, ce.e2);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
221 do
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
222 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
223 n++;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
224 ce = cast(CatExp)ce.e1;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
225 ep = el_param(ep, eval_Darray(irs, ce.e2));
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
226 } while (ce.e1.op == TOKcat);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
227
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
228 ep = el_param(ep, eval_Darray(irs, ce.e1));
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
229 static if (true) {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
230 ep = el_params(
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
231 ep,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
232 el_long(TYint, n),
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
233 ta.getTypeInfo(null).toElem(irs),
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
234 null);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
235 e = el_bin(OPcall, TYdarray, el_var(rtlsym[RTLSYM_ARRAYCATNT]), ep);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
236 } else {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
237 ep = el_params(
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
238 ep,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
239 el_long(TYint, n),
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
240 el_long(TYint, tn.size()),
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
241 null);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
242 e = el_bin(OPcall, TYdarray, el_var(rtlsym[RTLSYM_ARRAYCATN]), ep);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
243 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
244 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
245 else
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
246 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
247 elem *e1;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
248 elem *e2;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
249 elem *ep;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
250
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
251 e1 = eval_Darray(irs, this.e1);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
252 e2 = eval_Darray(irs, this.e2);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
253 static if (true) {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
254 ep = el_params(e2, e1, ta.getTypeInfo(null).toElem(irs), null);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
255 e = el_bin(OPcall, TYdarray, el_var(rtlsym[RTLSYM_ARRAYCATT]), ep);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
256 } else {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
257 ep = el_params(el_long(TYint, tn.size()), e2, e1, null);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
258 e = el_bin(OPcall, TYdarray, el_var(rtlsym[RTLSYM_ARRAYCAT]), ep);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
259 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
260 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
261 el_setLoc(e,loc);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
262 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
263 /// static if (false) {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
264 /// else if ((tb1.ty == Tarray || tb1.ty == Tsarray) &&
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
265 /// e2.type.equals(tb1.next))
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
266 /// {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
267 /// error("array cat with element not implemented");
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
268 /// e = el_long(TYint, 0);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
269 /// }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
270 /// else
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
271 /// assert(0);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
272 /// }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
273 return e;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
274 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
275 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
276