pub struct LoweringContext<'db, 'mt> {
pub encapsulating_ctx: Option<&'mt mut EncapsulatingLoweringContext<'db>>,
pub variables: VariableAllocator<'db>,
pub signature: EnrichedSemanticSignature<'db>,
pub function_id: FunctionWithBodyId<'db>,
pub concrete_function_id: ConcreteFunctionWithBodyId<'db>,
pub current_loop_ctx: Option<LoopContext<'db>>,
pub diagnostics: LoweringDiagnostics<'db>,
pub blocks: BlocksBuilder<'db>,
pub return_type: TypeId<'db>,
pub snapped_semantics: OrderedHashMap<MemberPath<'db>, VariableId>,
}Fields§
§encapsulating_ctx: Option<&'mt mut EncapsulatingLoweringContext<'db>>§variables: VariableAllocator<'db>Variable allocator.
signature: EnrichedSemanticSignature<'db>Current function signature.
function_id: FunctionWithBodyId<'db>Id for the current function being lowered.
concrete_function_id: ConcreteFunctionWithBodyId<'db>Id for the current concrete function to be used when generating recursive calls. This is the generic function specialized with its own generic parameters.
current_loop_ctx: Option<LoopContext<'db>>Current loop context.
diagnostics: LoweringDiagnostics<'db>Current emitted diagnostics.
blocks: BlocksBuilder<'db>Lowered blocks of the function.
return_type: TypeId<'db>§snapped_semantics: OrderedHashMap<MemberPath<'db>, VariableId>The semantic variables that are captured as snapshots.
For example, if we have a loop body that uses @x.a, then x.a will be added to
snapped_semantics.
Implementations§
Source§impl<'db, 'mt> LoweringContext<'db, 'mt>
impl<'db, 'mt> LoweringContext<'db, 'mt>
pub fn new(
global_ctx: &'mt mut EncapsulatingLoweringContext<'db>,
function_id: FunctionWithBodyId<'db>,
signature: EnrichedSemanticSignature<'db>,
return_type: TypeId<'db>,
) -> Maybe<Self>where
'db: 'mt,
Source§impl<'db, 'mt> LoweringContext<'db, 'mt>
impl<'db, 'mt> LoweringContext<'db, 'mt>
Sourcepub fn new_var(&mut self, req: VarRequest<'db>) -> VariableId
pub fn new_var(&mut self, req: VarRequest<'db>) -> VariableId
Allocates a new variable in the context’s variable arena according to the context.
Sourcepub fn new_var_usage(&mut self, req: VarRequest<'db>) -> VarUsage<'db>
pub fn new_var_usage(&mut self, req: VarRequest<'db>) -> VarUsage<'db>
Same as new_var but returns it as a VarUsage.
This is useful when the variable definition and usage locations are the same.
Sourcepub fn get_location(
&self,
stable_ptr: SyntaxStablePtrId<'db>,
) -> LocationId<'db>
pub fn get_location( &self, stable_ptr: SyntaxStablePtrId<'db>, ) -> LocationId<'db>
Retrieves the LocationId of a stable syntax pointer in the current function file.
Trait Implementations§
Source§impl<'db, 'mt> Deref for LoweringContext<'db, 'mt>
impl<'db, 'mt> Deref for LoweringContext<'db, 'mt>
Auto Trait Implementations§
impl<'db, 'mt> Freeze for LoweringContext<'db, 'mt>
impl<'db, 'mt> !RefUnwindSafe for LoweringContext<'db, 'mt>
impl<'db, 'mt> !Send for LoweringContext<'db, 'mt>
impl<'db, 'mt> !Sync for LoweringContext<'db, 'mt>
impl<'db, 'mt> Unpin for LoweringContext<'db, 'mt>
impl<'db, 'mt> !UnwindSafe for LoweringContext<'db, 'mt>
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
Source§impl<'db, T> DebugDbUpcast<'db, T> for Twhere
T: ?Sized,
impl<'db, T> DebugDbUpcast<'db, T> for Twhere
T: ?Sized,
fn debug_db_upcast(&'db self) -> &'db T
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