From 06a3d47ea9fd1b67b3acba9d115a16d18549e377 Mon Sep 17 00:00:00 2001 From: Felix Mulder Date: Wed, 26 Oct 2016 16:19:35 +0200 Subject: Move sjs, make sure that partest compiles everything in dirs --- src/dotty/tools/dotc/Compiler.scala | 17 +---------------- src/dotty/tools/dotc/config/PathResolver.scala | 24 ++++++++++-------------- src/dotty/tools/dotc/config/SJSPlatform.scala | 18 ------------------ src/dotty/tools/dotc/core/Contexts.scala | 5 ++--- 4 files changed, 13 insertions(+), 51 deletions(-) delete mode 100644 src/dotty/tools/dotc/config/SJSPlatform.scala (limited to 'src/dotty/tools/dotc') diff --git a/src/dotty/tools/dotc/Compiler.scala b/src/dotty/tools/dotc/Compiler.scala index 4bc5263e9..ad3249be2 100644 --- a/src/dotty/tools/dotc/Compiler.scala +++ b/src/dotty/tools/dotc/Compiler.scala @@ -17,7 +17,6 @@ import core.DenotTransformers.DenotTransformer import core.Denotations.SingleDenotation import dotty.tools.backend.jvm.{LabelDefs, GenBCode, CollectSuperCalls} -import dotty.tools.backend.sjs.GenSJSIR /** The central class of the dotc compiler. The job of a compiler is to create * runs, which process given `phases` in a given `rootContext`. @@ -98,7 +97,6 @@ class Compiler { new DropInlined, // Drop Inlined nodes, since backend has no use for them new MoveStatics, // Move static methods to companion classes new LabelDefs), // Converts calls to labels to jumps - List(new GenSJSIR), // Generate .js code List(new GenBCode) // Generate JVM bytecode ) @@ -117,20 +115,7 @@ class Compiler { */ def rootContext(implicit ctx: Context): Context = { ctx.initialize()(ctx) - val actualPhases = if (ctx.settings.scalajs.value) { - // Remove phases that Scala.js does not want - phases.mapConserve(_.filter { - case _: FunctionalInterfaces => false - case _ => true - }).filter(_.nonEmpty) - } else { - // Remove Scala.js-related phases - phases.mapConserve(_.filter { - case _: GenSJSIR => false - case _ => true - }).filter(_.nonEmpty) - } - ctx.setPhasePlan(actualPhases) + ctx.setPhasePlan(phases) val rootScope = new MutableScope val bootstrap = ctx.fresh .setPeriod(Period(nextRunId, FirstPhaseId)) diff --git a/src/dotty/tools/dotc/config/PathResolver.scala b/src/dotty/tools/dotc/config/PathResolver.scala index 1f9ee7eec..14a44531a 100644 --- a/src/dotty/tools/dotc/config/PathResolver.scala +++ b/src/dotty/tools/dotc/config/PathResolver.scala @@ -46,18 +46,7 @@ object PathResolver { def classPathEnv = envOrElse("CLASSPATH", "") def sourcePathEnv = envOrElse("SOURCEPATH", "") - def javaBootClassPath = - propOrElse("sun.boot.class.path", searchForBootClasspath) - .split(":") - .filterNot { jar => - // let's blacklist locally compiled classes: - jar.contains("/dotty/library/target/classes") || - jar.contains("/dotty/library/target/scala-2.11/classes") || - jar.contains("/dotty/interfaces/target/classes") || - jar.contains("/dotty/target/scala-2.11/classes") || - jar.contains("/dotty/target/classes") - } - .mkString(":") + def javaBootClassPath = propOrElse("sun.boot.class.path", searchForBootClasspath) def javaExtDirs = propOrEmpty("java.ext.dirs") def scalaHome = propOrEmpty("scala.home") @@ -266,8 +255,15 @@ class PathResolver(implicit ctx: Context) { def containers = Calculated.containers lazy val result: JavaClassPath = { - val (dottyJars, others) = containers.partition(_.name.contains("dotty")) - val cp = new JavaClassPath((dottyJars ++ others).toIndexedSeq, context) + // Prioritize `dotty.jar` and `dotty-lib.jar` to shadow others + val (dottyJars, others) = + containers.partition(x => x.name.contains("dotty-lib.jar") || x.name.contains("dotty.jar")) + // Then any jars with `dotty` in the name - putting them before scala-library + val (dottyCp, remaining) = + others.partition(_.name.contains("dotty-")) + + val cp = new JavaClassPath((dottyJars ++ dottyCp ++ remaining).toIndexedSeq, context) + if (settings.Ylogcp.value) { Console.println("Classpath built from " + settings.toConciseString(ctx.sstate)) Console.println("Defaults: " + PathResolver.Defaults) diff --git a/src/dotty/tools/dotc/config/SJSPlatform.scala b/src/dotty/tools/dotc/config/SJSPlatform.scala deleted file mode 100644 index 3ec8049ae..000000000 --- a/src/dotty/tools/dotc/config/SJSPlatform.scala +++ /dev/null @@ -1,18 +0,0 @@ -package dotty.tools.dotc.config - -import dotty.tools.dotc.core._ -import Contexts._ -import Symbols._ - -import dotty.tools.backend.sjs.JSDefinitions - -class SJSPlatform()(implicit ctx: Context) extends JavaPlatform { - - /** Scala.js-specific definitions. */ - val jsDefinitions: JSDefinitions = new JSDefinitions() - - /** Is the SAMType `cls` also a SAM under the rules of the Scala.js back-end? */ - override def isSam(cls: ClassSymbol)(implicit ctx: Context): Boolean = - defn.isFunctionClass(cls) || jsDefinitions.isJSFunctionClass(cls) - -} diff --git a/src/dotty/tools/dotc/core/Contexts.scala b/src/dotty/tools/dotc/core/Contexts.scala index edc68588d..639c4d111 100644 --- a/src/dotty/tools/dotc/core/Contexts.scala +++ b/src/dotty/tools/dotc/core/Contexts.scala @@ -27,7 +27,7 @@ import reporting._ import collection.mutable import collection.immutable.BitSet import printing._ -import config.{Settings, ScalaSettings, Platform, JavaPlatform, SJSPlatform} +import config.{Settings, ScalaSettings, Platform, JavaPlatform} import language.implicitConversions import DenotTransformers.DenotTransformer import util.Property.Key @@ -550,8 +550,7 @@ object Contexts { } protected def newPlatform(implicit ctx: Context): Platform = - if (settings.scalajs.value) new SJSPlatform - else new JavaPlatform + new JavaPlatform /** The loader that loads the members of _root_ */ def rootLoader(root: TermSymbol)(implicit ctx: Context): SymbolLoader = platform.rootLoader(root) -- cgit v1.2.3