flatten asg-passes

This commit is contained in:
Protryon 2021-03-10 09:57:27 -08:00
parent 823f113149
commit b28f8db4f5
8 changed files with 43 additions and 25 deletions

16
Cargo.lock generated
View File

@ -1204,6 +1204,13 @@ dependencies = [
"typed-arena",
]
[[package]]
name = "leo-asg-passes"
version = "1.2.3"
dependencies = [
"leo-asg",
]
[[package]]
name = "leo-ast"
version = "1.2.3"
@ -1225,8 +1232,8 @@ dependencies = [
"hex",
"indexmap",
"leo-asg",
"leo-asg-passes",
"leo-ast",
"leo-constant-folding",
"leo-gadgets",
"leo-imports",
"leo-input",
@ -1251,13 +1258,6 @@ dependencies = [
"tracing",
]
[[package]]
name = "leo-constant-folding"
version = "1.2.3"
dependencies = [
"leo-asg",
]
[[package]]
name = "leo-gadgets"
version = "1.2.3"

View File

@ -37,7 +37,7 @@ members = [
"parser",
"state",
"synthesizer",
"asg-passes/constant-folding",
"asg-passes",
]
[dependencies.leo-ast]

View File

@ -1,5 +1,5 @@
[package]
name = "leo-constant-folding"
name = "leo-asg-passes"
version = "1.2.3"
authors = [ "The Aleo Team <hello@aleo.org>" ]
description = "The Leo programming language"
@ -21,5 +21,5 @@ edition = "2018"
path = "src/lib.rs"
[dependencies.leo-asg]
path = "../../asg"
path = "../asg"
version = "1.2.3"

18
asg-passes/src/lib.rs Normal file
View File

@ -0,0 +1,18 @@
// Copyright (C) 2019-2021 Aleo Systems Inc.
// This file is part of the Leo library.
// The Leo library is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// The Leo library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
pub mod constant_folding;
pub use constant_folding::*;

View File

@ -49,8 +49,8 @@ version = "1.2.3"
path = "../parser"
version = "1.2.3"
[dependencies.leo-constant-folding]
path = "../asg-passes/constant-folding"
[dependencies.leo-asg-passes]
path = "../asg-passes"
version = "1.2.3"
[dependencies.snarkvm-curves]

View File

@ -261,7 +261,7 @@ impl<'a, F: PrimeField, G: GroupType<F>> Compiler<'a, F, G> {
fn do_asg_passes(&self) -> Result<(), FormattedError> {
assert!(self.asg.is_some());
if self.options.constant_folding_enabled {
leo_constant_folding::ConstantFolding::do_pass(self.asg.as_ref().unwrap().as_repr())?;
leo_asg_passes::ConstantFolding::do_pass(self.asg.as_ref().unwrap().as_repr())?;
}
Ok(())

View File

@ -26,38 +26,38 @@ extern crate thiserror;
pub mod compiler;
pub mod console;
pub use self::console::*;
pub use console::*;
pub mod constraints;
pub use self::constraints::*;
pub use constraints::*;
pub mod definition;
pub mod errors;
pub mod expression;
pub use self::expression::*;
pub use expression::*;
pub mod function;
pub use self::function::*;
pub use function::*;
pub mod output;
pub use self::output::*;
pub use output::*;
pub mod program;
pub use self::program::*;
pub use program::*;
pub mod statement;
pub use self::statement::*;
pub use statement::*;
pub mod prelude;
pub use self::prelude::*;
pub use prelude::*;
pub mod value;
pub use self::value::*;
pub use value::*;
pub mod stage;
pub use self::stage::*;
pub use stage::*;
pub mod option;
pub use self::option::*;
pub use option::*;