package solidity-common

  1. Overview
  2. Docs

Visitors are objects providing utils for exhaustively passing through the Solidity AST.

type action =
  1. | SkipChildren
    (*

    Stops the visit of the current branch

    *)
  2. | DoChildren
    (*

    Visits the branch children

    *)
  3. | DoChildrenPost of unit -> unit
    (*

    Visits the branch children and, once the visit is finished, calls the function

    *)

The different kind of actions to perform after each visit

class virtual ast_visitor : object ... end

The AST visitor. Each method is called when reaching an element of the corresponding type in the AST.

class init_ast_visitor : object ... end

A dummy visitor. Visits the whole AST and does nothing. You may inherit this visitor and redefine its methods to avoid redefining all the methods.

Functions visiting the AST.

val visitNode : (ast_visitor as 'b -> 'a -> unit) -> 'b -> 'a Solidity_common.node -> unit
val visitType : ast_visitor -> Solidity_ast.type_ -> unit
val visitParam : ast_visitor -> Solidity_ast.param -> unit
val visitFunctionType : ast_visitor -> Solidity_ast.function_type -> unit
val visitTypeDef : ast_visitor -> Solidity_ast.type_definition -> unit
val visitContractDef : ast_visitor -> Solidity_ast.contract_definition -> unit
val visitInheritanceSpecifier : ast_visitor -> Solidity_ast.inheritance_specifier -> unit
val visitContractPart : ast_visitor -> Solidity_ast.contract_part -> unit
val visitStateVariableDef : ast_visitor -> Solidity_ast.state_variable_definition -> unit
val visitBlock : ast_visitor -> Solidity_ast.block -> unit
val visitFunctionDef : ast_visitor -> Solidity_ast.function_definition -> unit
val visitModifierDef : ast_visitor -> Solidity_ast.modifier_definition -> unit
val visitEventDef : ast_visitor -> Solidity_ast.event_definition -> unit
val visitCatchClause : ast_visitor -> Solidity_ast.catch_clause -> unit
val visitStatement : ast_visitor -> Solidity_ast.statement -> unit
val visitExpression : ast_visitor -> Solidity_ast.expression -> unit
val visitVariableDef : ast_visitor -> Solidity_ast.variable_definition -> unit
val visitFunctionCallArguments : ast_visitor -> Solidity_ast.function_call_arguments -> unit
val visitSourceUnit : ast_visitor -> Solidity_ast.source_unit -> unit
val visitImportDirective : ast_visitor -> Solidity_ast.import_directive -> unit
val visitImportSymbols : ast_visitor -> Solidity_ast.import_symbols -> unit
val visitModule : ast_visitor -> Solidity_ast.module_ -> unit
OCaml

Innovation. Community. Security.