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