Mercurial > projects > ddmd
annotate dmd/ShlAssignExp.d @ 182:b64060ab22df
Now compileable with dmd2.050
author | korDen |
---|---|
date | Sat, 30 Oct 2010 05:05:32 +0400 |
parents | e3afd1303184 |
children | b0d41ff5e0df |
rev | line source |
---|---|
0 | 1 module dmd.ShlAssignExp; |
2 | |
114 | 3 import dmd.common; |
0 | 4 import dmd.BinExp; |
5 import dmd.Loc; | |
6 import dmd.Expression; | |
7 import dmd.Scope; | |
8 import dmd.InterState; | |
9 import dmd.Identifier; | |
10 import dmd.IRState; | |
11 import dmd.TOK; | |
12 import dmd.Id; | |
13 import dmd.Type; | |
131
206db751bd4c
dmdfe 2.037 compiles now
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
130
diff
changeset
|
14 import dmd.ArrayLengthExp; |
0 | 15 import dmd.backend.elem; |
16 import dmd.backend.OPER; | |
117 | 17 import dmd.expression.Shl; |
0 | 18 import dmd.expression.Util; |
19 | |
20 class ShlAssignExp : BinExp | |
21 { | |
22 this(Loc loc, Expression e1, Expression e2) | |
23 { | |
178 | 24 register(); |
0 | 25 super(loc, TOK.TOKshlass, ShlAssignExp.sizeof, e1, e2); |
26 } | |
27 | |
72 | 28 override Expression semantic(Scope sc) |
0 | 29 { |
30 Expression e; | |
31 | |
32 //printf("ShlAssignExp.semantic()\n"); | |
33 BinExp.semantic(sc); | |
34 e2 = resolveProperties(sc, e2); | |
35 | |
36 e = op_overload(sc); | |
37 if (e) | |
38 return e; | |
39 | |
130
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
117
diff
changeset
|
40 if (e1.op == TOK.TOKarraylength) |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
117
diff
changeset
|
41 { |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
117
diff
changeset
|
42 e = ArrayLengthExp.rewriteOpAssign(this); |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
117
diff
changeset
|
43 e = e.semantic(sc); |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
117
diff
changeset
|
44 return e; |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
117
diff
changeset
|
45 } |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
117
diff
changeset
|
46 |
0 | 47 e1 = e1.modifiableLvalue(sc, e1); |
48 e1.checkScalar(); | |
49 e1.checkNoBool(); | |
50 type = e1.type; | |
51 typeCombine(sc); | |
52 e1.checkIntegral(); | |
53 e2 = e2.checkIntegral(); | |
54 e2 = e2.castTo(sc, Type.tshiftcnt); | |
55 return this; | |
56 } | |
57 | |
72 | 58 override Expression interpret(InterState istate) |
0 | 59 { |
117 | 60 return interpretAssignCommon(istate, &Shl); |
0 | 61 } |
62 | |
72 | 63 override Identifier opId() /* For operator overloading */ |
0 | 64 { |
65 return Id.shlass; | |
66 } | |
67 | |
72 | 68 override elem* toElem(IRState* irs) |
0 | 69 { |
70 return toElemBin(irs,OPshlass); | |
71 } | |
72 | 72 } |