diff options
author | James Iry <james.iry@typesafe.com> | 2013-07-22 16:51:46 -0700 |
---|---|---|
committer | James Iry <james.iry@typesafe.com> | 2013-11-01 15:30:23 -0700 |
commit | 9136e76ca1a9827e1a8c90fa4f7f63c2967cb019 (patch) | |
tree | f3d64a237d8240a5f5ac98254664f196da192230 /src/compiler/scala/tools | |
parent | 0057d4d83cb40116b76296505f15075002e4b2e0 (diff) | |
download | scala-9136e76ca1a9827e1a8c90fa4f7f63c2967cb019.tar.gz scala-9136e76ca1a9827e1a8c90fa4f7f63c2967cb019.tar.bz2 scala-9136e76ca1a9827e1a8c90fa4f7f63c2967cb019.zip |
Add a skeletal Delambdafy phase.
This commit adds a do-nothing phase called "Delambdafy" that will
eventually be responsible for doing the final translation of lambdas
into classes.
Diffstat (limited to 'src/compiler/scala/tools')
-rw-r--r-- | src/compiler/scala/tools/ant/Scalac.scala | 2 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/Global.scala | 11 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/Delambdafy.scala | 16 |
3 files changed, 28 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/ant/Scalac.scala b/src/compiler/scala/tools/ant/Scalac.scala index b2cedf6338..1747405f03 100644 --- a/src/compiler/scala/tools/ant/Scalac.scala +++ b/src/compiler/scala/tools/ant/Scalac.scala @@ -91,7 +91,7 @@ class Scalac extends ScalaMatchingTask with ScalacShared { val values = List("namer", "typer", "pickler", "refchecks", "uncurry", "tailcalls", "specialize", "explicitouter", "erasure", "lazyvals", "lambdalift", "constructors", - "flatten", "mixin", "cleanup", "icode", "inliner", + "flatten", "mixin", "delambdafy", "cleanup", "icode", "inliner", "closelim", "dce", "jvm", "terminal") } diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala index e765c9165a..1852e670e4 100644 --- a/src/compiler/scala/tools/nsc/Global.scala +++ b/src/compiler/scala/tools/nsc/Global.scala @@ -575,6 +575,13 @@ class Global(var currentSettings: Settings, var reporter: Reporter) val runsRightAfter = None } with CleanUp + // phaseName = "delambdafy" + object delambdafy extends { + val global: Global.this.type = Global.this + val runsAfter = List("cleanup") + val runsRightAfter = None + } with Delambdafy + // phaseName = "icode" object genicode extends { val global: Global.this.type = Global.this @@ -695,6 +702,7 @@ class Global(var currentSettings: Settings, var reporter: Reporter) lambdaLift -> "move nested functions to top level", constructors -> "move field definitions into constructors", mixer -> "mixin composition", + delambdafy -> "remove lambdas", cleanup -> "platform-specific cleanups, generate reflective calls", genicode -> "generate portable intermediate code", inliner -> "optimization: do inlining", @@ -1068,6 +1076,7 @@ class Global(var currentSettings: Settings, var reporter: Reporter) @inline final def exitingExplicitOuter[T](op: => T): T = exitingPhase(currentRun.explicitouterPhase)(op) @inline final def exitingFlatten[T](op: => T): T = exitingPhase(currentRun.flattenPhase)(op) @inline final def exitingMixin[T](op: => T): T = exitingPhase(currentRun.mixinPhase)(op) + @inline final def exitingDelambdafy[T](op: => T): T = exitingPhase(currentRun.delambdafyPhase)(op) @inline final def exitingPickler[T](op: => T): T = exitingPhase(currentRun.picklerPhase)(op) @inline final def exitingRefchecks[T](op: => T): T = exitingPhase(currentRun.refchecksPhase)(op) @inline final def exitingSpecialize[T](op: => T): T = exitingPhase(currentRun.specializePhase)(op) @@ -1078,6 +1087,7 @@ class Global(var currentSettings: Settings, var reporter: Reporter) @inline final def enteringFlatten[T](op: => T): T = enteringPhase(currentRun.flattenPhase)(op) @inline final def enteringIcode[T](op: => T): T = enteringPhase(currentRun.icodePhase)(op) @inline final def enteringMixin[T](op: => T): T = enteringPhase(currentRun.mixinPhase)(op) + @inline final def enteringDelambdafy[T](op: => T): T = enteringPhase(currentRun.delambdafyPhase)(op) @inline final def enteringPickler[T](op: => T): T = enteringPhase(currentRun.picklerPhase)(op) @inline final def enteringSpecialize[T](op: => T): T = enteringPhase(currentRun.specializePhase)(op) @inline final def enteringTyper[T](op: => T): T = enteringPhase(currentRun.typerPhase)(op) @@ -1415,6 +1425,7 @@ class Global(var currentSettings: Settings, var reporter: Reporter) // val constructorsPhase = phaseNamed("constructors") val flattenPhase = phaseNamed("flatten") val mixinPhase = phaseNamed("mixin") + val delambdafyPhase = phaseNamed("delambdafy") val cleanupPhase = phaseNamed("cleanup") val icodePhase = phaseNamed("icode") val inlinerPhase = phaseNamed("inliner") diff --git a/src/compiler/scala/tools/nsc/transform/Delambdafy.scala b/src/compiler/scala/tools/nsc/transform/Delambdafy.scala new file mode 100644 index 0000000000..f39fd2eecb --- /dev/null +++ b/src/compiler/scala/tools/nsc/transform/Delambdafy.scala @@ -0,0 +1,16 @@ +package scala.tools.nsc +package transform + +abstract class Delambdafy extends Transform with TypingTransformers with ast.TreeDSL { + import global._ + + /** the following two members override abstract members in Transform */ + val phaseName: String = "delambdafy" + + protected def newTransformer(unit: CompilationUnit): Transformer = + new DelambdafyTransformer(unit) + + class DelambdafyTransformer(unit: CompilationUnit) extends TypingTransformer(unit) { + override def transform(tree: Tree): Tree = tree + } +} |