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.
-
returns
-
attribute
r cursor
-
returns
Cursor The reference cursor.
-
returns
-
attribute
r location
-
returns
ExpansionLocation The reference location.
-
returns
-
attribute
r referenced_entity
-
returns
Entity | Nil The entity being referenced.
-
returns
-
attribute
r parent_entity
-
returns
Entity | Nil The logical parent entity of the reference.
-
returns
-
attribute
r container
-
returns
Container | Nil The lexical container of the reference.
-
returns
-
attribute
r roles
-
returns
Array(Symbol) The roles attributed to the reference.
-
returns
def initialize(info, translation_unit)
Build a reference wrapper from low-level info.
Signature
-
parameter
infoLib::CXIdxEntityRefInfo The low-level reference info.
-
parameter
translation_unitTranslationUnit | 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