mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-11-23 15:15:47 +03:00
use index map in compiler module
This commit is contained in:
parent
05effde9b4
commit
1dbdf23d5a
7
Cargo.lock
generated
7
Cargo.lock
generated
@ -1153,6 +1153,7 @@ checksum = "55e2e4c765aa53a0424761bf9f41aa7a6ac1efa87238f59560640e27fca028f2"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"hashbrown",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1299,6 +1300,7 @@ name = "leo-ast"
|
||||
version = "1.0.6"
|
||||
dependencies = [
|
||||
"criterion",
|
||||
"indexmap",
|
||||
"leo-grammar",
|
||||
"leo-input",
|
||||
"pest",
|
||||
@ -1314,6 +1316,7 @@ version = "1.0.6"
|
||||
dependencies = [
|
||||
"bincode",
|
||||
"hex",
|
||||
"indexmap",
|
||||
"leo-ast",
|
||||
"leo-core",
|
||||
"leo-gadgets",
|
||||
@ -1392,6 +1395,7 @@ dependencies = [
|
||||
name = "leo-imports"
|
||||
version = "1.0.6"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"leo-ast",
|
||||
"leo-grammar",
|
||||
"thiserror",
|
||||
@ -1478,6 +1482,7 @@ dependencies = [
|
||||
name = "leo-state"
|
||||
version = "1.0.6"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"leo-ast",
|
||||
"leo-input",
|
||||
"rand",
|
||||
@ -1497,6 +1502,7 @@ dependencies = [
|
||||
name = "leo-symbol-table"
|
||||
version = "1.0.6"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"leo-ast",
|
||||
"leo-core",
|
||||
"leo-grammar",
|
||||
@ -1509,6 +1515,7 @@ dependencies = [
|
||||
name = "leo-type-inference"
|
||||
version = "1.0.6"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"leo-ast",
|
||||
"leo-grammar",
|
||||
"leo-imports",
|
||||
|
@ -90,6 +90,10 @@ version = "1.0"
|
||||
[dependencies.hex]
|
||||
version = "0.4.2"
|
||||
|
||||
[dependencies.indexmap]
|
||||
version = "1.6.0"
|
||||
features = ["serde-1"]
|
||||
|
||||
[dependencies.pest]
|
||||
version = "2.0"
|
||||
|
||||
|
@ -15,20 +15,21 @@
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{errors::FunctionError, ConstrainedCircuitMember, ConstrainedProgram, ConstrainedValue, GroupType};
|
||||
|
||||
use leo_ast::{Identifier, InputValue, Parameter};
|
||||
|
||||
use snarkos_models::{
|
||||
curves::{Field, PrimeField},
|
||||
gadgets::r1cs::ConstraintSystem,
|
||||
};
|
||||
use std::collections::HashMap;
|
||||
|
||||
use indexmap::IndexMap;
|
||||
|
||||
impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G> {
|
||||
pub fn allocate_input_section<CS: ConstraintSystem<F>>(
|
||||
&mut self,
|
||||
cs: &mut CS,
|
||||
identifier: Identifier,
|
||||
section: HashMap<Parameter, Option<InputValue>>,
|
||||
section: IndexMap<Parameter, Option<InputValue>>,
|
||||
) -> Result<ConstrainedValue<F, G>, FunctionError> {
|
||||
let mut members = Vec::with_capacity(section.len());
|
||||
|
||||
|
@ -20,16 +20,16 @@ use crate::{value::ConstrainedValue, GroupType};
|
||||
|
||||
use snarkos_models::curves::{Field, PrimeField};
|
||||
|
||||
use std::collections::HashMap;
|
||||
use indexmap::IndexMap;
|
||||
|
||||
pub struct ConstrainedProgram<F: Field + PrimeField, G: GroupType<F>> {
|
||||
pub identifiers: HashMap<String, ConstrainedValue<F, G>>,
|
||||
pub identifiers: IndexMap<String, ConstrainedValue<F, G>>,
|
||||
}
|
||||
|
||||
impl<F: Field + PrimeField, G: GroupType<F>> Default for ConstrainedProgram<F, G> {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
identifiers: HashMap::new(),
|
||||
identifiers: IndexMap::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,11 +24,10 @@ use crate::{
|
||||
};
|
||||
use leo_ast::{Circuit, CircuitMember, Identifier, InputValue, Parameter, Span};
|
||||
|
||||
use indexmap::IndexMap;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::hash::{Hash, Hasher};
|
||||
|
||||
use indexmap::IndexMap;
|
||||
|
||||
/// Stores circuit definition details.
|
||||
///
|
||||
/// This type should be added to the circuit symbol table for a resolved syntax tree.
|
||||
|
Loading…
Reference in New Issue
Block a user