Skip to main content

Visit

Trait Visit 

pub trait Visit<T = ()> {
Show 31 methods // Provided methods fn visit_module(&mut self, module: &Module) -> ControlFlow<T> { ... } fn visit_export(&mut self, export: &Export) -> ControlFlow<T> { ... } fn visit_procedure(&mut self, procedure: &Procedure) -> ControlFlow<T> { ... } fn visit_constant(&mut self, constant: &Constant) -> ControlFlow<T> { ... } fn visit_constant_expr(&mut self, expr: &ConstantExpr) -> ControlFlow<T> { ... } fn visit_constant_ref(&mut self, path: &Span<Arc<Path>>) -> ControlFlow<T> { ... } fn visit_type_decl(&mut self, ty: &TypeDecl) -> ControlFlow<T> { ... } fn visit_type_alias(&mut self, ty: &TypeAlias) -> ControlFlow<T> { ... } fn visit_type_expr(&mut self, ty: &TypeExpr) -> ControlFlow<T> { ... } fn visit_type_ref(&mut self, path: &Span<Arc<Path>>) -> ControlFlow<T> { ... } fn visit_enum(&mut self, ty: &EnumType) -> ControlFlow<T> { ... } fn visit_enum_variant(&mut self, variant: &Variant) -> ControlFlow<T> { ... } fn visit_alias(&mut self, alias: &Alias) -> ControlFlow<T> { ... } fn visit_block(&mut self, block: &Block) -> ControlFlow<T> { ... } fn visit_op(&mut self, op: &Op) -> ControlFlow<T> { ... } fn visit_inst(&mut self, inst: &Span<Instruction>) -> ControlFlow<T> { ... } fn visit_system_event( &mut self, sys_event: Span<&SystemEventNode>, ) -> ControlFlow<T> { ... } fn visit_debug_options( &mut self, options: Span<&DebugOptions>, ) -> ControlFlow<T> { ... } fn visit_exec(&mut self, target: &InvocationTarget) -> ControlFlow<T> { ... } fn visit_call(&mut self, target: &InvocationTarget) -> ControlFlow<T> { ... } fn visit_syscall(&mut self, target: &InvocationTarget) -> ControlFlow<T> { ... } fn visit_procref(&mut self, target: &InvocationTarget) -> ControlFlow<T> { ... } fn visit_invoke_target( &mut self, target: &InvocationTarget, ) -> ControlFlow<T> { ... } fn visit_alias_target(&mut self, target: &AliasTarget) -> ControlFlow<T> { ... } fn visit_immediate_u8(&mut self, imm: &Immediate<u8>) -> ControlFlow<T> { ... } fn visit_immediate_u16(&mut self, imm: &Immediate<u16>) -> ControlFlow<T> { ... } fn visit_immediate_u32(&mut self, imm: &Immediate<u32>) -> ControlFlow<T> { ... } fn visit_immediate_felt(&mut self, imm: &Immediate<Felt>) -> ControlFlow<T> { ... } fn visit_immediate_word_value( &mut self, code: &Immediate<WordValue>, ) -> ControlFlow<T> { ... } fn visit_immediate_push_value( &mut self, code: &Immediate<PushValue>, ) -> ControlFlow<T> { ... } fn visit_immediate_error_message( &mut self, code: &Immediate<Arc<str>>, ) -> ControlFlow<T> { ... }
}
Expand description

Represents an immutable AST visitor, whose “early return” type is T (by default ()).

Immutable visitors are primarily used for analysis, or to search the AST for something specific.

Unless explicitly overridden, all methods of this trait will perform a default depth-first traversal of the AST. When a node is overridden, you must ensure that the corresponding free function in this module is called at an appropriate point if you wish to visit all of the children of that node. For example, if visiting procedures, you must call visit::visit_procedure either before you do your analysis for that procedure, or after, corresponding to whether you are pushing information up the tree, or down. If you do not do this, none of the children of the Procedure node will be visited. This is perfectly valid! Sometimes you don’t want/need to waste time on the children of a node if you can obtain all the information you need at the parent. It is just important to be aware that this is one of the elements placed in the hands of the visitor implementation.

The methods of this trait all return core::ops::ControlFlow, which can be used to break out of the traversal early via ControlFlow::Break. The T type parameter of this trait controls what the value associated with an early return will be. In most cases, the default of () is all you need - but in some cases it can be useful to return an error or other value, that indicates why the traversal ended early.

Provided Methods§

fn visit_module(&mut self, module: &Module) -> ControlFlow<T>

fn visit_export(&mut self, export: &Export) -> ControlFlow<T>

fn visit_procedure(&mut self, procedure: &Procedure) -> ControlFlow<T>

fn visit_constant(&mut self, constant: &Constant) -> ControlFlow<T>

fn visit_constant_expr(&mut self, expr: &ConstantExpr) -> ControlFlow<T>

fn visit_constant_ref(&mut self, path: &Span<Arc<Path>>) -> ControlFlow<T>

fn visit_type_decl(&mut self, ty: &TypeDecl) -> ControlFlow<T>

fn visit_type_alias(&mut self, ty: &TypeAlias) -> ControlFlow<T>

fn visit_type_expr(&mut self, ty: &TypeExpr) -> ControlFlow<T>

fn visit_type_ref(&mut self, path: &Span<Arc<Path>>) -> ControlFlow<T>

