diff options
author | Lukas Rytz <lukas.rytz@gmail.com> | 2014-05-08 15:34:28 +0200 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@gmail.com> | 2014-05-08 15:42:16 +0200 |
commit | 30610d53489478663a63a89ca09189e622024dc5 (patch) | |
tree | 26c074be36621a9b9f9dbd04b6c83bb8f8775395 /src | |
parent | 840234017bc6b8a3610c208883fd6ad5a563fcd3 (diff) | |
download | scala-30610d53489478663a63a89ca09189e622024dc5.tar.gz scala-30610d53489478663a63a89ca09189e622024dc5.tar.bz2 scala-30610d53489478663a63a89ca09189e622024dc5.zip |
BCodeICodeCommon through composition rather than inheritance
Diffstat (limited to 'src')
4 files changed, 9 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala index e1183d8403..0da66d43f7 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala @@ -18,7 +18,7 @@ import scala.annotation.switch * @author Iulian Dragos * @version 1.0 */ -abstract class GenICode extends SubComponent with jvm.BCodeICodeCommon { +abstract class GenICode extends SubComponent { import global._ import icodes._ import icodes.opcodes._ @@ -29,6 +29,9 @@ abstract class GenICode extends SubComponent with jvm.BCodeICodeCommon { } import platform.isMaybeBoxed + private val bCodeICodeCommon: jvm.BCodeICodeCommon[global.type] = new jvm.BCodeICodeCommon(global) + import bCodeICodeCommon._ + val phaseName = "icode" override def newPhase(prev: Phase) = new ICodePhase(prev) diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala index 9e27373a07..92ebe5027a 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala @@ -23,6 +23,7 @@ import scala.tools.asm abstract class BCodeBodyBuilder extends BCodeSkelBuilder { import global._ import definitions._ + import bCodeICodeCommon._ /* * Functionality to build the body of ASM MethodNode, except for `synchronized` and `try` expressions. diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeGlue.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeGlue.scala index ef116324bf..aa7e73a36b 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeGlue.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeGlue.scala @@ -18,10 +18,12 @@ import scala.collection.{ immutable, mutable } * @version 1.0 * */ -abstract class BCodeGlue extends SubComponent with BCodeICodeCommon { +abstract class BCodeGlue extends SubComponent { import global._ + protected val bCodeICodeCommon: BCodeICodeCommon[global.type] = new BCodeICodeCommon(global) + object BType { import global.chrs diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeICodeCommon.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeICodeCommon.scala index 071e0cf74c..50d20921d5 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeICodeCommon.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeICodeCommon.scala @@ -12,8 +12,7 @@ import PartialFunction._ * This trait contains code shared between GenBCode and GenICode that depends on types defined in * the compiler cake (Global). */ -trait BCodeICodeCommon { - val global: Global +final class BCodeICodeCommon[G <: Global](val global: G) { import global._ /** Some useful equality helpers. */ |