mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-11-10 13:24:15 +03:00
Add span associated with the import statement to ast
This commit is contained in:
parent
3c2da076ff
commit
41a8bc5a73
@ -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
|
||||
|
@ -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
|
||||
|
@ -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<Identifier, Program>,
|
||||
pub imports: IndexMap<Identifier, (Program, Span)>,
|
||||
/// A map from program names to program scopes.
|
||||
pub program_scopes: IndexMap<ProgramId, ProgramScope>,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user