summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/symtab/Definitions.scala
diff options
context:
space:
mode:
authormihaylov <mihaylov@epfl.ch>2006-12-13 12:45:37 +0000
committermihaylov <mihaylov@epfl.ch>2006-12-13 12:45:37 +0000
commitf1e049215534d15db013ed0b1c791d027719fb9b (patch)
tree62a5f609dbfe0ec85961c46974c0e3d768bd5f1e /src/compiler/scala/tools/nsc/symtab/Definitions.scala
parent0d16edd1cec50620f0a270e81945a16483c9983b (diff)
downloadscala-f1e049215534d15db013ed0b1c791d027719fb9b.tar.gz
scala-f1e049215534d15db013ed0b1c791d027719fb9b.tar.bz2
scala-f1e049215534d15db013ed0b1c791d027719fb9b.zip
Added various constants to the primitive types ...
Added various constants to the primitive types modules
Diffstat (limited to 'src/compiler/scala/tools/nsc/symtab/Definitions.scala')
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Definitions.scala28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/Definitions.scala b/src/compiler/scala/tools/nsc/symtab/Definitions.scala
index e003d31746..36906ad7e7 100644
--- a/src/compiler/scala/tools/nsc/symtab/Definitions.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Definitions.scala
@@ -491,6 +491,34 @@ trait Definitions requires SymbolTable {
initValueClass(FloatClass, false)
initValueClass(DoubleClass, false)
}
+ def addModuleMethod(clazz: Symbol, name: Name, value: Any): Unit = {
+ val owner = clazz.linkedClassOfClass
+ newParameterlessMethod(owner, name, ConstantType(Constant(value)))
+ }
+ addModuleMethod(ByteClass, "MinValue", java.lang.Byte.MIN_VALUE)
+ addModuleMethod(ByteClass, "MaxValue", java.lang.Byte.MAX_VALUE)
+ addModuleMethod(ShortClass, "MinValue", java.lang.Short.MIN_VALUE)
+ addModuleMethod(ShortClass, "MaxValue", java.lang.Short.MAX_VALUE)
+ addModuleMethod(CharClass, "MinValue", java.lang.Character.MIN_VALUE)
+ addModuleMethod(CharClass, "MaxValue", java.lang.Character.MAX_VALUE)
+ addModuleMethod(IntClass, "MinValue", java.lang.Integer.MIN_VALUE)
+ addModuleMethod(IntClass, "MaxValue", java.lang.Integer.MAX_VALUE)
+ addModuleMethod(LongClass, "MinValue", java.lang.Long.MIN_VALUE)
+ addModuleMethod(LongClass, "MaxValue", java.lang.Long.MAX_VALUE)
+
+ addModuleMethod(FloatClass, "MinValue", -java.lang.Float.MAX_VALUE)
+ addModuleMethod(FloatClass, "MaxValue", java.lang.Float.MAX_VALUE)
+ addModuleMethod(FloatClass, "Epsilon", java.lang.Float.MIN_VALUE)
+ addModuleMethod(FloatClass, "NaN", java.lang.Float.NaN)
+ addModuleMethod(FloatClass, "PositiveInfinity", java.lang.Float.POSITIVE_INFINITY)
+ addModuleMethod(FloatClass, "NegativeInfinity", java.lang.Float.NEGATIVE_INFINITY)
+
+ addModuleMethod(DoubleClass, "MinValue", -java.lang.Double.MAX_VALUE)
+ addModuleMethod(DoubleClass, "MaxValue", java.lang.Double.MAX_VALUE)
+ addModuleMethod(DoubleClass, "Epsilon", java.lang.Double.MIN_VALUE)
+ addModuleMethod(DoubleClass, "NaN", java.lang.Double.NaN)
+ addModuleMethod(DoubleClass, "PositiveInfinity", java.lang.Double.POSITIVE_INFINITY)
+ addModuleMethod(DoubleClass, "NegativeInfinity", java.lang.Double.NEGATIVE_INFINITY)
}
/** Is symbol a value class? */