diff --git a/Cargo.lock b/Cargo.lock index d04a8d65f7..7a4b8c47b5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -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", diff --git a/compiler/Cargo.toml b/compiler/Cargo.toml index cbf0636741..fe242bf7d0 100644 --- a/compiler/Cargo.toml +++ b/compiler/Cargo.toml @@ -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" diff --git a/compiler/src/function/input/input_section.rs b/compiler/src/function/input/input_section.rs index 88b3e77da6..c33bc39636 100644 --- a/compiler/src/function/input/input_section.rs +++ b/compiler/src/function/input/input_section.rs @@ -15,20 +15,21 @@ // along with the Leo library. If not, see . 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> ConstrainedProgram { pub fn allocate_input_section>( &mut self, cs: &mut CS, identifier: Identifier, - section: HashMap>, + section: IndexMap>, ) -> Result, FunctionError> { let mut members = Vec::with_capacity(section.len()); diff --git a/compiler/src/program/program.rs b/compiler/src/program/program.rs index 596c59b23e..75f36f4677 100644 --- a/compiler/src/program/program.rs +++ b/compiler/src/program/program.rs @@ -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> { - pub identifiers: HashMap>, + pub identifiers: IndexMap>, } impl> Default for ConstrainedProgram { fn default() -> Self { Self { - identifiers: HashMap::new(), + identifiers: IndexMap::new(), } } } diff --git a/symbol-table/src/types/circuits/circuit.rs b/symbol-table/src/types/circuits/circuit.rs index 688f35f4c0..53ca088aad 100644 --- a/symbol-table/src/types/circuits/circuit.rs +++ b/symbol-table/src/types/circuits/circuit.rs @@ -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.