Bash++
Bash++ compiler internal documentation
Public Member Functions | Private Attributes | List of all members
EntityMap Class Reference

A map of file positions to Bash++ container entities. More...

#include <EntityMap.h>

Collaboration diagram for EntityMap:
Collaboration graph
[legend]

Public Member Functions

void insert (FilePosition start, FilePosition end, const std::shared_ptr< bpp::bpp_entity > &entity)
 Add an entity to the entity map.
 
std::shared_ptr< bpp::bpp_entityfind (FilePosition point)
 
std::shared_ptr< bpp::bpp_entityfind (uint32_t line, uint32_t column)
 Find the active code entity at a specific line and column.
 

Private Attributes

FlatIntervalTree< std::shared_ptr< bpp::bpp_entity > > tree
 

Detailed Description

A map of file positions to Bash++ container entities.

The EntityMap is used to mark regions of source files with the entities that are active in those regions. For instance, if a class is defined from line 10 to line 20, the EntityMap will map that range to the class entity. A method internal to that class defined from line 12 to line 15 will map that range to the method entity.

This allows us to quickly look up the active entity at any given position in the source file. This class is used primarily by the language server to resolve entities for features like go-to-definition and rename refactoring.

Member Function Documentation

◆ find() [1/2]

std::shared_ptr< bpp::bpp_entity > EntityMap::find ( FilePosition  point)
inline

◆ find() [2/2]

std::shared_ptr< bpp::bpp_entity > EntityMap::find ( uint32_t  line,
uint32_t  column 
)
inline

Find the active code entity at a specific line and column.

◆ insert()

void EntityMap::insert ( FilePosition  start,
FilePosition  end,
const std::shared_ptr< bpp::bpp_entity > &  entity 
)
inline

Add an entity to the entity map.

Member Data Documentation

◆ tree

FlatIntervalTree<std::shared_ptr<bpp::bpp_entity> > EntityMap::tree
private

The documentation for this class was generated from the following file: