FreshContext

dotty.tools.dotc.core.Contexts$.FreshContext
See theFreshContext companion object
class FreshContext(base: ContextBase) extends Context

A fresh context allows selective modification of its attributes using the with... methods.

Attributes

Companion
object
Graph
Supertypes
class Context
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def addLocation[T](initial: T): Location[T]
def addLocation[T](): Location[T]
final def addMode(mode: Mode): FreshContext
Extension method from Contexts
def dropProperty(key: Key[_]): FreshContext.this.type
final def gadtState: GadtState
final def mode: Mode
final def moreProperties: Map[Key[Any], Any]

A map in which more contextual properties can be stored Typically used for attributes that are read and written only in special situations.

A map in which more contextual properties can be stored Typically used for attributes that are read and written only in special situations.

Attributes

def outer: Context
final def owner: Symbol
final def period: Period
final def retractMode(mode: Mode): FreshContext
Extension method from Contexts
def reuseIn(outer: Context): FreshContext.this.type

Reuse this context as a fresh context nested inside outer But keep the typerstate, this one has to be set explicitly if needed.

Reuse this context as a fresh context nested inside outer But keep the typerstate, this one has to be set explicitly if needed.

Attributes

final def scope: Scope
def setCompilationUnit(compilationUnit: CompilationUnit): FreshContext.this.type
def setCompilerCallback(callback: CompilerCallback): FreshContext.this.type
def setDebug: FreshContext.this.type
def setGadtState(gadtState: GadtState): FreshContext.this.type
def setImportInfo(importInfo: ImportInfo): FreshContext.this.type
def setMode(mode: Mode): FreshContext.this.type
def setNewScope: FreshContext.this.type
def setNewTyperState(): FreshContext.this.type
def setNotNullInfos(notNullInfos: List[NotNullInfo]): FreshContext.this.type
def setOwner(owner: Symbol): FreshContext.this.type
def setPeriod(period: Period): FreshContext.this.type
def setPhase(pid: PhaseId): FreshContext.this.type
def setPhase(phase: Phase): FreshContext.this.type
def setPrinterFn(printer: Context => Printer): FreshContext.this.type
def setProfiler(profiler: Profiler): FreshContext.this.type
def setProperty[T](key: Key[T], value: T): FreshContext.this.type
def setReporter(reporter: Reporter): FreshContext.this.type
def setRun(run: Run | Null): FreshContext.this.type
def setSbtCallback(callback: AnalysisCallback): FreshContext.this.type
def setScope(scope: Scope): FreshContext.this.type
def setSearchHistory(searchHistory: SearchHistory): FreshContext.this.type
def setSetting[T](setting: Setting[T], value: T): FreshContext.this.type
def setSettings(settingsState: SettingsState): FreshContext.this.type
def setSource(source: SourceFile): FreshContext.this.type
def setTree(tree: Tree[_]): FreshContext.this.type
def setTypeAssigner(typeAssigner: TypeAssigner): FreshContext.this.type
def setTyper(typer: Typer): FreshContext.this.type
def setTyperState(typerState: TyperState): FreshContext.this.type
final def source: SourceFile
final def store: Store

A store that can be used by sub-components. Typically used for attributes that are defined only once per compilation unit. Access to store entries is much faster than access to properties, and only slightly slower than a normal field access would be.

A store that can be used by sub-components. Typically used for attributes that are defined only once per compilation unit. Access to store entries is much faster than access to properties, and only slightly slower than a normal field access would be.

Attributes

final def tree: Tree[_]
final def typerState: TyperState
def updateStore[T](loc: Location[T], value: T): FreshContext.this.type

Inherited methods

The current compilation unit

The current compilation unit

Attributes

Inherited from:
Context
def compilerCallback: CompilerCallback

The compiler callback implementation, or null if no callback will be called.

The compiler callback implementation, or null if no callback will be called.

Attributes

Inherited from:
Context
def debug: Boolean

Is the debug option set?

Is the debug option set?

Attributes

Inherited from:
Context

Attributes

Inherited from:
Context

Either the current scope, or, if the current context owner is a class, the declarations of the current class.

Either the current scope, or, if the current context owner is a class, the declarations of the current class.

Attributes

Inherited from:
Context
final def erasedTypes: Boolean

Does current phase use an erased types interpretation?

Does current phase use an erased types interpretation?

Attributes

Inherited from:
Context

Is the explicit nulls option set?

Is the explicit nulls option set?

Attributes

Inherited from:
Context
def exprContext(stat: Tree[_], exprOwner: Symbol): Context

The context of expression expr seen as a member of a statement sequence

The context of expression expr seen as a member of a statement sequence

Attributes

Inherited from:
Context

A fresh clone of this context embedded in this context.

A fresh clone of this context embedded in this context.

Attributes

Inherited from:
Context

A fresh clone of this context embedded in the specified outer context.

A fresh clone of this context embedded in the specified outer context.

Attributes

Inherited from:
Context

Attributes

Inherited from:
Context

AbstractFile with given path, memoized

AbstractFile with given path, memoized

Attributes

Inherited from:
Context

AbstraFile with given path name, memoized

AbstraFile with given path name, memoized

Attributes

Inherited from:
Context

SourceFile with given path, memoized

SourceFile with given path, memoized

Attributes

Inherited from:
Context

SourceFile with given path name, memoized

