cairo_lang_semantic::resolve

Struct Resolver

Source
pub struct Resolver<'db> {
    pub data: ResolverData,
    pub owning_crate_id: CrateId,
    pub edition: Edition,
    /* private fields */
}
Expand description

Resolves paths semantically.

Fields§

§data: ResolverData§owning_crate_id: CrateId§edition: Edition

Implementations§

Source§

impl Resolver<'_>

Source

pub fn set_feature_config( &mut self, element_id: &impl LanguageElementId, syntax: &impl QueryAttrs, diagnostics: &mut SemanticDiagnostics, )

Extracts the allowed node from the syntax, and sets it as the allowed features of the resolver.

Source§

impl<'db> Resolver<'db>

Source

pub fn new( db: &'db dyn SemanticGroup, module_file_id: ModuleFileId, inference_id: InferenceId, ) -> Self

Source

pub fn with_data(db: &'db dyn SemanticGroup, data: ResolverData) -> Self

Source

pub fn inference(&mut self) -> Inference<'_>

Source

pub fn add_generic_param(&mut self, generic_param_id: GenericParamId)

Adds a generic param to an existing resolver. This is required since a resolver needs to exist before resolving the generic params, and thus, they are added to the Resolver only after they are resolved.

Source

pub fn resolve_concrete_path( &mut self, diagnostics: &mut SemanticDiagnostics, path: impl AsSegments, item_type: NotFoundItemType, ) -> Maybe<ResolvedConcreteItem>

Resolves a concrete item, given a path. Guaranteed to result in at most one diagnostic.

Source

pub fn resolve_generic_path( &mut self, diagnostics: &mut SemanticDiagnostics, path: impl AsSegments, item_type: NotFoundItemType, ) -> Maybe<ResolvedGenericItem>

Resolves a generic item, given a path. Guaranteed to result in at most one diagnostic.

Source

pub fn resolve_generic_path_with_args( &mut self, diagnostics: &mut SemanticDiagnostics, path: impl AsSegments, item_type: NotFoundItemType, ) -> Maybe<ResolvedGenericItem>

Resolves a generic item, given a concrete item path, while ignoring the generic args. Guaranteed to result in at most one diagnostic.

Source

pub fn prelude_submodule(&self) -> ModuleId

Returns the crate’s prelude submodule.

Source

pub fn specialize_function( &mut self, diagnostics: &mut SemanticDiagnostics, stable_ptr: SyntaxStablePtrId, generic_function: GenericFunctionId, generic_args: &[GenericArg], ) -> Maybe<FunctionId>

Specializes a generic function.

Source

pub fn specialize_type( &mut self, diagnostics: &mut SemanticDiagnostics, stable_ptr: SyntaxStablePtrId, generic_type: GenericTypeId, generic_args: &[GenericArg], ) -> Maybe<TypeId>

Specializes a generic type.

Source

pub fn impl_lookup_context(&self) -> ImplLookupContext

Source

pub fn resolve_generic_args( &mut self, diagnostics: &mut SemanticDiagnostics, generic_params: &[GenericParam], generic_args_syntax: &[GenericArg], stable_ptr: SyntaxStablePtrId, ) -> Maybe<Vec<GenericArgumentId>>

Source

pub fn ignore_visibility_checks(&self, module_id: ModuleId) -> bool

Should visibility checks not actually happen for lookups in this module.

Methods from Deref<Target = ResolverData>§

Source

pub fn clone_with_inference_id( &self, db: &dyn SemanticGroup, inference_id: InferenceId, ) -> Self

Trait Implementations§

Source§

impl Deref for Resolver<'_>

Source§

type Target = ResolverData

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl DerefMut for Resolver<'_>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.

Auto Trait Implementations§

§

impl<'db> Freeze for Resolver<'db>

§

impl<'db> !RefUnwindSafe for Resolver<'db>

§

impl<'db> !Send for Resolver<'db>

§

impl<'db> !Sync for Resolver<'db>

§

impl<'db> Unpin for Resolver<'db>

§

impl<'db> !UnwindSafe for Resolver<'db>

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T0, T1, E, TRewriter> SemanticRewriter<(T0, T1), E> for TRewriter
where TRewriter: SemanticRewriter<T0, E> + SemanticRewriter<T1, E>,

Source§

fn internal_rewrite(&mut self, value: &mut (T0, T1)) -> Result<RewriteResult, E>

Source§

fn rewrite(&mut self, value: T) -> Result<T, Error>

Source§

impl<T, E, TRewriter> SemanticRewriter<Box<T>, E> for TRewriter
where TRewriter: SemanticRewriter<T, E>,

Source§

fn internal_rewrite(&mut self, value: &mut Box<T>) -> Result<RewriteResult, E>

Source§

fn rewrite(&mut self, value: T) -> Result<T, Error>

Source§

impl<T, E, TRewriter> SemanticRewriter<Option<T>, E> for TRewriter
where TRewriter: SemanticRewriter<T, E>,

Source§

fn internal_rewrite( &mut self, value: &mut Option<T>, ) -> Result<RewriteResult, E>

Source§

fn rewrite(&mut self, value: T) -> Result<T, Error>

Source§

impl<T, V, E, TRewriter> SemanticRewriter<OrderedHashMap<T, V>, E> for TRewriter
where T: Clone, V: Clone, TRewriter: SemanticRewriter<V, E>,

Source§

fn internal_rewrite( &mut self, value: &mut OrderedHashMap<T, V>, ) -> Result<RewriteResult, E>

Source§

fn rewrite(&mut self, value: T) -> Result<T, Error>

Source§

impl<T, E, TRewriter, E2> SemanticRewriter<Result<T, E2>, E> for TRewriter
where TRewriter: SemanticRewriter<T, E>,

Source§

fn internal_rewrite( &mut self, value: &mut Result<T, E2>, ) -> Result<RewriteResult, E>

Source§

fn rewrite(&mut self, value: T) -> Result<T, Error>

Source§

impl<T, E, TRewriter> SemanticRewriter<Vec<T>, E> for TRewriter
where T: Clone, TRewriter: SemanticRewriter<T, E>,

Source§

fn internal_rewrite(&mut self, value: &mut Vec<T>) -> Result<RewriteResult, E>

Source§

fn rewrite(&mut self, value: T) -> Result<T, Error>

Source§

impl<T, E, TRewriter> SemanticRewriter<VecDeque<T>, E> for TRewriter
where TRewriter: SemanticRewriter<T, E>,

Source§

fn internal_rewrite( &mut self, value: &mut VecDeque<T>, ) -> Result<RewriteResult, E>

Source§

fn rewrite(&mut self, value: T) -> Result<T, Error>

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.
Source§

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

Source§

fn upcast(&self) -> &T

Source§

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

Source§

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

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more