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