diff options
author | Gilles Dubochet <gilles.dubochet@epfl.ch> | 2009-09-16 15:59:22 +0000 |
---|---|---|
committer | Gilles Dubochet <gilles.dubochet@epfl.ch> | 2009-09-16 15:59:22 +0000 |
commit | d46bbd29eeff109485dd912c4c5acd95014276e2 (patch) | |
tree | a42ea92f4a13785fd5beb44b41dd0cb35de852bd /src/compiler | |
parent | 1b1a9ba1f37df4df8d015cc99745e1bf067663a3 (diff) | |
download | scala-d46bbd29eeff109485dd912c4c5acd95014276e2.tar.gz scala-d46bbd29eeff109485dd912c4c5acd95014276e2.tar.bz2 scala-d46bbd29eeff109485dd912c4c5acd95014276e2.zip |
Cleaning code: removed unused methods, type lit...
Cleaning code: removed unused methods, type literals are a bit simpler.
Diffstat (limited to 'src/compiler')
4 files changed, 12 insertions, 21 deletions
diff --git a/src/compiler/scala/tools/nsc/Properties.scala b/src/compiler/scala/tools/nsc/Properties.scala index 0a9e9d39aa..4f1e9553dd 100644 --- a/src/compiler/scala/tools/nsc/Properties.scala +++ b/src/compiler/scala/tools/nsc/Properties.scala @@ -21,7 +21,4 @@ object Properties extends scala.util.PropertiesTrait { val cmdName = if (isWin) "scala.bat" else "scala" val fileEndings = fileEndingString.split("""\|""").toList - // settings based on System properties - val envClasspath = sysprop("env.classpath", null) - val msilILasm = sysprop("msil.ilasm", "") } diff --git a/src/compiler/scala/tools/nsc/symtab/Definitions.scala b/src/compiler/scala/tools/nsc/symtab/Definitions.scala index 6f44541098..1880707c70 100644 --- a/src/compiler/scala/tools/nsc/symtab/Definitions.scala +++ b/src/compiler/scala/tools/nsc/symtab/Definitions.scala @@ -85,6 +85,7 @@ trait Definitions { lazy val MatchErrorClass = getClass("scala.MatchError") // java is hard coded because only used by structural values lazy val InvocationTargetExceptionClass = getClass("java.lang.reflect.InvocationTargetException") + lazy val NoSuchMethodExceptionClass = getClass("java.lang.NoSuchMethodException") // annotations lazy val AnnotationClass = getClass("scala.Annotation") @@ -350,6 +351,7 @@ trait Definitions { lazy val BoxedUnitClass = getClass("scala.runtime.BoxedUnit") lazy val BoxedUnitModule = getModule("scala.runtime.BoxedUnit") def BoxedUnit_UNIT = getMember(BoxedUnitModule, "UNIT") + def BoxedUnit_TYPE = getMember(BoxedUnitModule, "TYPE") // special attributes lazy val SerializableAttr: Symbol = getClass("scala.serializable") @@ -488,6 +490,7 @@ trait Definitions { .setInfo(mkTypeBounds(NothingClass.typeConstructor, AnyClass.typeConstructor)) val boxedClass = new HashMap[Symbol, Symbol] + val boxedModule = new HashMap[Symbol, Symbol] val unboxMethod = new HashMap[Symbol, Symbol] // Type -> Method val boxMethod = new HashMap[Symbol, Symbol] // Type -> Method val boxedArrayClass = new HashMap[Symbol, Symbol] @@ -513,6 +516,7 @@ trait Definitions { val clazz = newClass(ScalaPackageClass, name, anyvalparam) setFlag (ABSTRACT | FINAL) boxedClass(clazz) = getClass(boxedName) + boxedModule(clazz) = getModule(boxedName) boxedArrayClass(clazz) = getClass("scala.runtime.Boxed" + name + "Array") refClass(clazz) = getClass("scala.runtime." + name + "Ref") abbrvTag(clazz) = tag diff --git a/src/compiler/scala/tools/nsc/symtab/StdNames.scala b/src/compiler/scala/tools/nsc/symtab/StdNames.scala index ca6b70c453..410cc75b67 100644 --- a/src/compiler/scala/tools/nsc/symtab/StdNames.scala +++ b/src/compiler/scala/tools/nsc/symtab/StdNames.scala @@ -51,6 +51,7 @@ trait StdNames { val THROWkw = newTermName("throw") val TRAITkw = newTermName("trait") val TRUEkw = newTermName("true") + val TYPE_ = newTermName("TYPE") val TRYkw = newTermName("try") val TYPEkw = newTermName("type") val VALkw = newTermName("val") diff --git a/src/compiler/scala/tools/nsc/transform/CleanUp.scala b/src/compiler/scala/tools/nsc/transform/CleanUp.scala index 6067249eae..47e62a05fe 100644 --- a/src/compiler/scala/tools/nsc/transform/CleanUp.scala +++ b/src/compiler/scala/tools/nsc/transform/CleanUp.scala @@ -29,22 +29,6 @@ abstract class CleanUp extends Transform with ast.TreeDSL { private val classConstantMeth = new HashMap[String, Symbol] - // a map from the symbols of the Scala primitive types to the symbols - // of the modules of the Java box classes - private val javaBoxClassModule = new HashMap[Symbol, Symbol] - - if (!forMSIL) { - javaBoxClassModule(BooleanClass) = getModule("java.lang.Boolean") - javaBoxClassModule(ByteClass) = getModule("java.lang.Byte") - javaBoxClassModule(ShortClass) = getModule("java.lang.Short") - javaBoxClassModule(IntClass) = getModule("java.lang.Integer") - javaBoxClassModule(CharClass) = getModule("java.lang.Character") - javaBoxClassModule(LongClass) = getModule("java.lang.Long") - javaBoxClassModule(FloatClass) = getModule("java.lang.Float") - javaBoxClassModule(DoubleClass) = getModule("java.lang.Double") - javaBoxClassModule(UnitClass) = getModule("java.lang.Void") - } - private var localTyper: analyzer.Typer = null private lazy val serializableAnnotation = @@ -577,8 +561,13 @@ abstract class CleanUp extends Transform with ast.TreeDSL { case Literal(c) if (c.tag == ClassTag) && !forMSIL=> val tpe = c.typeValue typedWithPos(tree.pos) { - if (isValueClass(tpe.typeSymbol) || tpe.typeSymbol == definitions.UnitClass) - Select(REF(javaBoxClassModule(tpe.typeSymbol)), "TYPE") + if (isValueClass(tpe.typeSymbol) || tpe.typeSymbol == definitions.UnitClass) { + if (tpe.typeSymbol == UnitClass) + Select(REF(BoxedUnit_TYPE), BoxedUnit_TYPE) + else + Select(REF(boxedModule(tpe.typeSymbol)), nme.TYPE_) + } + else tree } |