This commit is contained in:
collin 2022-07-15 21:00:16 -07:00
parent 914a9c385e
commit 0368b8bd51
4 changed files with 5 additions and 7 deletions

View File

@ -173,10 +173,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));
input
.functions

View File

@ -43,7 +43,7 @@ pub struct Program {
impl fmt::Display for Program {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
for(_, import) in self.imports.iter() {
for (_, import) in self.imports.iter() {
import.fmt(f)?;
writeln!(f,)?;
}

View File

@ -79,7 +79,7 @@ impl ParserContext<'_> {
let leo_file_extension = self.expect_identifier()?;
if leo_file_extension.name.ne(&sym::leo) {
return Err(ParserError::leo_imports_only(leo_file_extension, self.token.span).into())
return Err(ParserError::leo_imports_only(leo_file_extension, self.token.span).into());
}
let end = self.expect(&Token::Semicolon)?;

View File

@ -42,7 +42,8 @@ impl<'a> CodeGenerator<'a> {
}
// Print the program id.
writeln!(program_string, "program {}.{};", input.name, input.network).expect("Failed to write program id to string.");
writeln!(program_string, "program {}.{};", input.name, input.network)
.expect("Failed to write program id to string.");
// Newline separator.
program_string.push('\n');