forge_fmt::visit

Trait Visitor

Source
pub trait Visitor {
    type Error: Error;

Show 57 methods // Provided methods fn visit_source(&mut self, _loc: Loc) -> Result<(), Self::Error> { ... } fn visit_source_unit( &mut self, _source_unit: &mut SourceUnit, ) -> Result<(), Self::Error> { ... } fn visit_contract( &mut self, _contract: &mut ContractDefinition, ) -> Result<(), Self::Error> { ... } fn visit_annotation( &mut self, annotation: &mut Annotation, ) -> Result<(), Self::Error> { ... } fn visit_pragma( &mut self, loc: Loc, _ident: &mut Option<Identifier>, _str: &mut Option<StringLiteral>, ) -> Result<(), Self::Error> { ... } fn visit_import_plain( &mut self, _loc: Loc, _import: &mut ImportPath, ) -> Result<(), Self::Error> { ... } fn visit_import_global( &mut self, _loc: Loc, _global: &mut ImportPath, _alias: &mut Identifier, ) -> Result<(), Self::Error> { ... } fn visit_import_renames( &mut self, _loc: Loc, _imports: &mut [(Identifier, Option<Identifier>)], _from: &mut ImportPath, ) -> Result<(), Self::Error> { ... } fn visit_enum( &mut self, _enum: &mut EnumDefinition, ) -> Result<(), Self::Error> { ... } fn visit_assembly( &mut self, loc: Loc, _dialect: &mut Option<StringLiteral>, _block: &mut YulBlock, _flags: &mut Option<Vec<StringLiteral>>, ) -> Result<(), Self::Error> { ... } fn visit_block( &mut self, loc: Loc, _unchecked: bool, _statements: &mut Vec<Statement>, ) -> Result<(), Self::Error> { ... } fn visit_args( &mut self, loc: Loc, _args: &mut Vec<NamedArgument>, ) -> Result<(), Self::Error> { ... } fn visit_expr( &mut self, loc: Loc, _expr: &mut Expression, ) -> Result<(), Self::Error> { ... } fn visit_ident( &mut self, loc: Loc, _ident: &mut Identifier, ) -> Result<(), Self::Error> { ... } fn visit_ident_path( &mut self, idents: &mut IdentifierPath, ) -> Result<(), Self::Error> { ... } fn visit_emit( &mut self, loc: Loc, _event: &mut Expression, ) -> Result<(), Self::Error> { ... } fn visit_var_definition( &mut self, var: &mut VariableDefinition, ) -> Result<(), Self::Error> { ... } fn visit_var_definition_stmt( &mut self, loc: Loc, _declaration: &mut VariableDeclaration, _expr: &mut Option<Expression>, ) -> Result<(), Self::Error> { ... } fn visit_var_declaration( &mut self, var: &mut VariableDeclaration, ) -> Result<(), Self::Error> { ... } fn visit_return( &mut self, loc: Loc, _expr: &mut Option<Expression>, ) -> Result<(), Self::Error> { ... } fn visit_revert( &mut self, loc: Loc, _error: &mut Option<IdentifierPath>, _args: &mut Vec<Expression>, ) -> Result<(), Self::Error> { ... } fn visit_revert_named_args( &mut self, loc: Loc, _error: &mut Option<IdentifierPath>, _args: &mut Vec<NamedArgument>, ) -> Result<(), Self::Error> { ... } fn visit_break( &mut self, loc: Loc, _semicolon: bool, ) -> Result<(), Self::Error> { ... } fn visit_continue( &mut self, loc: Loc, _semicolon: bool, ) -> Result<(), Self::Error> { ... } fn visit_try( &mut self, loc: Loc, _expr: &mut Expression, _returns: &mut Option<(Vec<(Loc, Option<Parameter>)>, Box<Statement>)>, _clauses: &mut Vec<CatchClause>, ) -> Result<(), Self::Error> { ... } fn visit_if( &mut self, loc: Loc, _cond: &mut Expression, _if_branch: &mut Box<Statement>, _else_branch: &mut Option<Box<Statement>>, _is_first_stmt: bool, ) -> Result<(), Self::Error> { ... } fn visit_do_while( &mut self, loc: Loc, _body: &mut Statement, _cond: &mut Expression, ) -> Result<(), Self::Error> { ... } fn visit_while( &mut self, loc: Loc, _cond: &mut Expression, _body: &mut Statement, ) -> Result<(), Self::Error> { ... } fn visit_for( &mut self, loc: Loc, _init: &mut Option<Box<Statement>>, _cond: &mut Option<Box<Expression>>, _update: &mut Option<Box<Expression>>, _body: &mut Option<Box<Statement>>, ) -> Result<(), Self::Error> { ... } fn visit_function( &mut self, func: &mut FunctionDefinition, ) -> Result<(), Self::Error> { ... } fn visit_function_attribute( &mut self, attribute: &mut FunctionAttribute, ) -> Result<(), Self::Error> { ... } fn visit_var_attribute( &mut self, attribute: &mut VariableAttribute, ) -> Result<(), Self::Error> { ... } fn visit_base(&mut self, base: &mut Base) -> Result<(), Self::Error> { ... } fn visit_parameter( &mut self, parameter: &mut Parameter, ) -> Result<(), Self::Error> { ... } fn visit_struct( &mut self, structure: &mut StructDefinition, ) -> Result<(), Self::Error> { ... } fn visit_event( &mut self, event: &mut EventDefinition, ) -> Result<(), Self::Error> { ... } fn visit_event_parameter( &mut self, param: &mut EventParameter, ) -> Result<(), Self::Error> { ... } fn visit_error( &mut self, error: &mut ErrorDefinition, ) -> Result<(), Self::Error> { ... } fn visit_error_parameter( &mut self, param: &mut ErrorParameter, ) -> Result<(), Self::Error> { ... } fn visit_type_definition( &mut self, def: &mut TypeDefinition, ) -> Result<(), Self::Error> { ... } fn visit_stray_semicolon(&mut self) -> Result<(), Self::Error> { ... } fn visit_opening_paren(&mut self) -> Result<(), Self::Error> { ... } fn visit_closing_paren(&mut self) -> Result<(), Self::Error> { ... } fn visit_newline(&mut self) -> Result<(), Self::Error> { ... } fn visit_using(&mut self, using: &mut Using) -> Result<(), Self::Error> { ... } fn visit_yul_block( &mut self, loc: Loc, _stmts: &mut Vec<YulStatement>, _attempt_single_line: bool, ) -> Result<(), Self::Error> { ... } fn visit_yul_expr( &mut self, expr: &mut YulExpression, ) -> Result<(), Self::Error> { ... } fn visit_yul_assignment<T>( &mut self, loc: Loc, _exprs: &mut Vec<T>, _expr: &mut Option<&mut YulExpression>, ) -> Result<(), Self::Error> where T: Visitable + CodeLocation { ... } fn visit_yul_for(&mut self, stmt: &mut YulFor) -> Result<(), Self::Error> { ... } fn visit_yul_function_call( &mut self, stmt: &mut YulFunctionCall, ) -> Result<(), Self::Error> { ... } fn visit_yul_fun_def( &mut self, stmt: &mut YulFunctionDefinition, ) -> Result<(), Self::Error> { ... } fn visit_yul_if( &mut self, loc: Loc, _expr: &mut YulExpression, _block: &mut YulBlock, ) -> Result<(), Self::Error> { ... } fn visit_yul_leave(&mut self, loc: Loc) -> Result<(), Self::Error> { ... } fn visit_yul_switch( &mut self, stmt: &mut YulSwitch, ) -> Result<(), Self::Error> { ... } fn visit_yul_var_declaration( &mut self, loc: Loc, _idents: &mut Vec<YulTypedIdentifier>, _expr: &mut Option<YulExpression>, ) -> Result<(), Self::Error> { ... } fn visit_yul_typed_ident( &mut self, ident: &mut YulTypedIdentifier, ) -> Result<(), Self::Error> { ... } fn visit_parser_error(&mut self, loc: Loc) -> Result<(), Self::Error> { ... }
}
Expand description

