Skip to content

Commit

Permalink
Explicitly annotate return types in GenBCode/PostProcessor
Browse files Browse the repository at this point in the history
  • Loading branch information
retronym authored and lrytz committed Sep 1, 2017
1 parent 342973b commit a4842aa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
7 changes: 4 additions & 3 deletions src/compiler/scala/tools/nsc/backend/jvm/GenBCode.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@ import scala.reflect.internal.util.Statistics
import scala.tools.asm.Opcodes

abstract class GenBCode extends SubComponent {
self =>
import global._

val postProcessorFrontendAccess: PostProcessorFrontendAccess = new PostProcessorFrontendAccess.PostProcessorFrontendAccessImpl(global)

val bTypes = new { val frontendAccess = postProcessorFrontendAccess } with BTypesFromSymbols[global.type](global)
val bTypes: BTypesFromSymbols[global.type] = new { val frontendAccess = postProcessorFrontendAccess } with BTypesFromSymbols[global.type](global)

val codeGen = new { val bTypes: GenBCode.this.bTypes.type = GenBCode.this.bTypes } with CodeGen[global.type](global)
val codeGen: CodeGen[global.type] = new { val bTypes: self.bTypes.type = self.bTypes } with CodeGen[global.type](global)

val postProcessor = new { val bTypes: GenBCode.this.bTypes.type = GenBCode.this.bTypes } with PostProcessor
val postProcessor: PostProcessor { val bTypes: self.bTypes.type } = new { val bTypes: self.bTypes.type = self.bTypes } with PostProcessor

val phaseName = "jvm"

Expand Down
17 changes: 9 additions & 8 deletions src/compiler/scala/tools/nsc/backend/jvm/PostProcessor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,20 @@ import scala.tools.nsc.backend.jvm.opt._
* optimizations, post-processing and classfile serialization and writing.
*/
abstract class PostProcessor extends PerRunInit {
self =>
val bTypes: BTypes

import bTypes._
import frontendAccess.{backendReporting, compilerSettings, recordPerRunCache}

val backendUtils = new { val postProcessor: PostProcessor.this.type = PostProcessor.this } with BackendUtils
val byteCodeRepository = new { val postProcessor: PostProcessor.this.type = PostProcessor.this } with ByteCodeRepository
val localOpt = new { val postProcessor: PostProcessor.this.type = PostProcessor.this } with LocalOpt
val inliner = new { val postProcessor: PostProcessor.this.type = PostProcessor.this } with Inliner
val inlinerHeuristics = new { val postProcessor: PostProcessor.this.type = PostProcessor.this } with InlinerHeuristics
val closureOptimizer = new { val postProcessor: PostProcessor.this.type = PostProcessor.this } with ClosureOptimizer
val callGraph = new { val postProcessor: PostProcessor.this.type = PostProcessor.this } with CallGraph
val bTypesFromClassfile = new { val postProcessor: PostProcessor.this.type = PostProcessor.this } with BTypesFromClassfile
val backendUtils : BackendUtils { val postProcessor: self.type } = new { val postProcessor: self.type = self } with BackendUtils
val byteCodeRepository : ByteCodeRepository { val postProcessor: self.type } = new { val postProcessor: self.type = self } with ByteCodeRepository
val localOpt : LocalOpt { val postProcessor: self.type } = new { val postProcessor: self.type = self } with LocalOpt
val inliner : Inliner { val postProcessor: self.type } = new { val postProcessor: self.type = self } with Inliner
val inlinerHeuristics : InlinerHeuristics { val postProcessor: self.type } = new { val postProcessor: self.type = self } with InlinerHeuristics
val closureOptimizer : ClosureOptimizer { val postProcessor: self.type } = new { val postProcessor: self.type = self } with ClosureOptimizer
val callGraph : CallGraph { val postProcessor: self.type } = new { val postProcessor: self.type = self } with CallGraph
val bTypesFromClassfile : BTypesFromClassfile { val postProcessor: self.type } = new { val postProcessor: self.type = self } with BTypesFromClassfile

// re-initialized per run because it reads compiler settings that might change
lazy val classfileWriter: LazyVar[ClassfileWriter] = perRunLazy(this)(new ClassfileWriter(frontendAccess))
Expand Down

0 comments on commit a4842aa

Please sign in to comment.