FFI::ClangSourceFFIClangIndexActionEntityReference

class EntityReference

Represents a reference event reported during indexing.

Definitions

attr_reader :kind, :cursor, :location, :referenced_entity, :parent_entity, :container, :roles

Signature

attribute r

kind

returns Symbol

The reference kind.

attribute r

cursor

returns Cursor

The reference cursor.

attribute r

location

returns ExpansionLocation

The reference location.

attribute r

referenced_entity

returns Entity | Nil

The entity being referenced.

attribute r

parent_entity

returns Entity | Nil

The logical parent entity of the reference.

attribute r

container

returns Container | Nil

The lexical container of the reference.

attribute r

roles

returns Array(Symbol)

The roles attributed to the reference.

def initialize(info, translation_unit)

Build a reference wrapper from low-level info.

Signature

parameter info Lib::CXIdxEntityRefInfo

The low-level reference info.

parameter translation_unit TranslationUnit | Nil

The translation unit for derived wrappers.

Implementation

def initialize(info, translation_unit)
	@kind = info[:kind]
	@cursor = Cursor.new(info[:cursor], translation_unit)
	@location = ExpansionLocation.new(Lib.index_loc_get_source_location(info[:loc]))
	@referenced_entity = Declaration.entity_from_pointer(info[:referenced_entity], translation_unit)
	@parent_entity = Declaration.entity_from_pointer(info[:parent_entity], translation_unit)
	@container = Declaration.container_from_pointer(info[:container], translation_unit)
	@roles = Lib.opts_from(Lib::SymbolRole, info[:role])
end