Mercurial > projects > ddmd
annotate dmd/MinAssignExp.d @ 114:e28b18c23469
added a module dmd.common for commonly used stuff
it currently holds code for consistency checking of predefined versions
also added a VisualD project file
author | Trass3r |
---|---|
date | Wed, 01 Sep 2010 18:21:58 +0200 |
parents | ef02e2e203c2 |
children | fe941d774f4a |
rev | line source |
---|---|
0 | 1 module dmd.MinAssignExp; |
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.OutBuffer; | |
10 import dmd.ArrayTypes; | |
11 import dmd.Identifier; | |
12 import dmd.IRState; | |
13 import dmd.TY; | |
14 import dmd.TOK; | |
15 import dmd.Id; | |
16 | |
17 import dmd.backend.elem; | |
18 import dmd.backend.Util; | |
19 import dmd.backend.OPER; | |
20 | |
21 class MinAssignExp : BinExp | |
22 { | |
23 this(Loc loc, Expression e1, Expression e2) | |
24 { | |
25 super(loc, TOK.TOKminass, MinAssignExp.sizeof, e1, e2); | |
26 } | |
27 | |
72 | 28 override Expression semantic(Scope sc) |
0 | 29 { |
30 Expression e; | |
31 | |
32 if (type) | |
33 return this; | |
34 | |
35 BinExp.semantic(sc); | |
36 e2 = resolveProperties(sc, e2); | |
37 | |
38 e = op_overload(sc); | |
39 if (e) | |
40 return e; | |
41 | |
42 if (e1.op == TOKslice) | |
43 { // T[] -= ... | |
44 typeCombine(sc); | |
45 type = e1.type; | |
46 return arrayOp(sc); | |
47 } | |
48 | |
49 e1 = e1.modifiableLvalue(sc, e1); | |
50 e1.checkScalar(); | |
51 e1.checkNoBool(); | |
52 if (e1.type.ty == Tpointer && e2.type.isintegral()) | |
53 e = scaleFactor(sc); | |
54 else | |
55 { | |
56 e1 = e1.checkArithmetic(); | |
57 e2 = e2.checkArithmetic(); | |
73 | 58 checkComplexAddAssign(); |
0 | 59 type = e1.type; |
60 typeCombine(sc); | |
61 if (type.isreal() || type.isimaginary()) | |
62 { | |
63 assert(e2.type.isfloating()); | |
64 e2 = e2.castTo(sc, e1.type); | |
65 } | |
66 e = this; | |
67 } | |
68 return e; | |
69 } | |
70 | |
72 | 71 override Expression interpret(InterState istate) |
0 | 72 { |
73 assert(false); | |
74 } | |
75 | |
72 | 76 override void buildArrayIdent(OutBuffer buf, Expressions arguments) |
0 | 77 { |
12
832f71e6f96c
*Exp and *AssignExp arrayOp implementation added (might be a bit incomplete)
korDen
parents:
0
diff
changeset
|
78 AssignExp_buildArrayIdent(buf, arguments, "Min"); |
0 | 79 } |
80 | |
72 | 81 override Expression buildArrayLoop(Arguments fparams) |
0 | 82 { |
83 assert(false); | |
84 } | |
85 | |
72 | 86 override Identifier opId() /* For operator overloading */ |
0 | 87 { |
88 return Id.subass; | |
89 } | |
90 | |
72 | 91 override elem* toElem(IRState* irs) |
0 | 92 { |
93 return toElemBin(irs,OPminass); | |
94 } | |
72 | 95 } |