IdentExpr

Enum IdentExpr 

Source
pub enum IdentExpr<'a> {
    Unresolved(&'a str),
    Local(Handle<Local>),
}
Expand description

An identifier that resolves to some declaration.

This does not cover context-dependent names: attributes, built-in values, and so on. We map those to their Naga IR equivalents as soon as they’re parsed, so they never need to appear as identifiers in the AST.

Variants§

§

Unresolved(&'a str)

An identifier referring to a module-scope declaration or predeclared object.

We need to collect the entire module before we can resolve this, to distinguish between predeclared objects and module-scope declarations that appear after their uses.

Whenever you create one of these values, you almost certainly want to insert the &str into ExpressionContext::unresolved, to ensure that indexing knows that the name’s declaration must be lowered before the one containing this use. Using Parser::ident_expr to build IdentExpr will take care of that for you.

§

Local(Handle<Local>)

An identifier that has been resolved to a non-module-scope declaration.

Trait Implementations§

Source§

impl<'a> Debug for IdentExpr<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for IdentExpr<'a>

§

impl<'a> RefUnwindSafe for IdentExpr<'a>

§

impl<'a> Send for IdentExpr<'a>

§

impl<'a> Sync for IdentExpr<'a>

§

impl<'a> Unpin for IdentExpr<'a>

§

impl<'a> UnwindSafe for IdentExpr<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.