From 2e24197ea297b2a9a9f4a3026dce085de34ee751 Mon Sep 17 00:00:00 2001 From: collin Date: Tue, 7 Jul 2020 19:11:26 -0700 Subject: [PATCH] create value module --- compiler/src/compiler.rs | 3 ++- compiler/src/constraints/boolean.rs | 2 +- compiler/src/constraints/expression.rs | 3 +-- compiler/src/constraints/field.rs | 2 +- compiler/src/constraints/function.rs | 2 +- compiler/src/constraints/mod.rs | 3 --- compiler/src/constraints/program.rs | 2 +- compiler/src/constraints/statement.rs | 3 ++- compiler/src/definitions/definitions.rs | 3 ++- compiler/src/lib.rs | 3 +++ compiler/src/value/mod.rs | 2 ++ compiler/src/{constraints => value}/value.rs | 0 12 files changed, 16 insertions(+), 12 deletions(-) create mode 100644 compiler/src/value/mod.rs rename compiler/src/{constraints => value}/value.rs (100%) diff --git a/compiler/src/compiler.rs b/compiler/src/compiler.rs index d0a938aef2..b84d23016d 100644 --- a/compiler/src/compiler.rs +++ b/compiler/src/compiler.rs @@ -1,8 +1,9 @@ //! Compiles a Leo program from a file path. use crate::{ - constraints::{generate_constraints, generate_test_constraints, ConstrainedValue}, + constraints::{generate_constraints, generate_test_constraints}, errors::CompilerError, + value::ConstrainedValue, GroupType, ImportedPrograms, }; diff --git a/compiler/src/constraints/boolean.rs b/compiler/src/constraints/boolean.rs index 764f548628..0aa6273815 100644 --- a/compiler/src/constraints/boolean.rs +++ b/compiler/src/constraints/boolean.rs @@ -1,6 +1,6 @@ //! Methods to enforce constraints on booleans in a resolved Leo program. -use crate::{constraints::ConstrainedValue, errors::BooleanError, GroupType}; +use crate::{errors::BooleanError, value::ConstrainedValue, GroupType}; use leo_types::{InputValue, Span}; use snarkos_errors::gadgets::SynthesisError; diff --git a/compiler/src/constraints/expression.rs b/compiler/src/constraints/expression.rs index b2a4d21d0a..789ca637fe 100644 --- a/compiler/src/constraints/expression.rs +++ b/compiler/src/constraints/expression.rs @@ -5,11 +5,10 @@ use crate::{ constraints::{ boolean::{enforce_and, enforce_or, evaluate_not, new_bool_constant}, new_scope, - ConstrainedCircuitMember, ConstrainedProgram, - ConstrainedValue, }, errors::ExpressionError, + value::{ConstrainedCircuitMember, ConstrainedValue}, Address, FieldType, GroupType, diff --git a/compiler/src/constraints/field.rs b/compiler/src/constraints/field.rs index fe036a1e95..5e980ee455 100644 --- a/compiler/src/constraints/field.rs +++ b/compiler/src/constraints/field.rs @@ -1,6 +1,6 @@ //! Methods to enforce constraints on field elements in a resolved Leo program. -use crate::{constraints::ConstrainedValue, errors::FieldError, FieldType, GroupType}; +use crate::{errors::FieldError, value::ConstrainedValue, FieldType, GroupType}; use leo_types::{InputValue, Span}; use snarkos_errors::gadgets::SynthesisError; diff --git a/compiler/src/constraints/function.rs b/compiler/src/constraints/function.rs index 0b84d74f92..1746e7e7f8 100644 --- a/compiler/src/constraints/function.rs +++ b/compiler/src/constraints/function.rs @@ -9,9 +9,9 @@ use crate::{ group::group_from_input, new_scope, ConstrainedProgram, - ConstrainedValue, }, errors::{FunctionError, StatementError}, + value::ConstrainedValue, GroupType, Integer, }; diff --git a/compiler/src/constraints/mod.rs b/compiler/src/constraints/mod.rs index 12e677f9c6..17ff9424bf 100644 --- a/compiler/src/constraints/mod.rs +++ b/compiler/src/constraints/mod.rs @@ -24,8 +24,5 @@ pub mod group; pub mod program; pub use self::program::*; -pub mod value; -pub use self::value::*; - pub mod statement; pub use self::statement::*; diff --git a/compiler/src/constraints/program.rs b/compiler/src/constraints/program.rs index 338d46e201..c8f97cf0ae 100644 --- a/compiler/src/constraints/program.rs +++ b/compiler/src/constraints/program.rs @@ -1,6 +1,6 @@ //! An in memory store to keep track of defined names when constraining a Leo program. -use crate::{constraints::ConstrainedValue, GroupType}; +use crate::{value::ConstrainedValue, GroupType}; use snarkos_models::curves::{Field, PrimeField}; diff --git a/compiler/src/constraints/statement.rs b/compiler/src/constraints/statement.rs index 17974bfda9..34abf3f094 100644 --- a/compiler/src/constraints/statement.rs +++ b/compiler/src/constraints/statement.rs @@ -1,9 +1,10 @@ //! Methods to enforce constraints on statements in a resolved Leo program. use crate::{ - constraints::{ConstrainedProgram, ConstrainedValue}, + constraints::ConstrainedProgram, errors::{StatementError, ValueError}, new_scope, + value::ConstrainedValue, GroupType, Integer, }; diff --git a/compiler/src/definitions/definitions.rs b/compiler/src/definitions/definitions.rs index 7d0712a7d2..e9887950b4 100644 --- a/compiler/src/definitions/definitions.rs +++ b/compiler/src/definitions/definitions.rs @@ -1,6 +1,7 @@ use crate::{ - constraints::{new_scope, ConstrainedProgram, ConstrainedValue}, + constraints::{new_scope, ConstrainedProgram}, errors::ImportError, + value::ConstrainedValue, GroupType, ImportedPrograms, }; diff --git a/compiler/src/lib.rs b/compiler/src/lib.rs index 727c7ee53b..9bac2e27c4 100644 --- a/compiler/src/lib.rs +++ b/compiler/src/lib.rs @@ -23,3 +23,6 @@ pub use self::group::*; pub mod imports; pub use self::imports::*; + +pub mod value; +pub use self::value::*; diff --git a/compiler/src/value/mod.rs b/compiler/src/value/mod.rs new file mode 100644 index 0000000000..4bf21dbbeb --- /dev/null +++ b/compiler/src/value/mod.rs @@ -0,0 +1,2 @@ +pub mod value; +pub use self::value::*; diff --git a/compiler/src/constraints/value.rs b/compiler/src/value/value.rs similarity index 100% rename from compiler/src/constraints/value.rs rename to compiler/src/value/value.rs