File tree 3 files changed +10
-6
lines changed
3 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import transform.MegaPhase.MiniPhase
8
8
import Decorators ._
9
9
import Symbols .Symbol
10
10
import Constants .Constant
11
+ import StdNames ._
11
12
12
13
class DivideZero extends MiniPhase with Plugin {
13
14
val name : String = " divideZero"
@@ -24,9 +25,9 @@ class DivideZero extends MiniPhase with Plugin {
24
25
25
26
private def isNumericDivide (sym : Symbol )(implicit ctx : Context ): Boolean = {
26
27
def test (tpe : String ): Boolean =
27
- (sym.owner eq ctx.requiredClass(tpe.toTermName)) && sym.name.show == " / "
28
+ (sym.owner eq ctx.requiredClass(tpe.toTermName)) && sym.name == nme. DIV
28
29
29
- test(" scala.Int" ) || test(" scala.Long" ) || test(" scala.Short" ) || test(" scala.FLoat " ) || test(" scala.Double" )
30
+ test(" scala.Int" ) || test(" scala.Long" ) || test(" scala.Short" ) || test(" scala.Float " ) || test(" scala.Double" )
30
31
}
31
32
32
33
override def transformApply (tree : tpd.Apply )(implicit ctx : Context ): tpd.Tree = tree match {
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import Decorators._
9
9
import Symbols .Symbol
10
10
import Constants .Constant
11
11
import transform .{LinkAll , Pickler }
12
+ import StdNames ._
12
13
13
14
class DivideZero extends PluginPhase with Plugin {
14
15
val name : String = " divideZero"
@@ -23,9 +24,9 @@ class DivideZero extends PluginPhase with Plugin {
23
24
24
25
private def isNumericDivide (sym : Symbol )(implicit ctx : Context ): Boolean = {
25
26
def test (tpe : String ): Boolean =
26
- (sym.owner eq ctx.requiredClass(tpe.toTermName)) && sym.name.show == " / "
27
+ (sym.owner eq ctx.requiredClass(tpe.toTermName)) && sym.name == nme. DIV
27
28
28
- test(" scala.Int" ) || test(" scala.Long" ) || test(" scala.Short" ) || test(" scala.FLoat " ) || test(" scala.Double" )
29
+ test(" scala.Int" ) || test(" scala.Long" ) || test(" scala.Short" ) || test(" scala.Float " ) || test(" scala.Double" )
29
30
}
30
31
31
32
override def transformApply (tree : tpd.Apply )(implicit ctx : Context ): tpd.Tree = tree match {
Original file line number Diff line number Diff line change @@ -8,6 +8,8 @@ import transform.MegaPhase.MiniPhase
8
8
import Decorators ._
9
9
import Symbols .Symbol
10
10
import Constants .Constant
11
+ import StdNames ._
12
+
11
13
12
14
class DivideZero extends MiniPhase with Plugin {
13
15
val name : String = " divideZero"
@@ -24,9 +26,9 @@ class DivideZero extends MiniPhase with Plugin {
24
26
25
27
private def isNumericDivide (sym : Symbol )(implicit ctx : Context ): Boolean = {
26
28
def test (tpe : String ): Boolean =
27
- (sym.owner eq ctx.requiredClass(tpe.toTermName)) && sym.name.show == " / "
29
+ (sym.owner eq ctx.requiredClass(tpe.toTermName)) && sym.name == nme. DIV
28
30
29
- test(" scala.Int" ) || test(" scala.Long" ) || test(" scala.Short" ) || test(" scala.FLoat " ) || test(" scala.Double" )
31
+ test(" scala.Int" ) || test(" scala.Long" ) || test(" scala.Short" ) || test(" scala.Float " ) || test(" scala.Double" )
30
32
}
31
33
32
34
override def transformApply (tree : tpd.Apply )(implicit ctx : Context ): tpd.Tree = tree match {
You can’t perform that action at this time.
0 commit comments