SourceFile with given path name, memoized

Attributes

Inherited from:
Context
def getSource(file: AbstractFile, codec: => Codec): SourceFile

Sourcefile corresponding to given abstract file, memoized

Sourcefile corresponding to given abstract file, memoized

Attributes

Inherited from:
Context

Attributes

Inherited from:
Context
def importContext(imp: Import[_], sym: Symbol): FreshContext

A new context that summarizes an import statement

A new context that summarizes an import statement

Attributes

Inherited from:
Context
def importInfo: ImportInfo | Null

The currently active import info

The currently active import info

Attributes

Inherited from:
Context
def initialize()(using Context): Unit

Attributes

Inherited from:
Context
final def isAfterTyper: Boolean

Is current phase after TyperPhase?

Is current phase after TyperPhase?

Attributes

Inherited from:
Context

Is this a context for the members of a class definition?

Is this a context for the members of a class definition?

Attributes

Inherited from:
Context

Is this a context that introduces an import clause?

Is this a context that introduces an import clause?

Attributes

Inherited from:
Context

Is this a context for typechecking an inlined body?

Is this a context for typechecking an inlined body?

Attributes

Inherited from:
Context
final def isJava: Boolean

Are we in a Java compilation unit?

Are we in a Java compilation unit?

Attributes

Inherited from:
Context

Is this a context that introduces a non-empty scope?

Is this a context that introduces a non-empty scope?

Attributes

Inherited from:
Context
final def isTyper: Boolean

Attributes

Inherited from:
Context
final def lastPhaseId: Int

Attributes

Inherited from:
Context

Attributes

Inherited from:
Context

The paths currently known to be not null

The paths currently known to be not null

Attributes

Inherited from:
Context

All outer contexts, ending in base.initialCtx and then NoContext

All outer contexts, ending in base.initialCtx and then NoContext

Attributes

Inherited from:
Context

Attributes

Inherited from:
Context
final def phase: Phase

Attributes

Inherited from:
Context
final def phaseId: PhaseId

Attributes

Inherited from:
Context

Attributes

Inherited from:
Context

A function creating a printer

A function creating a printer

Attributes

Inherited from:
Context

The current plain printer

The current plain printer

Attributes

Inherited from:
Context

The current compiler-run profiler

The current compiler-run profiler

Attributes

Inherited from:
Context
def property[T](key: Key[T]): Option[T]

Attributes

Inherited from:
Context

The current reporter

The current reporter

Attributes

Inherited from:
Context
protected def resetCaches(): Unit

Attributes

Inherited from:
Context
def run: Run | Null

The current compiler-run

The current compiler-run

Attributes

Inherited from:
Context
final def runId: RunId

Attributes

Inherited from:
Context
def sbtCallback: AnalysisCallback

The sbt callback implementation if we are run from sbt, null otherwise

The sbt callback implementation if we are run from sbt, null otherwise

Attributes

Inherited from:
Context

Attributes

Inherited from:
Context

The current settings values

The current settings values

Attributes

Inherited from:
Context

The context for a supercall. This context is used for elaborating the parents of a class and their arguments. The context is computed from the current class context. It has

The context for a supercall. This context is used for elaborating the parents of a class and their arguments. The context is computed from the current class context. It has

  • as owner: The primary constructor of the class
  • as outer context: The context enclosing the class context
  • as scope: The parameter accessors in the class context

The reasons for this peculiar choice of attributes are as follows:

  • The constructor must be the owner, because that's where any local methods or closures should go.
  • The context may not see any class members (inherited or defined), and should instead see definitions defined in the outer context which might be shadowed by such class members. That's why the outer context must be the outer context of the class.
  • At the same time the context should see the parameter accessors of the current class, that's why they get added to the local scope. An alternative would have been to have the context see the constructor parameters instead, but then we'd need a final substitution step from constructor parameters to class parameter accessors.

Attributes

Inherited from:
Context

The context for the arguments of a this(...) constructor call. The context is computed from the local auxiliary constructor context. It has

The context for the arguments of a this(...) constructor call. The context is computed from the local auxiliary constructor context. It has

  • as owner: The auxiliary constructor
  • as outer context: The context enclosing the enclosing class context
  • as scope: The parameters of the auxiliary constructor.

Attributes

Inherited from:
Context
override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Context -> Any
Inherited from:
Context

The current type assigner or typer

The current type assigner or typer

Attributes

Inherited from:
Context
def typer: Typer

Attributes

Inherited from:
Context

Attributes

Inherited from:
Context

Attributes

Inherited from:
Context

Should use colors when printing?

Should use colors when printing?

Attributes

Inherited from:
Context

Is the verbose option set?

Is the verbose option set?

Attributes

Inherited from:
Context
final def withOwner(owner: Symbol): Context

Attributes

Inherited from:
Context
final def withPhase(pid: PhaseId): Context

Attributes

Inherited from:
Context
final def withPhase(phase: Phase): Context

Attributes

Inherited from:
Context
final def withProperty[T](key: Key[T], value: Option[T]): Context

Attributes

Inherited from:
Context
final def withSource(source: SourceFile): Context

Attributes

Inherited from:
Context
final def withTyperState(typerState: TyperState): Context

Attributes

Inherited from:
Context

Attributes

Inherited from:
Context

Givens

Inherited givens

protected given given_Context: Context

Attributes

Inherited from:
Context