Ref¶
- class understand.Ref¶
Bases:
object
An Understand reference.
A reference connects is a connection between two
entities
. For example func1 calls func2 is a reference where func1 is thescope
and func2 is the referencedent
. The referencekind
would be “call” represented with aKind
object. The string version of the kind is available withkindname
and the direction (“call” versus “callby”) is available withisforward
.References occur a location in the code. The location can be retrieved with
file
,line
andcolumn
. A reference may have come from a macro expansion. In that case, the text can be retrieved withmacroexpansion
.Reference line and column numbers are 1-based.
Methods Summary
Return the column in source where the reference occurred.
Return the entity being referenced.
Return the file where the reference occurred.
Return True if the reference is the first of a pair of refs (eg, use vs useby).
Return the reference kind.
Return the short name of the reference kind
Return the line in source where the reference occurred.
Return the macro expansion text for the refence file, line and column.
Return the entity performing the reference.
Methods Documentation
- column() int ¶
Return the column in source where the reference occurred.
- Return type:
int
- Returns:
the column
- ent() understand.Ent ¶
Return the entity being referenced.
- Return type:
- Returns:
the referenced entity
- file() understand.Ent ¶
Return the file where the reference occurred.
- Return type:
- Returns:
the file entity containing the reference.
- isforward() bool ¶
Return True if the reference is the first of a pair of refs (eg, use vs useby).
- Return type:
bool
- Returns:
True if the reference is forward.
- kind() understand.Kind ¶
Return the reference kind.
- Return type:
- Returns:
the reference kind
- kindname() str ¶
Return the short name of the reference kind
- Return type:
str
- Returns:
the kind name
This is similar to
ref.kind().name()
, but does not create aKind
object.
- line() int ¶
Return the line in source where the reference occurred.
- Return type:
int
- Returns:
the line
- macroexpansion() str ¶
Return the macro expansion text for the refence file, line and column.
- Return type:
str
- Returns:
the macro expansion text or None if no text is available
- scope() understand.Ent ¶
Return the entity performing the reference.
- Return type:
- Returns:
the scope entity