Scope

dotty.tools.dotc.core.Scopes$.Scope
abstract class Scope extends Showable

A scope contains a set of symbols. It can be an extension of some outer scope, from which it inherits all symbols. This class does not have any methods to add symbols to a scope or to delete them. These methods are provided by subclass MutableScope.

Attributes

Graph
Supertypes
trait Showable
class Object
trait Matchable
class Any
Known subtypes
object EmptyScope.type

Members list

Concise view

Value members

Abstract methods

Returns a new mutable scope with the same content as this one.

Returns a new mutable scope with the same content as this one.

Attributes

def lookupEntry(name: Name)(using Context): ScopeEntry | Null

Lookup a symbol entry matching given name.

Lookup a symbol entry matching given name.

Attributes

def lookupNextEntry(entry: ScopeEntry)(using Context): ScopeEntry | Null

Lookup next entry with same name as this one

Lookup next entry with same name as this one

Attributes

The number of scopes enclosing this scope.

The number of scopes enclosing this scope.

Attributes

def size: Int

The number of symbols in this scope (including inherited ones from outer scopes).

The number of symbols in this scope (including inherited ones from outer scopes).

Attributes

def toList(using Context): List[Symbol]

The symbols in this scope in the order they were entered; inherited from outer ones first.

The symbols in this scope in the order they were entered; inherited from outer ones first.

Attributes

Concrete methods

final def contains(name: Name, sym: Symbol)(using Context): Boolean

Does this scope contain a reference to sym when looking up name?

Does this scope contain a reference to sym when looking up name?

Attributes

final def denotsNamed(name: Name)(using Context): PreDenotation

The denotation set of all the symbols with given name in this scope Symbols occur in the result in reverse order relative to their occurrence in this.toList.

The denotation set of all the symbols with given name in this scope Symbols occur in the result in reverse order relative to their occurrence in this.toList.

Attributes

protected def ensureComplete()(using Context): Unit

Ensure that all elements of this scope have been entered. Overridden by SymbolLoaders.PackageLoader#PackageScope, where it makes sure that all names with $'s have been added.

Ensure that all elements of this scope have been entered. Overridden by SymbolLoaders.PackageLoader#PackageScope, where it makes sure that all names with $'s have been added.

Attributes

def exists(p: Symbol => Boolean)(using Context): Boolean

Tests whether a predicate holds for at least one Symbol of this Scope.

Tests whether a predicate holds for at least one Symbol of this Scope.

Attributes

def filter(p: Symbol => Boolean)(using Context): List[Symbol]

Selects all Symbols of this Scope which satisfy a predicate.

Selects all Symbols of this Scope which satisfy a predicate.

Attributes

final def filteredScope(p: Symbol => Boolean)(using Context): Scope

The scope that keeps only those symbols from this scope that match the given predicates. If all symbols match, returns the scope itself, otherwise a copy with the matching symbols.

The scope that keeps only those symbols from this scope that match the given predicates. If all symbols match, returns the scope itself, otherwise a copy with the matching symbols.

Attributes

def find(p: Symbol => Boolean)(using Context): Symbol

Finds the first Symbol of this Scope satisfying a predicate, if any.

Finds the first Symbol of this Scope satisfying a predicate, if any.

Attributes

def foreach[U](f: Symbol => U)(using Context): Unit

Applies a function f to all Symbols of this Scope.

Applies a function f to all Symbols of this Scope.

Attributes

Is the scope empty?

Is the scope empty?

Attributes

Return all symbols as an iterator in the order they were entered in this scope.

Return all symbols as an iterator in the order they were entered in this scope.

Attributes

final def lookup(name: Name)(using Context): Symbol

Lookup a symbol

Lookup a symbol

Attributes

final def lookupAll(name: Name)(using Context): Iterator[Symbol]

Returns an iterator yielding every symbol with given name in this scope.

Returns an iterator yielding every symbol with given name in this scope.

Attributes

final def toText(printer: Printer): Text

The text representation of this showable element. This normally dispatches to a pattern matching method in Printers.

The text representation of this showable element. This normally dispatches to a pattern matching method in Printers.

Attributes

Inherited methods

def fallbackToText(printer: Printer): Text

A fallback text representation, if the pattern matching in Printers does not have a case for this showable element

A fallback text representation, if the pattern matching in Printers does not have a case for this showable element

Attributes

Inherited from:
Showable
def show(using Context): String

The string representation of this showable element.

The string representation of this showable element.

Attributes

Inherited from:
Showable
def showIndented(margin: Int)(using Context): String

The string representation with each line after the first one indented by the given given margin (in spaces).

The string representation with each line after the first one indented by the given given margin (in spaces).

Attributes

Inherited from:
Showable
def showSummary(depth: Int)(using Context): String

The summarized string representation of this showable element. Recursion depth is limited to some smallish value. Default is Config.summarizeDepth.

The summarized string representation of this showable element. Recursion depth is limited to some smallish value. Default is Config.summarizeDepth.

Attributes

Inherited from:
Showable