A trait that is invoked while traversing the Solidity Parse Tree. Each method of the Visitor trait is a hook that can be potentially overridden.

Currently the main implementer of this trait is the Formatter struct.

Required Associated Types§

Provided Methods§

Source

fn visit_source(&mut self, _loc: Loc) -> Result<(), Self::Error>

Source

fn visit_source_unit( &mut self, _source_unit: &mut SourceUnit, ) -> Result<(), Self::Error>

Source

fn visit_contract( &mut self, _contract: &mut ContractDefinition, ) -> Result<(), Self::Error>

Source

fn visit_annotation( &mut self, annotation: &mut Annotation, ) -> Result<(), Self::Error>

Source

fn visit_pragma( &mut self, loc: Loc, _ident: &mut Option<Identifier>, _str: &mut Option<StringLiteral>, ) -> Result<(), Self::Error>

Source

fn visit_import_plain( &mut self, _loc: Loc, _import: &mut ImportPath, ) -> Result<(), Self::Error>

Source

fn visit_import_global( &mut self, _loc: Loc, _global: &mut ImportPath, _alias: &mut Identifier, ) -> Result<(), Self::Error>

Source

fn visit_import_renames( &mut self, _loc: Loc, _imports: &mut [(Identifier, Option<Identifier>)], _from: &mut ImportPath, ) -> Result<(), Self::Error>

