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