class Namer

This class creates symbols from definitions and imports and gives them lazy types.

Timeline:

During enter, trees are expanded as necessary, populating the expandedTree map. Symbols are created, and the symOfTree map is set up.

Symbol completion causes some trees to be already typechecked and typedTree entries are created to associate the typed trees with the untyped expanded originals.

During typer, original trees are first expanded using expandedTree. For each expanded member definition or import we extract and remove the corresponding symbol from the symOfTree map and complete it. We then consult the typedTree map to see whether a typed tree exists already. If yes, the typed tree is returned as result. Otherwise, we proceed with regular type checking.

The scheme is designed to allow sharing of nodes, as long as each duplicate appears in a different method.

Constructors

Namer ( )

Members

class ClassCompleter
class Completer

The completer of a symbol defined by a member def or import (except ClassSymbols)

The completer of a symbol defined by a member def or import (except ClassSymbols)

class TypeDefCompleter
val ExpandedTree : Key [ Tree ]
val SymOfTree : Key [ Symbol ]
val TypedAhead : Key [ Tree ]
[+] lazy val nestedTyper : AnyRefMap [ Symbol, Typer ]

A map from method symbols to nested typers. Populated when methods are completed. Emptied when they are typechecked. The nested typer contains new versi...

A map from method symbols to nested typers. Populated when methods are completed. Emptied when they are typechecked. The nested typer contains new versions of the four maps above including this one, so that trees that are shared between different DefDefs can be independently used as indices. It also contains a scope that contains nested parameters.

[+] val scope : MutableScope

The scope of the typer. For nested typers this is a place parameters are entered during completion and where they survive until typechecking. A context...

The scope of the typer. For nested typers this is a place parameters are entered during completion and where they survive until typechecking. A context with this typer also has this scope.

[+] def addAnnotations ( sym: Symbol , stat: MemberDef ) ( implicit ctx: Context ) : Unit

Add annotations of stat to sym. This method can be called twice on a symbol (e.g. once during the annotate phase and then again during completion). There...

Add annotations of stat to sym. This method can be called twice on a symbol (e.g. once during the annotate phase and then again during completion). Therefore, care needs to be taken not to add annotations again that are already added to the symbol.

def addEnumConstants ( mdef: DefTree , sym: Symbol ) ( implicit ctx: Context ) : Unit

Add java enum constants

Add java enum constants

def annotate ( stats: List [ Tree ] ) ( implicit ctx: Context ) : Unit
def completeParams ( params: List [ MemberDef ] ) ( implicit ctx: Context ) : Unit

Enter and typecheck parameter list

Enter and typecheck parameter list

private def createPackageSymbol ( pid: RefTree ) ( implicit ctx: Context ) : Symbol

Create package if it does not yet exist.

Create package if it does not yet exist.

def createSymbol ( tree: Tree ) ( implicit ctx: Context ) : Symbol

If this tree is a member def or an import, create a symbol of it and store in symOfTree map.

If this tree is a member def or an import, create a symbol of it and store in symOfTree map.

def defDefSig ( ddef: DefDef , sym: Symbol ) ( implicit ctx: Context ) : Type

The type signature of a DefDef with given symbol

The type signature of a DefDef with given symbol

def enclosingClassNamed ( name: TypeName , pos: Position ) ( implicit ctx: Context ) : Symbol

The enclosing class with given name; error if none exists

The enclosing class with given name; error if none exists

def enterSymbol ( sym: Symbol ) ( implicit ctx: Context ) : Symbol

If sym exists, enter it in effective scope. Check that package members are not entered twice in the same run.

If sym exists, enter it in effective scope. Check that package members are not entered twice in the same run.

def expand ( tree: Tree ) ( implicit ctx: Context ) : Unit

Expand tree and store in expandedTree

Expand tree and store in expandedTree

def expanded ( tree: Tree ) ( implicit ctx: Context ) : Tree

The expanded version of this tree, or tree itself if not expanded