Source

fn visit_enum(&mut self, _enum: &mut EnumDefinition) -> Result<(), Self::Error>

Source

fn visit_assembly( &mut self, loc: Loc, _dialect: &mut Option<StringLiteral>, _block: &mut YulBlock, _flags: &mut Option<Vec<StringLiteral>>, ) -> Result<(), Self::Error>

Source

fn visit_block( &mut self, loc: Loc, _unchecked: bool, _statements: &mut Vec<Statement>, ) -> Result<(), Self::Error>

Source

fn visit_args( &mut self, loc: Loc, _args: &mut Vec<NamedArgument>, ) -> Result<(), Self::Error>

Source

fn visit_expr( &mut self, loc: Loc, _expr: &mut Expression, ) -> Result<(), Self::Error>

Don’t write semicolon at the end because expressions can appear as both part of other node and a statement in the function body

Source

fn visit_ident( &mut self, loc: Loc, _ident: &mut Identifier, ) -> Result<(), Self::Error>

Source

fn visit_ident_path( &mut self, idents: &mut IdentifierPath, ) -> Result<(), Self::Error>

Source

fn visit_emit( &mut self, loc: Loc, _event: &mut Expression, ) -> Result<(), Self::Error>

Source

fn visit_var_definition( &mut self, var: &mut VariableDefinition, ) -> Result<(), Self::Error>

Source

fn visit_var_definition_stmt( &mut self, loc: Loc, _declaration: &mut VariableDeclaration, _expr: &mut Option<Expression>, ) -> Result<(), Self::Error>

Source

fn visit_var_declaration( &mut self, var: &mut VariableDeclaration, ) -> Result<(), Self::Error>

Source

fn visit_return( &mut self, loc: Loc, _expr: &mut Option<Expression>, ) -> Result<(), Self::Error>

Source

fn visit_revert( &mut self, loc: Loc, _error: &mut Option<IdentifierPath>, _args: &mut Vec<Expression>, ) -> Result<(), Self::Error>

Source

fn visit_revert_named_args( &mut self, loc: Loc, _error: &mut Option<IdentifierPath>, _args: &mut Vec<NamedArgument>, ) -> Result<(), Self::Error>

Source

fn visit_break(&mut self, loc: Loc, _semicolon: bool) -> Result<(), Self::Error>

Source

fn visit_continue( &mut self, loc: Loc, _semicolon: bool, ) -> Result<(), Self::Error>

Source

fn visit_try( &mut self, loc: Loc, _expr: &mut Expression, _returns: &mut Option<(Vec<(Loc, Option<Parameter>)>, Box<Statement>)>, _clauses: &mut Vec<CatchClause>, ) -> Result<(), Self::Error>

Source

