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<'_, '_>

source

fn build_accessor(lhs: HirExpression, rhs: &HirExpression) -> HirExpression

Creates an expression that accesses lhs on rhs and tries to avoid creating BinaryExpressions

source

fn handle_assignment( &mut self, assignment: &Assignment ) -> HirVariableInitialization

source

fn handle_attribute_list(&mut self, list: &AttributeList) -> Vec<Attribute>

source

fn handle_block(&mut self, block: &Block) -> HirBlock

source

fn handle_branch(&mut self, branch: &Branch) -> HirConditionalBranch

source

fn handle_control_flow( &mut self, control_flow: &ControlFlowOperation ) -> HirControlFlow

source

fn handle_expression(&mut self, expression: &Expression) -> HirExpression

source

fn handle_function(&mut self, function: &Function) -> HirFunction

source

fn handle_import(&mut self, import: &Import) -> HirImport

source

fn handle_infinite_loop(&mut self, inf_loop: &InfLoop) -> HirInfiniteLoop

source

fn handle_infix_op(&mut self, op: &InfixOp) -> HirExpression

source

fn handle_item(&mut self, statement: &Statement) -> HirItem

source

fn handle_module(&mut self, module: &Module) -> HirModule

source

fn handle_path(&self, path: &Path) -> IdentifierPath

source

fn handle_parse_error(&mut self, error: &ParseErrorKind) -> ParseError

source

fn handle_pattern(&self, pattern: &Pattern) -> HirVariablePattern

source

fn handle_postfix_op(&mut self, op: &PostfixOp) -> HirExpression

source

fn handle_prefix_op(&mut self, op: &PrefixOp) -> HirExpression

source

fn handle_struct(&mut self, strukt: &Struct) -> HirStruct

source

fn handle_struct_literal( &mut self, base: HirExpression, struct_lit: &StructLiteral ) -> HirStructInitialization

source

fn handle_type_pattern(&mut self, pattern: &Pattern) -> HirTypePattern

source

fn handle_update(&mut self, update: &Update) -> HirVariableUpdate

source

fn convert_pattern_to_value(pattern: &HirVariablePattern) -> HirExpression

source

fn handle_value(&mut self, value: &Value) -> HirExpression

source

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; }
}
source

fn maybe_add_name_to_expression( expr: HirExpression, ident: SpannedIdentifier ) -> HirExpression

source§

impl<'a, 'dep> HirContext<'a, 'dep>

source

pub fn new( input_file: CodeRef<'a>, compile_context: &'a CompileContext, dependencies: &'dep mut ImportDependencies ) -> Self

source

pub fn span(&self, item: impl Into<AstNodeOrToken>) -> Span

source

pub fn item_span(&self, ast_item: &impl AstItem) -> Span

source

pub fn normalize_local_span(&self, local_span: LocalSpan) -> Span

source

pub fn get_ident(&self, spanned_ident: SpannedIdentifier) -> Ident

source

pub fn add_import_file(&mut self, spanned_ident: SpannedIdentifier) -> usize

Trait Implementations§

source§

impl<'a, 'dep> Debug for HirContext<'a, 'dep>

source§

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

Formats the value using the given formatter. Read more

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.