Mercurial > projects > ddmd
annotate dmd/MinAssignExp.d @ 63:cab4c37afb89
A bunch of implementations
author | korDen |
---|---|
date | Mon, 23 Aug 2010 16:52:24 +0400 |
parents | 832f71e6f96c |
children | 2e2a5c3f943a |
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 | |
27 Expression semantic(Scope sc) | |
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(); | |
57 type = e1.type; | |
58 typeCombine(sc); | |
59 if (type.isreal() || type.isimaginary()) | |
60 { | |
61 assert(e2.type.isfloating()); | |
62 e2 = e2.castTo(sc, e1.type); | |
63 } | |
64 e = this; | |
65 } | |
66 return e; | |
67 } | |
68 | |
63 | 69 Expression interpret(InterState istate) |
0 | 70 { |
71 assert(false); | |
72 } | |
73 | |
74 void buildArrayIdent(OutBuffer buf, Expressions arguments) | |
75 { | |
12
832f71e6f96c
*Exp and *AssignExp arrayOp implementation added (might be a bit incomplete)
korDen
parents:
0
diff
changeset
|
76 AssignExp_buildArrayIdent(buf, arguments, "Min"); |
0 | 77 } |
78 | |
79 Expression buildArrayLoop(Arguments fparams) | |
80 { | |
81 assert(false); | |
82 } | |
83 | |
84 Identifier opId() /* For operator overloading */ | |
85 { | |
86 return Id.subass; | |
87 } | |
88 | |
89 elem* toElem(IRState* irs) | |
90 { | |
91 return toElemBin(irs,OPminass); | |
92 } | |
93 } |