Mercurial > projects > ddmd
annotate dmd/ShlAssignExp.d @ 130:60bb0fe4563e
dmdfe 2.037 first main iteration
author | Eldar Insafutdinov <e.insafutdinov@gmail.com> |
---|---|
date | Thu, 09 Sep 2010 22:51:44 +0100 |
parents | fe941d774f4a |
children | 206db751bd4c |
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; | |
14 import dmd.backend.elem; | |
15 import dmd.backend.OPER; | |
117 | 16 import dmd.expression.Shl; |
0 | 17 import dmd.expression.Util; |
18 | |
19 class ShlAssignExp : BinExp | |
20 { | |
21 this(Loc loc, Expression e1, Expression e2) | |
22 { | |
23 super(loc, TOK.TOKshlass, ShlAssignExp.sizeof, e1, e2); | |
24 } | |
25 | |
72 | 26 override Expression semantic(Scope sc) |
0 | 27 { |
28 Expression e; | |
29 | |
30 //printf("ShlAssignExp.semantic()\n"); | |
31 BinExp.semantic(sc); | |
32 e2 = resolveProperties(sc, e2); | |
33 | |
34 e = op_overload(sc); | |
35 if (e) | |
36 return e; | |
37 | |
130
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
117
diff
changeset
|
38 if (e1.op == TOK.TOKarraylength) |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
117
diff
changeset
|
39 { |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
117
diff
changeset
|
40 e = ArrayLengthExp.rewriteOpAssign(this); |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
117
diff
changeset
|
41 e = e.semantic(sc); |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
117
diff
changeset
|
42 return e; |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
117
diff
changeset
|
43 } |
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
117
diff
changeset
|
44 |
0 | 45 e1 = e1.modifiableLvalue(sc, e1); |
46 e1.checkScalar(); | |
47 e1.checkNoBool(); | |
48 type = e1.type; | |
49 typeCombine(sc); | |
50 e1.checkIntegral(); | |
51 e2 = e2.checkIntegral(); | |
52 e2 = e2.castTo(sc, Type.tshiftcnt); | |
53 return this; | |
54 } | |
55 | |
72 | 56 override Expression interpret(InterState istate) |
0 | 57 { |
117 | 58 return interpretAssignCommon(istate, &Shl); |
0 | 59 } |
60 | |
72 | 61 override Identifier opId() /* For operator overloading */ |
0 | 62 { |
63 return Id.shlass; | |
64 } | |
65 | |
72 | 66 override elem* toElem(IRState* irs) |
0 | 67 { |
68 return toElemBin(irs,OPshlass); | |
69 } | |
72 | 70 } |