fn visit_if( &mut self, loc: Loc, _cond: &mut Expression, _if_branch: &mut Box<Statement>, _else_branch: &mut Option<Box<Statement>>, _is_first_stmt: bool, ) -> Result<(), Self::Error>

Source

fn visit_do_while( &mut self, loc: Loc, _body: &mut Statement, _cond: &mut Expression, ) -> Result<(), Self::Error>

Source

fn visit_while( &mut self, loc: Loc, _cond: &mut Expression, _body: &mut Statement, ) -> Result<(), Self::Error>

Source

fn visit_for( &mut self, loc: Loc, _init: &mut Option<Box<Statement>>, _cond: &mut Option<Box<Expression>>, _update: &mut Option<Box<Expression>>, _body: &mut Option<Box<Statement>>, ) -> Result<(), Self::Error>

Source

fn visit_function( &mut self, func: &mut FunctionDefinition, ) -> Result<(), Self::Error>

Source

fn visit_function_attribute( &mut self, attribute: &mut FunctionAttribute, ) -> Result<(), Self::Error>

Source

fn visit_var_attribute( &mut self, attribute: &mut VariableAttribute, ) -> Result<(), Self::Error>

Source

fn visit_base(&mut self, base: &mut Base) -> Result<(), Self::Error>

Source

fn visit_parameter( &mut self, parameter: &mut Parameter, ) -> Result<(), Self::Error>

Source

fn visit_struct( &mut self, structure: &mut StructDefinition, ) -> Result<(), Self::Error>

Source

fn visit_event( &mut self, event: &mut EventDefinition, ) -> Result<(), Self::Error>

Source

fn visit_event_parameter( &mut self, param: &mut EventParameter, ) -> Result<(), Self::Error>

Source

fn visit_error( &mut self, error: &mut ErrorDefinition, ) -> Result<(), Self::Error>

Source

fn visit_error_parameter( &mut self, param: &mut ErrorParameter, ) -> Result<(), Self::Error>

Source

fn visit_type_definition( &mut self, def: &mut TypeDefinition, ) -> Result<(), Self::Error>

Source

fn visit_stray_semicolon(&mut self) -> Result<(), Self::Error>

Source

fn visit_opening_paren(&mut self) -> Result<(), Self::Error>

Source

fn visit_closing_paren(&mut self) -> Result<(), Self::Error>

Source

fn visit_newline(&mut self) -> Result<(), Self::Error>

Source

fn visit_using(&mut self, using: &mut Using) -> Result<(), Self::Error>

Source

fn visit_yul_block( &mut self, loc: Loc, _stmts: &mut Vec<YulStatement>, _attempt_single_line: bool, ) -> Result<(), Self::Error>

Source

fn visit_yul_expr( &mut self, expr: &mut YulExpression, ) -> Result<(), Self::Error>

Source

fn visit_yul_assignment<T>( &mut self, loc: Loc, _exprs: &mut Vec<T>, _expr: &mut Option<&mut YulExpression>, ) -> Result<(), Self::Error>

Source

fn visit_yul_for(&mut self, stmt: &mut YulFor) -> Result<(), Self::Error>

Source

fn visit_yul_function_call( &mut self, stmt: &mut YulFunctionCall, ) -> Result<(), Self::Error>

Source

fn visit_yul_fun_def( &mut self, stmt: &mut YulFunctionDefinition, ) -> Result<(), Self::Error>

Source

fn visit_yul_if( &mut self, loc: Loc, _expr: &mut YulExpression, _block: &mut YulBlock, ) -> Result<(), Self::Error>

Source

fn visit_yul_leave(&mut self, loc: Loc) -> Result<(), Self::Error>

Source

fn visit_yul_switch(&mut self, stmt: &mut YulSwitch) -> Result<(), Self::Error>

Source

fn visit_yul_var_declaration( &mut self, loc: Loc, _idents: &mut Vec<YulTypedIdentifier>, _expr: &mut Option<YulExpression>, ) -> Result<(), Self::Error>

Source

fn visit_yul_typed_ident( &mut self, ident: &mut YulTypedIdentifier, ) -> Result<(), Self::Error>

Source

fn visit_parser_error(&mut self, loc: Loc) -> Result<(), Self::Error>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§