diff options
Diffstat (limited to 'src/dotty/tools')
-rw-r--r-- | src/dotty/tools/dotc/config/JavaPlatform.scala | 6 | ||||
-rw-r--r-- | src/dotty/tools/dotc/config/PathResolver.scala | 32 | ||||
-rw-r--r-- | src/dotty/tools/dotc/config/Platform.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/Annotations.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/SymDenotations.scala | 4 |
5 files changed, 25 insertions, 21 deletions
diff --git a/src/dotty/tools/dotc/config/JavaPlatform.scala b/src/dotty/tools/dotc/config/JavaPlatform.scala index bcb1939a8..ef5fe9475 100644 --- a/src/dotty/tools/dotc/config/JavaPlatform.scala +++ b/src/dotty/tools/dotc/config/JavaPlatform.scala @@ -5,7 +5,7 @@ package config import io.{AbstractFile,ClassPath,JavaClassPath,MergedClassPath,DeltaClassPath} import ClassPath.{ JavaContext, DefaultJavaContext } import core.Contexts._ -import core.SymDenotations._, core.Symbols._, core.SymbolLoader +import core.SymDenotations._, core.Symbols._, core.{SymbolLoader, ClassfileLoader} class JavaPlatform extends Platform { @@ -39,6 +39,6 @@ class JavaPlatform extends Platform { (sym isNonBottomSubClass BoxedBooleanClass) } - def newClassLoader(bin: AbstractFile): SymbolLoader = ??? - // new loaders.ClassfileLoader(bin) + def newClassLoader(bin: AbstractFile)(implicit ctx: Context): SymbolLoader = + new ClassfileLoader(bin)(ctx.condensed) } diff --git a/src/dotty/tools/dotc/config/PathResolver.scala b/src/dotty/tools/dotc/config/PathResolver.scala index 06bb7f04b..97ea4525e 100644 --- a/src/dotty/tools/dotc/config/PathResolver.scala +++ b/src/dotty/tools/dotc/config/PathResolver.scala @@ -133,9 +133,9 @@ object PathResolver { ) } - def fromPathString(path: String)(implicit ctx: Context): JavaClassPath = { - val settings = ctx.settings.classpath.update(path) - new PathResolver(ctx.fresh.withSettings(settings)).result + def fromPathString(path: String)(implicit cctx: CondensedContext): JavaClassPath = { + val settings = cctx.settings.classpath.update(path) + new PathResolver()(cctx.fresh.withSettings(settings)).result } /** With no arguments, show the interesting values in Environment and Defaults. @@ -148,11 +148,11 @@ object PathResolver { println(Defaults) } else { - val ctx = (new ContextBase).initialCtx + implicit val cctx = (new ContextBase).initialCtx.condensed val ArgsSummary(sstate, rest, errors) = - ctx.settings.processArguments(args.toList, true)(ctx) + cctx.settings.processArguments(args.toList, true) errors.foreach(println) - val pr = new PathResolver(ctx.fresh.withSettings(sstate)) + val pr = new PathResolver()(cctx.fresh.withSettings(sstate)) println(" COMMAND: 'scala %s'".format(args.mkString(" "))) println("RESIDUAL: 'scala %s'\n".format(rest.mkString(" "))) pr.result.show @@ -161,8 +161,9 @@ object PathResolver { } import PathResolver.{ Defaults, Environment, firstNonEmpty, ppcp } -class PathResolver(_ctx: Context) { - implicit val ctx = _ctx +class PathResolver(implicit cctx: CondensedContext) { + import cctx.base.settings + val context = ClassPath.DefaultJavaContext private def cmdLineOrElse(name: String, alt: String) = { @@ -172,22 +173,21 @@ class PathResolver(_ctx: Context) { }) getOrElse alt } - private def commandLineFor(s: String): Option[String] = ??? - /*condOpt(s) { + private def commandLineFor(s: String): Option[String] = condOpt(s) { case "javabootclasspath" => settings.javabootclasspath.value case "javaextdirs" => settings.javaextdirs.value case "bootclasspath" => settings.bootclasspath.value case "extdirs" => settings.extdirs.value case "classpath" | "cp" => settings.classpath.value case "sourcepath" => settings.sourcepath.value - }*/ + } /** Calculated values based on any given command line options, falling back on * those in Defaults. */ object Calculated { def scalaHome = Defaults.scalaHome - def useJavaClassPath = ctx.settings.usejavacp.value || Defaults.useJavaClassPath + def useJavaClassPath = settings.usejavacp.value || Defaults.useJavaClassPath def javaBootClassPath = cmdLineOrElse("javabootclasspath", Defaults.javaBootClassPath) def javaExtDirs = cmdLineOrElse("javaextdirs", Defaults.javaExtDirs) def javaUserClassPath = if (useJavaClassPath) Defaults.javaUserClassPath else "" @@ -212,8 +212,8 @@ class PathResolver(_ctx: Context) { * - If neither of those, then "." is used. */ def userClassPath = ( - if (!ctx.settings.classpath.isDefault) - ctx.settings.classpath.value + if (!settings.classpath.isDefault) + settings.classpath.value else sys.env.getOrElse("CLASSPATH", ".") ) @@ -256,8 +256,8 @@ class PathResolver(_ctx: Context) { lazy val result: JavaClassPath = { val cp = new JavaClassPath(containers.toIndexedSeq, context) - if (ctx.settings.Ylogcp.value) { - Console.println("Classpath built from " + ctx.settings.toConciseString(ctx.sstate)) + if (settings.Ylogcp.value) { + Console.println("Classpath built from " + settings.toConciseString(cctx.sstate)) Console.println("Defaults: " + PathResolver.Defaults) Console.println("Calculated: " + Calculated) diff --git a/src/dotty/tools/dotc/config/Platform.scala b/src/dotty/tools/dotc/config/Platform.scala index 19bdf00b1..304ddb2f1 100644 --- a/src/dotty/tools/dotc/config/Platform.scala +++ b/src/dotty/tools/dotc/config/Platform.scala @@ -31,6 +31,6 @@ abstract class Platform { def isMaybeBoxed(sym: Symbol)(implicit ctx: Context): Boolean /** Create a new class loader to load class file `bin` */ - def newClassLoader(bin: AbstractFile): SymbolLoader + def newClassLoader(bin: AbstractFile)(implicit ctx: Context): SymbolLoader } diff --git a/src/dotty/tools/dotc/core/Annotations.scala b/src/dotty/tools/dotc/core/Annotations.scala index f8514bb2d..3c8e02d8f 100644 --- a/src/dotty/tools/dotc/core/Annotations.scala +++ b/src/dotty/tools/dotc/core/Annotations.scala @@ -8,7 +8,7 @@ object Annotations { def tree: Tree def symbol(implicit ctx: Context): Symbol = tree.tpe.typeSymbol def matches(cls: Symbol)(implicit ctx: Context): Boolean = symbol.isNonBottomSubClass(cls) - def appliesToModule: Boolean = ??? + def appliesToModule: Boolean = true // for now; see remark in SymDenotations } case class ConcreteAnnotation(val tree: Tree) extends Annotation diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala index a7ee385d0..67a1e1d03 100644 --- a/src/dotty/tools/dotc/core/SymDenotations.scala +++ b/src/dotty/tools/dotc/core/SymDenotations.scala @@ -883,6 +883,10 @@ object SymDenotations { val from = denot.moduleClass.denot.asClass denot.setFlag(from.flags.toTermFlags & RetainedModuleValFlags) denot.annotations = from.annotations filter (_.appliesToModule) + // !!! ^^^ needs to be revised later. The problem is that annotations might + // only apply to the module but not to the module class. The right solution + // is to have the module class completer set the annotations of both the + // class and the module. denot.info = mclass.symbolicRef denot.privateWithin = from.privateWithin } |