diff --git a/compiler/ast/src/passes/reconstructor.rs b/compiler/ast/src/passes/reconstructor.rs index b72b8f0033..60515c5786 100644 --- a/compiler/ast/src/passes/reconstructor.rs +++ b/compiler/ast/src/passes/reconstructor.rs @@ -315,7 +315,7 @@ pub trait ProgramReconstructor: StatementReconstructor { imports: input .imports .into_iter() - .map(|(id, import)| (id, self.reconstruct_import(import))) + .map(|(id, import)| (id, (self.reconstruct_import(import.0), import.1))) .collect(), program_scopes: input .program_scopes diff --git a/compiler/ast/src/passes/visitor.rs b/compiler/ast/src/passes/visitor.rs index 7ea7530920..73de6e5c2a 100644 --- a/compiler/ast/src/passes/visitor.rs +++ b/compiler/ast/src/passes/visitor.rs @@ -193,7 +193,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.imports.values().for_each(|import| self.visit_import(import)); + input.imports.values().for_each(|import| self.visit_import(&import.0)); input .program_scopes diff --git a/compiler/ast/src/program/mod.rs b/compiler/ast/src/program/mod.rs index c5f0d6aed7..6a8292056c 100644 --- a/compiler/ast/src/program/mod.rs +++ b/compiler/ast/src/program/mod.rs @@ -24,6 +24,8 @@ pub use program_scope::*; use crate::Identifier; +use leo_span::Span; + use indexmap::IndexMap; use serde::{Deserialize, Serialize}; use std::fmt; @@ -32,7 +34,7 @@ use std::fmt; #[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] pub struct Program { /// A map from import names to import definitions. - pub imports: IndexMap, + pub imports: IndexMap, /// A map from program names to program scopes. pub program_scopes: IndexMap, }