Struct Analyzer

Source
pub struct Analyzer<'a> {
    pub shared: SharedState<'a>,
    /* private fields */
}

Fields§

§shared: SharedState<'a>

Implementations§

Source§

impl Analyzer<'_>

Source

pub fn lookup_associated_function( &self, ty: &TypeRef, function_name: &str, ) -> Option<Function>

Source

pub fn analyze_range( &mut self, min_expr: &Expression, max_expr: &Expression, mode: &RangeMode, ast_node: &Node, ) -> Expression

§Errors
§Panics

If core hasn’t added the Range type

Source§

impl Analyzer<'_>

Source

pub fn analyze_attributes(&self, attributes: &[Attribute]) -> Attributes

Source

pub fn analyze_attribute(&self, parsed: &Attribute) -> Attribute

Source§

impl Analyzer<'_>

Source

pub fn analyze_argument( &mut self, fn_parameter: &TypeForParameter, argument_expr: &Expression, ) -> ArgumentExpression

§Errors
Source

pub fn analyze_and_verify_parameters( &mut self, node: &Node, fn_parameters: &[TypeForParameter], arguments: &[Expression], ) -> Vec<ArgumentExpression>

§Errors
Source

pub fn analyze_mut_or_immutable_expression( &mut self, expr: &Expression, context: &TypeContext<'_>, location_side: LocationSide, ) -> ArgumentExpression

§Errors
Source§

impl Analyzer<'_>

Source

pub fn try_find_constant( &self, qualified_constant_identifier: &QualifiedConstantIdentifier, ) -> Option<&ConstantRef>

Source§

impl Analyzer<'_>

Source

pub fn analyze_alias_type_definition( &mut self, ast_alias: &AliasType, ) -> AliasType

§Errors
Source

pub fn analyze_anonymous_struct_type( &mut self, ast_struct: &AnonymousStructType, ctx: &TypeAnalyzeContext, ) -> AnonymousStructType

§Errors
Source

pub fn analyze_anonymous_struct_type_fields( &mut self, ast_struct_fields: &[StructTypeField], ctx: &TypeAnalyzeContext, ) -> SeqMap<String, StructTypeField>

§Errors
Source

pub fn analyze_named_struct_type_definition( &mut self, ast_struct_def: &NamedStructDef, )

§Errors
Source

pub fn debug_definition(&self, definition: &Definition)

Source

pub fn analyze_definition(&mut self, ast_def: &Definition)

§Errors
Source

pub fn analyze_impl_functions( &mut self, attach_to_type: &TypeRef, functions: &[&Function], )

§Errors
Source

pub fn on_type_encountered(&mut self, ty: &TypeRef, node: &Node)

Called whenever a type is resolved/created during analysis to ensure string functions exist

Source

pub fn add_default_functions( &mut self, type_to_attach_to: &TypeRef, node: &Node, )

Source

pub fn ensure_default_functions_for_type(&mut self, ty: &TypeRef, node: &Node)

Ensures that a type has all necessary string functions generated This should be called whenever a type is encountered during analysis

Source§

impl Analyzer<'_>

Source

pub fn analyze_enum_variant_struct_literal( &mut self, variant_ref: &EnumVariantType, found_enum_type: &TypeRef, anonym_struct_field_and_expressions: &[FieldExpression], detected_rest: bool, node: &Node, ) -> Expression

Source

pub fn analyze_complex_literal_to_expression( &mut self, ast_expression: &Expression, ast_literal_kind: &LiteralKind, parent_context: &TypeContext<'_>, ) -> Expression

§Errors
§Panics

if core hasn’t added Vec

Source

pub fn add_err(&mut self, kind: ErrorKind, ast_node: &Node)

Source

pub fn create_err_vec( &mut self, kind: ErrorKind, ast_node: &Node, ) -> Vec<Expression>

Source

pub fn create_err(&mut self, kind: ErrorKind, ast_node: &Node) -> Expression

Source

pub fn create_err_resolved( &mut self, kind: ErrorKind, resolved_node: &Node, ) -> Expression

Source§

impl Analyzer<'_>

Source

pub fn deduce_the_anon_struct_type( &mut self, ast_fields: &Vec<FieldExpression>, context: &TypeContext<'_>, ) -> AnonymousStructType

Source

pub fn analyze_anonymous_struct_literal( &mut self, node: &Node, ast_fields: &Vec<FieldExpression>, rest_was_specified: bool, context: &TypeContext<'_>, ) -> Expression

§Errors
§Panics
Source§

impl Analyzer<'_>

Source

pub fn analyze_map_type( &mut self, ast_key_type: &Type, ast_value_type: &Type, ) -> (TypeRef, TypeRef)

§Errors
Source

pub fn analyze_key_and_value_type( &mut self, ast_key_type: &Type, ast_value_type: &Type, ) -> (TypeRef, TypeRef)

§Errors
Source

pub fn analyze_type( &mut self, ast_type: &Type, ctx: &TypeAnalyzeContext, ) -> TypeRef

§Errors
§Panics
Source§

impl Analyzer<'_>

Source

pub fn reserve_slot(&mut self, node: &Node) -> Option<VariableSlot>

Source

pub fn create_local_variable_with_reserved_slot( &mut self, slot: VariableSlot, ast_var: Variable, variable_type_ref: &TypeRef, ) -> (VariableRef, String)

Source

pub const fn types(&mut self) -> &mut TypeCache

Source§

impl<'a> Analyzer<'a>

Source

pub fn new( state: &'a mut ProgramState, modules: &'a Modules, core_symbol_table: SymbolTableRef, source_map: &'a SourceMap, module_path: &[String], file_id: FileId, options: AnalyzerOptions, ) -> Self

Source

pub fn analyze_local_function_access( &mut self, qualified_func_name: &QualifiedIdentifier, ) -> Option<Function>

Source

pub fn analyze_start_chain_expression_get_mutability( &mut self, ast_expression: &Expression, ) -> Option<StartOfChainBase>

§Errors
Source

pub fn debug_expression(&self, expr: &Expression, description: &str)

Source

pub fn debug_line(&self, offset: usize, description: &str)

Source

pub fn analyze_main_expression( &mut self, ast_expression: &Expression, ) -> InternalMainExpression

§Errors
Source

pub fn analyze_expression( &mut self, ast_expression: &Expression, context: &TypeContext<'_>, ) -> Expression

Source

pub fn analyze_expression_internal( &mut self, ast_expression: &Expression, context: &TypeContext<'_>, ) -> Expression

§Errors
Source

pub fn analyze_struct_field( &mut self, field_name: &Node, tv: &TypeRef, ) -> (AnonymousStructType, usize, TypeRef)

§Panics
§Errors
Source

pub fn analyze_static_call( &mut self, ast_node: &Node, func_def: Function, arguments: &[Expression], context: &TypeContext<'_>, ) -> Expression

Source

pub fn str_to_byte(text: &str) -> Result<u8, ParseByteError>

Source

pub fn chain_is_owned_result( start_of_chain: &StartOfChain, chains: &Vec<Postfix>, ) -> (bool, bool)

Source

pub fn check_assignment_mode( &mut self, lhs_is_mutable: bool, source_expression: &Expression, ty: &TypeRef, ) -> AssignmentMode

Source

pub const fn check_mutable_assignment( &mut self, assignment_mode: AssignmentMode, node: &Node, )

Source

pub const fn check_mutable_variable_assignment( &mut self, source_expression: &Expression, ty: &TypeRef, variable: &Variable, )

Source

pub fn analyze_variable_definition( &mut self, variable: &Variable, annotation_type: &Option<Type>, source_expression: &Expression, ) -> Expression

§Errors
Source

pub fn analyze_variable_assignment( &mut self, variable: &Variable, source_expression: &Expression, ) -> Expression

§Errors
Source

pub fn common_variable_util( &mut self, variable_resolution: VariableResolution, ast_node: &Node, source_expression: &Expression, ) -> Expression

Source

pub fn resolve_variable_expression( &mut self, maybe_annotated_type: Option<TypeRef>, source_expression: &Expression, ) -> (TypeRef, Expression)

Source

pub const fn create_expr( &self, kind: ExpressionKind, ty: TypeRef, ast_node: &Node, ) -> Expression

Source

pub fn analyze_generic_parameter_usize( &self, generic_parameter: &GenericParameter, ) -> usize

Source

pub fn analyze_generic_parameter_usize_tuple( &self, generic_parameter: &GenericParameter, ) -> (usize, usize)

Source

pub fn analyze_special_named_type( &mut self, path: &[String], name: &str, ast_generic_parameters: &[GenericParameter], ) -> Option<TypeRef>

Auto Trait Implementations§

§

impl<'a> Freeze for Analyzer<'a>

§

impl<'a> RefUnwindSafe for Analyzer<'a>

§

impl<'a> !Send for Analyzer<'a>

§

impl<'a> !Sync for Analyzer<'a>

§

impl<'a> Unpin for Analyzer<'a>

§

impl<'a> !UnwindSafe for Analyzer<'a>

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