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<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