diff --git a/compiler/ast/src/passes/reconstructor.rs b/compiler/ast/src/passes/reconstructor.rs index 663966def4..24d4a0874e 100644 --- a/compiler/ast/src/passes/reconstructor.rs +++ b/compiler/ast/src/passes/reconstructor.rs @@ -14,12 +14,13 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -//! This module contains a reconstructor Trait for the AST. +//! This module contains a Reconstructor trait for the AST. //! It implements default methods for each node to be made //! given the information of the old node. use crate::*; +/// A Reconstructor trait for expressions in the AST. pub trait ExpressionReconstructor { type AdditionalOutput: Default; @@ -108,6 +109,7 @@ pub trait ExpressionReconstructor { } } +/// A Reconstructor trait for statements in the AST. pub trait StatementReconstructor: ExpressionReconstructor { fn reconstruct_statement(&mut self, input: Statement) -> Statement { match input { @@ -207,6 +209,7 @@ pub trait StatementReconstructor: ExpressionReconstructor { } } +/// A Reconstructor trait for the program represented by the AST. pub trait ProgramReconstructor: StatementReconstructor { fn reconstruct_program(&mut self, input: Program) -> Program { Program { diff --git a/compiler/ast/src/passes/visitor.rs b/compiler/ast/src/passes/visitor.rs index d2a07abe4a..3a1b0b3d18 100644 --- a/compiler/ast/src/passes/visitor.rs +++ b/compiler/ast/src/passes/visitor.rs @@ -20,6 +20,7 @@ use crate::*; +/// A Visitor trait for expressions in the AST. pub trait ExpressionVisitor<'a> { type AdditionalInput: Default; type Output: Default; @@ -88,6 +89,7 @@ pub trait ExpressionVisitor<'a> { } } +/// A Visitor trait for statements in the AST. pub trait StatementVisitor<'a>: ExpressionVisitor<'a> { fn visit_statement(&mut self, input: &'a Statement) { match input { @@ -145,6 +147,7 @@ pub trait StatementVisitor<'a>: ExpressionVisitor<'a> { } } +/// A Visitor trait for the program represented by the AST. pub trait ProgramVisitor<'a>: StatementVisitor<'a> { fn visit_program(&mut self, input: &'a Program) { input