Dotty Documentation

0.11.0-bin-SNAPSHOT

class ReplCompiler
extends Compiler

This subclass of Compiler is adapted for use in the REPL.

  • compiles parsed expression in the current REPL state:
    • adds the appropriate imports in scope
    • wraps expressions into a dummy object
  • provides utility to query the type of an expression
  • provides utility to query the documentation of an expression

[-] Constructors

ReplCompiler ( )

[-] Members

[+] private case class Definitions
[+] private object Definitions
[+] private val objectNames : Map [ Int, TermName ]
[+] final def compile ( parsed: Parsed ) ( implicit state: State ) : Result [ ( CompilationUnit, State ) ]
[+] private def createUnit ( defs: Definitions , sourceCode: String ) : CompilationUnit
[+] private def definitions ( trees: List [ Tree ] , state: State ) : Definitions
[+] def docOf ( expr: String ) ( implicit state: State ) : Result [ String ]
[+] protected override def frontendPhases : List [ List [ Phase ] ]

Phases dealing with the frontend up to trees ready for TASTY pickling

[+] def newRun ( initCtx: Context , state: State ) : Run
[+] private def objectName ( state: State ) : TermName
[+] private def runCompilationUnit ( unit: CompilationUnit , state: State ) : Result [ ( CompilationUnit, State ) ]
[+] final def typeCheck ( expr: String , errorsAllowed: Boolean ) ( implicit state: State ) : Result [ ValDef ]
[+] def typeCheck$default$2 : Boolean
[+] final def typeOf ( expr: String ) ( implicit state: State ) : Result [ String ]
[+] private def wrapped ( defs: Definitions ) : PackageDef

Wrap trees in an object and add imports from the previous compilations

The resulting structure is something like:

package <none> {
  object rs$line$nextId {
    import rs$line${i <- 0 until nextId}._

    <trees>
  }
}