From 7a0827af4803bb487133b6d2bc19c42a3fad1a9a Mon Sep 17 00:00:00 2001 From: collin Date: Wed, 8 Jul 2020 03:18:30 -0700 Subject: [PATCH] refactor errors module --- compiler/src/errors/constraints/mod.rs | 30 ------------------- .../errors/{constraints => }/expression.rs | 0 .../src/errors/{constraints => }/function.rs | 0 .../src/errors/{constraints => }/import.rs | 0 compiler/src/errors/mod.rs | 16 ++++++++-- .../src/errors/{constraints => }/statement.rs | 0 .../errors/{constraints => value}/address.rs | 0 .../errors/{constraints => value}/boolean.rs | 0 .../errors/{constraints => value}/field.rs | 0 .../errors/{constraints => value}/group.rs | 0 .../errors/{constraints => value}/integer.rs | 0 compiler/src/errors/value/mod.rs | 17 +++++++++++ .../errors/{constraints => value}/value.rs | 0 compiler/src/import/parser/parse_package.rs | 2 +- compiler/src/import/parser/parse_symbol.rs | 2 +- 15 files changed, 33 insertions(+), 34 deletions(-) delete mode 100644 compiler/src/errors/constraints/mod.rs rename compiler/src/errors/{constraints => }/expression.rs (100%) rename compiler/src/errors/{constraints => }/function.rs (100%) rename compiler/src/errors/{constraints => }/import.rs (100%) rename compiler/src/errors/{constraints => }/statement.rs (100%) rename compiler/src/errors/{constraints => value}/address.rs (100%) rename compiler/src/errors/{constraints => value}/boolean.rs (100%) rename compiler/src/errors/{constraints => value}/field.rs (100%) rename compiler/src/errors/{constraints => value}/group.rs (100%) rename compiler/src/errors/{constraints => value}/integer.rs (100%) create mode 100644 compiler/src/errors/value/mod.rs rename compiler/src/errors/{constraints => value}/value.rs (100%) diff --git a/compiler/src/errors/constraints/mod.rs b/compiler/src/errors/constraints/mod.rs deleted file mode 100644 index 738e8681c5..0000000000 --- a/compiler/src/errors/constraints/mod.rs +++ /dev/null @@ -1,30 +0,0 @@ -//! Module containing errors returned when enforcing constraints in an Leo program -pub mod address; -pub use self::address::*; - -pub mod boolean; -pub use self::boolean::*; - -pub mod function; -pub use self::function::*; - -pub mod expression; -pub use self::expression::*; - -pub mod import; -pub use self::import::*; - -pub mod integer; -pub use integer::*; - -pub mod field; -pub use self::field::*; - -pub mod group; -pub use self::group::*; - -pub mod value; -pub use self::value::*; - -pub mod statement; -pub use self::statement::*; diff --git a/compiler/src/errors/constraints/expression.rs b/compiler/src/errors/expression.rs similarity index 100% rename from compiler/src/errors/constraints/expression.rs rename to compiler/src/errors/expression.rs diff --git a/compiler/src/errors/constraints/function.rs b/compiler/src/errors/function.rs similarity index 100% rename from compiler/src/errors/constraints/function.rs rename to compiler/src/errors/function.rs diff --git a/compiler/src/errors/constraints/import.rs b/compiler/src/errors/import.rs similarity index 100% rename from compiler/src/errors/constraints/import.rs rename to compiler/src/errors/import.rs diff --git a/compiler/src/errors/mod.rs b/compiler/src/errors/mod.rs index 91d6712541..2f97fbe06f 100644 --- a/compiler/src/errors/mod.rs +++ b/compiler/src/errors/mod.rs @@ -1,5 +1,17 @@ pub mod compiler; pub use self::compiler::*; -pub mod constraints; -pub use self::constraints::*; +pub mod expression; +pub use self::expression::*; + +pub mod function; +pub use self::function::*; + +pub mod import; +pub use self::import::*; + +pub mod statement; +pub use self::statement::*; + +pub mod value; +pub use self::value::*; diff --git a/compiler/src/errors/constraints/statement.rs b/compiler/src/errors/statement.rs similarity index 100% rename from compiler/src/errors/constraints/statement.rs rename to compiler/src/errors/statement.rs diff --git a/compiler/src/errors/constraints/address.rs b/compiler/src/errors/value/address.rs similarity index 100% rename from compiler/src/errors/constraints/address.rs rename to compiler/src/errors/value/address.rs diff --git a/compiler/src/errors/constraints/boolean.rs b/compiler/src/errors/value/boolean.rs similarity index 100% rename from compiler/src/errors/constraints/boolean.rs rename to compiler/src/errors/value/boolean.rs diff --git a/compiler/src/errors/constraints/field.rs b/compiler/src/errors/value/field.rs similarity index 100% rename from compiler/src/errors/constraints/field.rs rename to compiler/src/errors/value/field.rs diff --git a/compiler/src/errors/constraints/group.rs b/compiler/src/errors/value/group.rs similarity index 100% rename from compiler/src/errors/constraints/group.rs rename to compiler/src/errors/value/group.rs diff --git a/compiler/src/errors/constraints/integer.rs b/compiler/src/errors/value/integer.rs similarity index 100% rename from compiler/src/errors/constraints/integer.rs rename to compiler/src/errors/value/integer.rs diff --git a/compiler/src/errors/value/mod.rs b/compiler/src/errors/value/mod.rs new file mode 100644 index 0000000000..52b6c802d1 --- /dev/null +++ b/compiler/src/errors/value/mod.rs @@ -0,0 +1,17 @@ +pub mod address; +pub use self::address::*; + +pub mod boolean; +pub use self::boolean::*; + +pub mod field; +pub use self::field::*; + +pub mod group; +pub use self::group::*; + +pub mod integer; +pub use self::integer::*; + +pub mod value; +pub use self::value::*; diff --git a/compiler/src/errors/constraints/value.rs b/compiler/src/errors/value/value.rs similarity index 100% rename from compiler/src/errors/constraints/value.rs rename to compiler/src/errors/value/value.rs diff --git a/compiler/src/import/parser/parse_package.rs b/compiler/src/import/parser/parse_package.rs index b8ffe54ce4..c0f78000ef 100644 --- a/compiler/src/import/parser/parse_package.rs +++ b/compiler/src/import/parser/parse_package.rs @@ -1,4 +1,4 @@ -use crate::{errors::constraints::ImportError, ImportParser}; +use crate::{errors::ImportError, ImportParser}; use leo_types::{Package, PackageAccess}; use std::{fs, fs::DirEntry, path::PathBuf}; diff --git a/compiler/src/import/parser/parse_symbol.rs b/compiler/src/import/parser/parse_symbol.rs index 1821303ec7..08a6d0b65d 100644 --- a/compiler/src/import/parser/parse_symbol.rs +++ b/compiler/src/import/parser/parse_symbol.rs @@ -1,4 +1,4 @@ -use crate::{errors::constraints::ImportError, ImportParser}; +use crate::{errors::ImportError, ImportParser}; use leo_ast::LeoParser; use leo_types::{ImportSymbol, Program, Span};