pub struct StaticAnalyzer<'a, N: Network> {
pub(crate) symbol_table: &'a SymbolTable,
pub(crate) type_table: &'a TypeTable,
pub(crate) handler: &'a Handler,
pub(crate) await_checker: AwaitChecker,
pub(crate) current_program: Option<Symbol>,
pub(crate) variant: Option<Variant>,
pub(crate) non_async_external_call_seen: bool,
phantom: PhantomData<N>,
}
Fields§
§symbol_table: &'a SymbolTable
The symbol table for the program.
type_table: &'a TypeTable
The type table for the program.
handler: &'a Handler
The error handler.
await_checker: AwaitChecker
Struct to store the state relevant to checking all futures are awaited.
current_program: Option<Symbol>
The current program name.
variant: Option<Variant>
The variant of the function that we are currently traversing.
non_async_external_call_seen: bool
Whether or not a non-async external call has been seen in this function.
phantom: PhantomData<N>
Implementations§
Source§impl<'a, N: Network> StaticAnalyzer<'a, N>
impl<'a, N: Network> StaticAnalyzer<'a, N>
Sourcepub fn new(
symbol_table: &'a SymbolTable,
_type_table: &'a TypeTable,
handler: &'a Handler,
max_depth: usize,
disabled: bool,
) -> Self
pub fn new( symbol_table: &'a SymbolTable, _type_table: &'a TypeTable, handler: &'a Handler, max_depth: usize, disabled: bool, ) -> Self
Returns a new static analyzer given a symbol table and error handler.
Sourcepub(crate) fn emit_err(&self, err: StaticAnalyzerError)
pub(crate) fn emit_err(&self, err: StaticAnalyzerError)
Emits a type checker error.
Sourcepub fn emit_warning(&self, warning: StaticAnalyzerWarning)
pub fn emit_warning(&self, warning: StaticAnalyzerWarning)
Emits a type checker warning
Sourcepub(crate) fn assert_future_await(
&mut self,
future: &Option<&Expression>,
span: Span,
)
pub(crate) fn assert_future_await( &mut self, future: &Option<&Expression>, span: Span, )
Type checks the awaiting of a future.
Sourcepub(crate) fn assert_simple_async_transition_call(
&self,
program: Symbol,
function_name: Symbol,
span: Span,
)
pub(crate) fn assert_simple_async_transition_call( &self, program: Symbol, function_name: Symbol, span: Span, )
Assert that an async call is a “simple” one.
Simple is defined as an async transition function which does not return a Future
that itself takes a Future
as an argument.
Trait Implementations§
Source§impl<N: Network> ExpressionVisitor for StaticAnalyzer<'_, N>
impl<N: Network> ExpressionVisitor for StaticAnalyzer<'_, N>
type AdditionalInput = ()
type Output = ()
fn visit_access( &mut self, input: &AccessExpression, _: &Self::AdditionalInput, ) -> Self::Output
fn visit_call( &mut self, input: &CallExpression, _: &Self::AdditionalInput, ) -> Self::Output
fn visit_expression( &mut self, input: &Expression, additional: &Self::AdditionalInput, ) -> Self::Output
fn visit_array( &mut self, input: &ArrayExpression, additional: &Self::AdditionalInput, ) -> Self::Output
fn visit_binary( &mut self, input: &BinaryExpression, additional: &Self::AdditionalInput, ) -> Self::Output
fn visit_cast( &mut self, input: &CastExpression, additional: &Self::AdditionalInput, ) -> Self::Output
fn visit_struct_init( &mut self, input: &StructExpression, additional: &Self::AdditionalInput, ) -> Self::Output
fn visit_err( &mut self, _input: &ErrExpression, _additional: &Self::AdditionalInput, ) -> Self::Output
fn visit_identifier( &mut self, _input: &Identifier, _additional: &Self::AdditionalInput, ) -> Self::Output
fn visit_literal( &mut self, _input: &Literal, _additional: &Self::AdditionalInput, ) -> Self::Output
fn visit_locator( &mut self, _input: &LocatorExpression, _additional: &Self::AdditionalInput, ) -> Self::Output
fn visit_ternary( &mut self, input: &TernaryExpression, additional: &Self::AdditionalInput, ) -> Self::Output
fn visit_tuple( &mut self, input: &TupleExpression, additional: &Self::AdditionalInput, ) -> Self::Output
fn visit_unary( &mut self, input: &UnaryExpression, additional: &Self::AdditionalInput, ) -> Self::Output
fn visit_unit( &mut self, _input: &UnitExpression, _additional: &Self::AdditionalInput, ) -> Self::Output
Source§impl<'a, N: Network> Pass for StaticAnalyzer<'a, N>
impl<'a, N: Network> Pass for StaticAnalyzer<'a, N>
Source§impl<N: Network> ProgramVisitor for StaticAnalyzer<'_, N>
impl<N: Network> ProgramVisitor for StaticAnalyzer<'_, N>
fn visit_program_scope(&mut self, input: &ProgramScope)
fn visit_function(&mut self, function: &Function)
fn visit_program(&mut self, input: &Program)
fn visit_stub(&mut self, _input: &Stub)
fn visit_import(&mut self, input: &Program)
fn visit_struct(&mut self, _input: &Composite)
fn visit_mapping(&mut self, _input: &Mapping)
fn visit_function_stub(&mut self, _input: &FunctionStub)
fn visit_struct_stub(&mut self, _input: &Composite)
Source§impl<N: Network> StatementVisitor for StaticAnalyzer<'_, N>
impl<N: Network> StatementVisitor for StaticAnalyzer<'_, N>
fn visit_conditional(&mut self, input: &ConditionalStatement)
fn visit_statement(&mut self, input: &Statement)
fn visit_assert(&mut self, input: &AssertStatement)
fn visit_assign(&mut self, input: &AssignStatement)
fn visit_block(&mut self, input: &Block)
fn visit_console(&mut self, input: &ConsoleStatement)
fn visit_const(&mut self, input: &ConstDeclaration)
fn visit_definition(&mut self, input: &DefinitionStatement)
fn visit_expression_statement(&mut self, input: &ExpressionStatement)
fn visit_iteration(&mut self, input: &IterationStatement)
fn visit_return(&mut self, input: &ReturnStatement)
Auto Trait Implementations§
impl<'a, N> Freeze for StaticAnalyzer<'a, N>
impl<'a, N> !RefUnwindSafe for StaticAnalyzer<'a, N>
impl<'a, N> !Send for StaticAnalyzer<'a, N>
impl<'a, N> !Sync for StaticAnalyzer<'a, N>
impl<'a, N> Unpin for StaticAnalyzer<'a, N>where
N: Unpin,
impl<'a, N> !UnwindSafe for StaticAnalyzer<'a, N>
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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 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>
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