fn visit_enum(&mut self, ty: &EnumType) -> ControlFlow<T>

fn visit_enum_variant(&mut self, variant: &Variant) -> ControlFlow<T>

fn visit_alias(&mut self, alias: &Alias) -> ControlFlow<T>

fn visit_block(&mut self, block: &Block) -> ControlFlow<T>

fn visit_op(&mut self, op: &Op) -> ControlFlow<T>

fn visit_inst(&mut self, inst: &Span<Instruction>) -> ControlFlow<T>

fn visit_system_event( &mut self, sys_event: Span<&SystemEventNode>, ) -> ControlFlow<T>

fn visit_debug_options( &mut self, options: Span<&DebugOptions>, ) -> ControlFlow<T>

fn visit_exec(&mut self, target: &InvocationTarget) -> ControlFlow<T>

fn visit_call(&mut self, target: &InvocationTarget) -> ControlFlow<T>

fn visit_syscall(&mut self, target: &InvocationTarget) -> ControlFlow<T>

fn visit_procref(&mut self, target: &InvocationTarget) -> ControlFlow<T>

fn visit_invoke_target(&mut self, target: &InvocationTarget) -> ControlFlow<T>

fn visit_alias_target(&mut self, target: &AliasTarget) -> ControlFlow<T>

fn visit_immediate_u8(&mut self, imm: &Immediate<u8>) -> ControlFlow<T>

fn visit_immediate_u16(&mut self, imm: &Immediate<u16>) -> ControlFlow<T>

fn visit_immediate_u32(&mut self, imm: &Immediate<u32>) -> ControlFlow<T>

fn visit_immediate_felt(&mut self, imm: &Immediate<Felt>) -> ControlFlow<T>

fn visit_immediate_word_value( &mut self, code: &Immediate<WordValue>, ) -> ControlFlow<T>

fn visit_immediate_push_value( &mut self, code: &Immediate<PushValue>, ) -> ControlFlow<T>

fn visit_immediate_error_message( &mut self, code: &Immediate<Arc<str>>, ) -> ControlFlow<T>

Implementations on Foreign Types§

§

impl<V, T> Visit<T> for &mut V
where V: Visit<T> + ?Sized,

§

fn visit_module(&mut self, module: &Module) -> ControlFlow<T>

§

fn visit_export(&mut self, export: &Export) -> ControlFlow<T>

§

fn visit_procedure(&mut self, procedure: &Procedure) -> ControlFlow<T>

§

fn visit_constant(&mut self, constant: &Constant) -> ControlFlow<T>

§

fn visit_constant_expr(&mut self, expr: &ConstantExpr) -> ControlFlow<T>

§

fn visit_constant_ref(&mut self, path: &Span<Arc<Path>>) -> ControlFlow<T>

§

fn visit_type_decl(&mut self, ty: &TypeDecl) -> ControlFlow<T>

§

fn visit_type_alias(&mut self, ty: &TypeAlias) -> ControlFlow<T>

§

fn visit_type_expr(&mut self, ty: &TypeExpr) -> ControlFlow<T>

§

fn visit_type_ref(&mut self, path: &Span<Arc<Path>>) -> ControlFlow<T>

§

fn visit_enum(&mut self, ty: &EnumType) -> ControlFlow<T>

§

fn visit_enum_variant(&mut self, variant: &Variant) -> ControlFlow<T>

§

fn visit_alias(&mut self, alias: &Alias) -> ControlFlow<T>

§

fn visit_block(&mut self, block: &Block) -> ControlFlow<T>

§

fn visit_op(&mut self, op: &Op) -> ControlFlow<T>

§

fn visit_inst(&mut self, inst: &Span<Instruction>) -> ControlFlow<T>

§

fn visit_system_event( &mut self, sys_event: Span<&SystemEventNode>, ) -> ControlFlow<T>

§

fn visit_debug_options( &mut self, options: Span<&DebugOptions>, ) -> ControlFlow<T>

§

fn visit_exec(&mut self, target: &InvocationTarget) -> ControlFlow<T>

§

fn visit_call(&mut self, target: &InvocationTarget) -> ControlFlow<T>

§

fn visit_syscall(&mut self, target: &InvocationTarget) -> ControlFlow<T>

§

fn visit_procref(&mut self, target: &InvocationTarget) -> ControlFlow<T>

§

fn visit_invoke_target(&mut self, target: &InvocationTarget) -> ControlFlow<T>

§

fn visit_alias_target(&mut self, target: &AliasTarget) -> ControlFlow<T>

§

fn visit_immediate_u8(&mut self, imm: &Immediate<u8>) -> ControlFlow<T>

§

fn visit_immediate_u16(&mut self, imm: &Immediate<u16>) -> ControlFlow<T>

§

fn visit_immediate_u32(&mut self, imm: &Immediate<u32>) -> ControlFlow<T>

§

fn visit_immediate_felt(&mut self, imm: &Immediate<Felt>) -> ControlFlow<T>

§

fn visit_immediate_word_value( &mut self, imm: &Immediate<WordValue>, ) -> ControlFlow<T>

§

fn visit_immediate_push_value( &mut self, imm: &Immediate<PushValue>, ) -> ControlFlow<T>

§

fn visit_immediate_error_message( &mut self, code: &Immediate<Arc<str>>, ) -> ControlFlow<T>

Implementors§

§

impl Visit for VerifyRepeatCounts<'_>