Env

dotty.tools.dotc.transform.init.Objects.Env
object Env

Environment for parameters

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Env.type

Members list

Type members

Classlikes

case class LocalEnv(meth: Symbol, owner: ClassSymbol)(using x$3: Trace) extends Scope

Local environments can be deeply nested, therefore we need outer.

Local environments can be deeply nested, therefore we need outer.

For local variables in rhs of class field definitions, the meth is the primary constructor.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Scope
class Object
trait Matchable
class Any
Show all

Value members

Concrete methods

An empty environment can be used for non-method environments, e.g., field initializers.

An empty environment can be used for non-method environments, e.g., field initializers.

The owner for the local environment for field initializers is the primary constructor of the enclosing class.

Attributes

def ofByName(byNameParam: Symbol, outer: Scope)(using Data, MutableData, Trace): LocalEnv
def ofDefDef(ddef: DefDef, args: List[Value], outer: ScopeSet)(using Data, MutableData, Trace): LocalEnv
def resolveEnvByMethod(enclosing: Symbol, thisV: ThisValue, scope: Scope)(using Context, MutableData): () ?=> (ThisValue, ScopeSet)

Resolve the environment associated by the given method enclosing, starting from env as the innermost.

Resolve the environment associated by the given method enclosing, starting from env as the innermost.

The method could be located in outer scope with intermixed classes between its definition site and usage site.

Due to widening, the corresponding environment might not exist. As a result reading the local variable will return Cold and it's forbidden to write to the local variable.

Value parameters

enclosing

The method which owns the environment. This method is called to look up the environment owned by the enclosing method of some symbol.

env

The local environment where the local variable is referenced.

thisV

The value for this of the enclosing class where the local variable is referenced.

Attributes

Returns

the environment and value for this owned by the given method.

def resolveEnvByValue(target: Symbol, thisV: ThisValue, scope: Scope)(using Context, MutableData): () ?=> Option[(ThisValue, ScopeSet)]

Resolve the environment by searching for a given symbol.

Resolve the environment by searching for a given symbol.

Searches for the environment that defines target, starting from env as the innermost.

Due to widening, the corresponding environment might not exist. As a result reading the local variable will return Cold and it's forbidden to write to the local variable.

Value parameters

env

The local environment where the local variable is referenced.

target

The symbol to search for.

thisV

The value for this of the enclosing class where the local variable is referenced.

Attributes

Returns

the environment that owns the target and value for this that owns the owner of target.

def setLocalVal(x: Symbol, value: Value)(using scope: Scope, ctx: Context, heap: MutableData): Unit
def setLocalVar(x: Symbol, value: Value)(using scope: Scope, ctx: Context, heap: MutableData): Unit
def valValue(x: Symbol)(using scope: Scope, ctx: Context, trace: Trace, heap: MutableData): Value
def withEnv[T](env: LocalEnv)(fn: LocalEnv ?=> T): T

Concrete fields