Mercurial > projects > ddmd
annotate dmd/UshrAssignExp.d @ 178:e3afd1303184
Many small bugs fixed
Made all classes derive from TObject to detect memory leaks (functionality is disabled for now)
Began work on overriding backend memory allocations (to avoid memory leaks)
author | korDen |
---|---|
date | Sun, 17 Oct 2010 07:42:00 +0400 |
parents | 206db751bd4c |
children | b0d41ff5e0df |
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 { | |
178 | 25 register(); |
0 | 26 super(loc, TOK.TOKushrass, UshrAssignExp.sizeof, e1, e2); |
27 } | |
28 | |
72 | 29 override Expression semantic(Scope sc) |
0 | 30 { |
31 Expression e; | |
32 | |
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, &Ushr); |
0 | 61 } |
62 | |
72 | 63 override Identifier opId() /* For operator overloading */ |
0 | 64 { |
65 return Id.ushrass; | |
66 } | |
67 | |
72 | 68 override elem* toElem(IRState* irs) |
0 | 69 { |
130
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
117
diff
changeset
|
70 return toElemBin(irs, OPER.OPshrass); |
0 | 71 } |
72 | 72 } |