NamesIndex

Information for efficiently navigating between declarations, aliases, definitions, and uses of atoms. This is information bounded by the module in which it occurs, but the referenced atoms may be in ancestor modules.

Constructors

Link copied to clipboard
constructor(occurrences: MutableMap<NameInModule, NamesIndex.NameOccurrences>, bloomFilterIfPackage: BloomFilter<NameInModule>?)

Construct a NamesIndex from the provided data.

Types

Link copied to clipboard
data class Declaration(val alias: NameInModule?, val phraseIndex: Int)

A declaration of a name. Note that there may be multiple positions involved, such as the Names section of the header, the first mention of the name, or an Alias statement that connects it to another name.

Link copied to clipboard
data class Definition(val definitionType: NamesIndex.DefinitionType, val manifestIndex: Int)

A definition of a method, macro, or restriction in this module.

Link copied to clipboard

The kind of thing being defined with some NameInModule. These are serialized by their ordinal, so change the repository version number if these must change.

Link copied to clipboard

The occurrences of things related to some name appearing in this module.

Link copied to clipboard
data class Usage(val usageType: NamesIndex.UsageType, val phraseIndex: Int)

An indication of where a name is used in the file, suitable for presenting in an itemized list.

Link copied to clipboard

The way that a NameInModule is being used somewhere.

Properties

Link copied to clipboard

A Map from each occurring NameInModule to the NameOccurrences that describe where and how the name is used in this module.

Functions

Link copied to clipboard
fun addDeclaration(nameInModule: NameInModule, alias: NameInModule?, phraseIndex: Int)

Add information about a Declaration.

Link copied to clipboard
fun addDefinition(nameInModule: NameInModule, definitionType: NamesIndex.DefinitionType, manifestIndex: Int)

Add information about a Definition.

Link copied to clipboard

Add all names mentioned by this module or package to the given BloomFilter.

Link copied to clipboard
fun addUsage(nameInModule: NameInModule, usageType: NamesIndex.UsageType, phraseIndex: Int)

Add information about a Usage.

Link copied to clipboard

Find all occurrences of the given nameToFind, invoking the functions as they're found. Ignore the bloomFilterIfPackage, letting the caller to decide how to use it to navigate. Don't search inside submodules. The caller should ensure the version of the file on disk corresponds with this NamesIndex.

Link copied to clipboard
open override fun toString(): String