The expanded version of this tree, or tree itself if not expanded

def importContext ( imp: Import , sym: Symbol ) ( implicit ctx: Context ) : FreshContext

A new context that summarizes an import statement

A new context that summarizes an import statement

def inClassContext ( selfInfo: DotClass ) ( implicit ctx: Context ) : Context

A new context for the interior of a class

A new context for the interior of a class

def index ( stat: Tree ) ( implicit ctx: Context ) : Context

Expand tree and create top-level symbols for statement and enter them into symbol table

Expand tree and create top-level symbols for statement and enter them into symbol table

def index ( stats: List [ Tree ] ) ( implicit ctx: Context ) : Context

Create top-level symbols for statements and enter them into symbol table

Create top-level symbols for statements and enter them into symbol table

def indexAndAnnotate ( stats: List [ Tree ] ) ( implicit ctx: Context ) : Context
def indexExpanded ( origStat: Tree ) ( implicit ctx: Context ) : Context

Create top-level symbols for all statements in the expansion of this statement and enter them into symbol table

Create top-level symbols for all statements in the expansion of this statement and enter them into symbol table

def invalidateCompanions ( pkg: Symbol , xstats: List [ Tree ] ) ( implicit ctx: Context ) : Unit

For all class definitions stat in xstats: If the companion class if not also defined in xstats, invalidate it by setting its info to NoType.

For all class definitions stat in xstats: If the companion class if not also defined in xstats, invalidate it by setting its info to NoType.

[+] def isEnumConstant ( vd: ValDef ) ( implicit ctx: Context ) : Boolean

Determines whether this field holds an enum constant. To qualify, the following conditions must be met: - The field's class has the ENUM flag set - The f...

Determines whether this field holds an enum constant. To qualify, the following conditions must be met: - The field's class has the ENUM flag set - The field's class extends java.lang.Enum - The field has the ENUM flag set - The field is static - The field is stable

[+] def moduleValSig ( sym: Symbol ) ( implicit ctx: Context ) : Type

The signature of a module valdef. This will compute the corresponding module class TypeRef immediately without going through the defined type of the Val...

The signature of a module valdef. This will compute the corresponding module class TypeRef immediately without going through the defined type of the ValDef. This is necessary to avoid cyclic references involving imports and module val defs.

def recordSym ( sym: Symbol , tree: Tree ) ( implicit ctx: Context ) : Symbol

Record sym as the symbol defined by tree

Record sym as the symbol defined by tree

def setDocstring ( sym: Symbol , tree: Tree ) ( implicit ctx: Context ) : Unit
def symbolOfTree ( tree: Tree ) ( implicit ctx: Context ) : Symbol

The symbol of the given expanded tree.

The symbol of the given expanded tree.

def typeDefSig ( tdef: TypeDef , sym: Symbol , tparamSyms: List [ TypeSymbol ] ) ( implicit ctx: Context ) : Type
def typedAheadAnnotation ( tree: Tree ) ( implicit ctx: Context ) : Symbol
def typedAheadExpr ( tree: Tree , pt: Type ) ( implicit ctx: Context ) : Tree
def typedAheadExpr$default$2 : WildcardType.type
def typedAheadImpl ( tree: Tree , typed: Tree => Tree ) ( implicit ctx: Context ) : Tree

Typecheck tree during completion using typed, and remember result in TypedAhead map

Typecheck tree during completion using typed, and remember result in TypedAhead map

def typedAheadType ( tree: Tree , pt: Type ) ( implicit ctx: Context ) : Tree
def typedAheadType$default$2 : WildcardType.type
def valOrDefDefSig ( mdef: ValOrDefDef , sym: Symbol , typeParams: List [ Symbol ] , paramss: List [ List [ Symbol ] ] , paramFn: Type => Type ) ( implicit ctx: Context ) : Type

The type signature of a ValDef or DefDef

The type signature of a ValDef or DefDef