Mercurial > projects > ddmd
diff dmd/DivExp.d @ 72:2e2a5c3f943a
reduced warnings by adding override to the methods
think this also normalizes different line endings used all over the place
author | Trass3r |
---|---|
date | Sat, 28 Aug 2010 16:19:48 +0200 |
parents | cab4c37afb89 |
children | ceda59b4d255 |
line wrap: on
line diff
--- a/dmd/DivExp.d Sat Aug 28 16:14:07 2010 +0200 +++ b/dmd/DivExp.d Sat Aug 28 16:19:48 2010 +0200 @@ -1,26 +1,26 @@ -module dmd.DivExp; - -import dmd.Expression; -import dmd.Identifier; -import dmd.backend.elem; -import dmd.InterState; -import dmd.OutBuffer; -import dmd.Loc; -import dmd.Scope; -import dmd.IntRange; -import dmd.IRState; -import dmd.ArrayTypes; -import dmd.BinExp; -import dmd.TOK; -import dmd.Type; -import dmd.NegExp; -import dmd.TY; -import dmd.Id; - -import dmd.expression.Div; -import dmd.backend.OPER; -import dmd.backend.Util; - +module dmd.DivExp; + +import dmd.Expression; +import dmd.Identifier; +import dmd.backend.elem; +import dmd.InterState; +import dmd.OutBuffer; +import dmd.Loc; +import dmd.Scope; +import dmd.IntRange; +import dmd.IRState; +import dmd.ArrayTypes; +import dmd.BinExp; +import dmd.TOK; +import dmd.Type; +import dmd.NegExp; +import dmd.TY; +import dmd.Id; + +import dmd.expression.Div; +import dmd.backend.OPER; +import dmd.backend.Util; + class DivExp : BinExp { this(Loc loc, Expression e1, Expression e2) @@ -28,119 +28,119 @@ super(loc, TOK.TOKdiv, DivExp.sizeof, e1, e2); } - Expression semantic(Scope sc) + override Expression semantic(Scope sc) { - Expression e; - - if (type) - return this; - - super.semanticp(sc); - e = op_overload(sc); - if (e) - return e; - - typeCombine(sc); - if (e1.op != TOK.TOKslice && e2.op != TOK.TOKslice) - { - e1.checkArithmetic(); - e2.checkArithmetic(); - } - if (type.isfloating()) - { - Type t1 = e1.type; - Type t2 = e2.type; - - if (t1.isreal()) - { - type = t2; - if (t2.isimaginary()) - { - // x/iv = i(-x/v) - e2.type = t1; - Expression ee = new NegExp(loc, this); - ee = ee.semantic(sc); - return e; - } - } - else if (t2.isreal()) - { - type = t1; - } - else if (t1.isimaginary()) - { - if (t2.isimaginary()) { - switch (t1.ty) - { - case TY.Timaginary32: type = Type.tfloat32; break; - case TY.Timaginary64: type = Type.tfloat64; break; - case TY.Timaginary80: type = Type.tfloat80; break; - default: assert(0); - } - } else { - type = t2; // t2 is complex - } - } - else if (t2.isimaginary()) - { - type = t1; // t1 is complex - } - } + Expression e; + + if (type) + return this; + + super.semanticp(sc); + e = op_overload(sc); + if (e) + return e; + + typeCombine(sc); + if (e1.op != TOK.TOKslice && e2.op != TOK.TOKslice) + { + e1.checkArithmetic(); + e2.checkArithmetic(); + } + if (type.isfloating()) + { + Type t1 = e1.type; + Type t2 = e2.type; + + if (t1.isreal()) + { + type = t2; + if (t2.isimaginary()) + { + // x/iv = i(-x/v) + e2.type = t1; + Expression ee = new NegExp(loc, this); + ee = ee.semantic(sc); + return e; + } + } + else if (t2.isreal()) + { + type = t1; + } + else if (t1.isimaginary()) + { + if (t2.isimaginary()) { + switch (t1.ty) + { + case TY.Timaginary32: type = Type.tfloat32; break; + case TY.Timaginary64: type = Type.tfloat64; break; + case TY.Timaginary80: type = Type.tfloat80; break; + default: assert(0); + } + } else { + type = t2; // t2 is complex + } + } + else if (t2.isimaginary()) + { + type = t1; // t1 is complex + } + } return this; } - Expression optimize(int result) + override Expression optimize(int result) { - Expression e; - - //printf("DivExp.optimize(%s)\n", toChars()); - e1 = e1.optimize(result); - e2 = e2.optimize(result); - if (e1.isConst() == 1 && e2.isConst() == 1) - { - e = Div(type, e1, e2); - } - else - e = this; + Expression e; + + //printf("DivExp.optimize(%s)\n", toChars()); + e1 = e1.optimize(result); + e2 = e2.optimize(result); + if (e1.isConst() == 1 && e2.isConst() == 1) + { + e = Div(type, e1, e2); + } + else + e = this; return e; } - Expression interpret(InterState istate) + override Expression interpret(InterState istate) { assert(false); } - void buildArrayIdent(OutBuffer buf, Expressions arguments) + override void buildArrayIdent(OutBuffer buf, Expressions arguments) { Exp_buildArrayIdent(buf, arguments, "Div"); } - Expression buildArrayLoop(Arguments fparams) + override Expression buildArrayLoop(Arguments fparams) { - /* Evaluate assign expressions left to right - */ - Expression ex1 = e1.buildArrayLoop(fparams); - Expression ex2 = e2.buildArrayLoop(fparams); - Expression e = new DivExp(Loc(0), ex1, ex2); + /* Evaluate assign expressions left to right + */ + Expression ex1 = e1.buildArrayLoop(fparams); + Expression ex2 = e2.buildArrayLoop(fparams); + Expression e = new DivExp(Loc(0), ex1, ex2); return e; } - IntRange getIntRange() + override IntRange getIntRange() { assert(false); } - Identifier opId() + override Identifier opId() { return Id.div; } - Identifier opId_r() + override Identifier opId_r() { return Id.div_r; } - elem* toElem(IRState* irs) + override elem* toElem(IRState* irs) { return toElemBin(irs,OPdiv); }