aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/config/JavaPlatform.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-02-03 11:59:38 +0100
committerMartin Odersky <odersky@gmail.com>2013-02-03 11:59:38 +0100
commit8ac1b32ad3b190de82f5c4f1d1666f093ad8c20f (patch)
tree024b841641152deb5743d678885afae68ba8647b /src/dotty/tools/dotc/config/JavaPlatform.scala
parentabc8f5e1c382b1ead761976227878c4c38ebfbf5 (diff)
downloaddotty-8ac1b32ad3b190de82f5c4f1d1666f093ad8c20f.tar.gz
dotty-8ac1b32ad3b190de82f5c4f1d1666f093ad8c20f.tar.bz2
dotty-8ac1b32ad3b190de82f5c4f1d1666f093ad8c20f.zip
Integration of settings, platform, pathresolver, etc.
Diffstat (limited to 'src/dotty/tools/dotc/config/JavaPlatform.scala')
-rw-r--r--src/dotty/tools/dotc/config/JavaPlatform.scala63
1 files changed, 16 insertions, 47 deletions
diff --git a/src/dotty/tools/dotc/config/JavaPlatform.scala b/src/dotty/tools/dotc/config/JavaPlatform.scala
index 3c6ea3a8a..0c91ae2e7 100644
--- a/src/dotty/tools/dotc/config/JavaPlatform.scala
+++ b/src/dotty/tools/dotc/config/JavaPlatform.scala
@@ -4,72 +4,41 @@ package config
import io.{AbstractFile,ClassPath,JavaClassPath,MergedClassPath,DeltaClassPath}
import ClassPath.{ JavaContext, DefaultJavaContext }
+import core.Contexts._
+import core.SymDenotations._, core.Symbols._, core.SymbolLoader
-trait JavaPlatform /*extends Platform {
- import global._
- import definitions._
+class JavaPlatform(base: ContextBase) extends Platform(base) {
- type BinaryRepr = AbstractFile
+ private var currentClassPath: Option[MergedClassPath] = None
- private var currentClassPath: Option[MergedClassPath[BinaryRepr]] = None
-
- def classPath: ClassPath[BinaryRepr] = {
- if (currentClassPath.isEmpty) currentClassPath = Some(new PathResolver(settings).result)
+ def classPath(implicit ctx: Context): ClassPath = {
+ if (currentClassPath.isEmpty)
+ currentClassPath = Some(new PathResolver(ctx).result)
currentClassPath.get
}
/** Update classpath with a substituted subentry */
- def updateClassPath(subst: Map[ClassPath[BinaryRepr], ClassPath[BinaryRepr]]) =
+ def updateClassPath(subst: Map[ClassPath, ClassPath]) =
currentClassPath = Some(new DeltaClassPath(currentClassPath.get, subst))
- def rootLoader = new loaders.PackageLoader(classPath.asInstanceOf[ClassPath[platform.BinaryRepr]])
- // [Martin] Why do we need a cast here?
- // The problem is that we cannot specify at this point that global.platform should be of type JavaPlatform.
- // So we cannot infer that global.platform.BinaryRepr is AbstractFile.
- // Ideally, we should be able to write at the top of the JavaPlatform trait:
- // val global: Global { val platform: JavaPlatform }
- // import global._
- // Right now, this does nothing because the concrete definition of platform in Global
- // replaces the tighter abstract definition here. If we had DOT typing rules, the two
- // types would be conjoined and everything would work out. Yet another reason to push for DOT.
-
- private def depAnalysisPhase =
- if (settings.make.isDefault) Nil
- else List(dependencyAnalysis)
-
- private def classEmitPhase =
- if (settings.target.value == "jvm-1.5-fjbg") genJVM
- else genASM
-
- def platformPhases = List(
- flatten, // get rid of inner classes
- classEmitPhase // generate .class files
- ) ++ depAnalysisPhase
-
- lazy val externalEquals = getDecl(BoxesRunTimeClass, nme.equals_)
- lazy val externalEqualsNumNum = getDecl(BoxesRunTimeClass, nme.equalsNumNum)
- lazy val externalEqualsNumChar = getDecl(BoxesRunTimeClass, nme.equalsNumChar)
- lazy val externalEqualsNumObject = getDecl(BoxesRunTimeClass, nme.equalsNumObject)
+ def rootLoader: ClassCompleter = ??? // = new loaders.PackageLoader(classPath)
/** We could get away with excluding BoxedBooleanClass for the
* purpose of equality testing since it need not compare equal
* to anything but other booleans, but it should be present in
* case this is put to other uses.
*/
- def isMaybeBoxed(sym: Symbol) = {
+ def isMaybeBoxed(sym: Symbol)(implicit ctx: Context) = {
+ val d = defn
+ import d._
(sym == ObjectClass) ||
(sym == JavaSerializableClass) ||
(sym == ComparableClass) ||
(sym isNonBottomSubClass BoxedNumberClass) ||
- (sym isNonBottomSubClass BoxedCharacterClass) ||
+ (sym isNonBottomSubClass BoxedCharClass) ||
(sym isNonBottomSubClass BoxedBooleanClass)
}
- def newClassLoader(bin: AbstractFile): loaders.SymbolLoader =
- new loaders.ClassfileLoader(bin)
-
- def doLoad(cls: ClassPath[BinaryRepr]#ClassRep): Boolean = true
-
- def needCompile(bin: AbstractFile, src: AbstractFile) =
- src.lastModified >= bin.lastModified
-}*/
+ def newClassLoader(bin: AbstractFile): SymbolLoader = ???
+ // new loaders.ClassfileLoader(bin)
+}