pub enum ReferenceKind {
Variable(Arc<str>),
MethodCall {
class: Arc<str>,
method: Arc<str>,
},
StaticCall {
class: Arc<str>,
method: Arc<str>,
},
PropertyAccess {
class: Arc<str>,
property: Arc<str>,
},
FunctionCall(Arc<str>),
ClassReference(Arc<str>),
ConstantAccess {
class: Arc<str>,
constant: Arc<str>,
},
GlobalConstant(Arc<str>),
UseImport(Box<ReferenceKind>),
Receiver,
}Expand description
The kind of symbol reference that was resolved.
Variants§
Variable(Arc<str>)
A variable reference ($foo).
MethodCall
An instance method call ($obj->method()).
StaticCall
A static method call (Foo::method()).
PropertyAccess
A property access ($obj->prop).
FunctionCall(Arc<str>)
A free function call (foo()).
ClassReference(Arc<str>)
A class reference (new Foo, instanceof Foo, type hints).
ConstantAccess
A class constant access (Config::VERSION, self::CONST, parent::CONST).
GlobalConstant(Arc<str>)
A global constant reference (FOO, \FOO).
UseImport(Box<ReferenceKind>)
A symbol occurrence inside a use import statement (use Foo\Bar;,
use function foo\bar;, use const FOO\BAR;) — the import’s own name
token, not a usage site. Kept distinct from the wrapped kind so a
consumer walking reference-index postings (e.g. a future index-based
rename) can tell an import line apart from a genuine usage: renaming
must update the import too, but a plain find-references / dead-code
“is this ever used” check must not count the bare import as one (there
is deliberately no UnusedImport check).
Receiver
The type of a member-access receiver ($obj in $obj->prop, Foo in
Foo::method()), recorded at the gap between the receiver expression
and the member token — the ->/?->/:: operator and any
intervening whitespace — rather than at the receiver’s own span. This
is what lets a cursor sitting right after the operator (the position a
member-completion request fires from) resolve a type, since that
offset falls outside both the receiver expression’s span and the
member’s span. Not a codebase-level symbol — to_name returns None.
Implementations§
Source§impl ReferenceKind
impl ReferenceKind
Sourcepub fn to_name(&self) -> Option<Name>
pub fn to_name(&self) -> Option<Name>
Map to a typed crate::Name, or None for kinds that don’t correspond
to a codebase-level symbol (currently only Variable).
Trait Implementations§
Source§impl Clone for ReferenceKind
impl Clone for ReferenceKind
Source§fn clone(&self) -> ReferenceKind
fn clone(&self) -> ReferenceKind
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ReferenceKind
impl RefUnwindSafe for ReferenceKind
impl Send for ReferenceKind
impl Sync for ReferenceKind
impl Unpin for ReferenceKind
impl UnsafeUnpin for ReferenceKind
impl UnwindSafe for ReferenceKind
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more