Struct debris_hir::HirContext
source · pub struct HirContext<'a, 'dep> {
pub input_file: CodeRef<'a>,
pub compile_context: &'a CompileContext,
pub file_offset: usize,
pub dependencies: &'dep mut ImportDependencies,
pub errors: Vec<ParseError>,
}
Expand description
Contains state data that are used during the hir construction
Fields§
§input_file: CodeRef<'a>
§compile_context: &'a CompileContext
§file_offset: usize
§dependencies: &'dep mut ImportDependencies
§errors: Vec<ParseError>
Implementations§
source§impl HirContext<'_, '_>
impl HirContext<'_, '_>
sourcefn build_accessor(lhs: HirExpression, rhs: &HirExpression) -> HirExpression
fn build_accessor(lhs: HirExpression, rhs: &HirExpression) -> HirExpression
Creates an expression that accesses lhs
on rhs
and tries to
avoid creating BinaryExpression
s
fn handle_assignment( &mut self, assignment: &Assignment ) -> HirVariableInitialization
fn handle_attribute_list(&mut self, list: &AttributeList) -> Vec<Attribute>
fn handle_block(&mut self, block: &Block) -> HirBlock
fn handle_branch(&mut self, branch: &Branch) -> HirConditionalBranch
fn handle_control_flow( &mut self, control_flow: &ControlFlowOperation ) -> HirControlFlow
fn handle_expression(&mut self, expression: &Expression) -> HirExpression
fn handle_function(&mut self, function: &Function) -> HirFunction
fn handle_import(&mut self, import: &Import) -> HirImport
fn handle_infinite_loop(&mut self, inf_loop: &InfLoop) -> HirInfiniteLoop
fn handle_infix_op(&mut self, op: &InfixOp) -> HirExpression
fn handle_item(&mut self, statement: &Statement) -> HirItem
fn handle_module(&mut self, module: &Module) -> HirModule
fn handle_path(&self, path: &Path) -> IdentifierPath
fn handle_parse_error(&mut self, error: &ParseErrorKind) -> ParseError
fn handle_pattern(&self, pattern: &Pattern) -> HirVariablePattern
fn handle_postfix_op(&mut self, op: &PostfixOp) -> HirExpression
fn handle_prefix_op(&mut self, op: &PrefixOp) -> HirExpression
fn handle_struct(&mut self, strukt: &Struct) -> HirStruct
fn handle_struct_literal( &mut self, base: HirExpression, struct_lit: &StructLiteral ) -> HirStructInitialization
fn handle_type_pattern(&mut self, pattern: &Pattern) -> HirTypePattern
fn handle_update(&mut self, update: &Update) -> HirVariableUpdate
fn convert_pattern_to_value(pattern: &HirVariablePattern) -> HirExpression
fn handle_value(&mut self, value: &Value) -> HirExpression
sourcefn handle_while_loop(&mut self, while_loop: &WhileLoop) -> HirInfiniteLoop
fn handle_while_loop(&mut self, while_loop: &WhileLoop) -> HirInfiniteLoop
Handles while loops by desugaring them into normal loops with break:
while condition { block };
Gets turned into
loop {
if condition { block }
else { break; }
}
fn maybe_add_name_to_expression( expr: HirExpression, ident: SpannedIdentifier ) -> HirExpression
source§impl<'a, 'dep> HirContext<'a, 'dep>
impl<'a, 'dep> HirContext<'a, 'dep>
pub fn new( input_file: CodeRef<'a>, compile_context: &'a CompileContext, dependencies: &'dep mut ImportDependencies ) -> Self
pub fn span(&self, item: impl Into<AstNodeOrToken>) -> Span
pub fn item_span(&self, ast_item: &impl AstItem) -> Span
pub fn normalize_local_span(&self, local_span: LocalSpan) -> Span
pub fn get_ident(&self, spanned_ident: SpannedIdentifier) -> Ident
pub fn add_import_file(&mut self, spanned_ident: SpannedIdentifier) -> usize
Trait Implementations§
Auto Trait Implementations§
impl<'a, 'dep> !RefUnwindSafe for HirContext<'a, 'dep>
impl<'a, 'dep> !Send for HirContext<'a, 'dep>
impl<'a, 'dep> !Sync for HirContext<'a, 'dep>
impl<'a, 'dep> Unpin for HirContext<'a, 'dep>
impl<'a, 'dep> !UnwindSafe for HirContext<'a, 'dep>
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
Mutably borrows from an owned value. Read more