Use IndexMap throughout

In an ideal world, I should have handlded that directly at the conflicting commit in the rebase, but this would have bubbled up through all commits... which I wasn't really quite keen on going through. So here's an extra ugly commit that comes and 'fix the rebase'.
This commit is contained in:
KtorZ
2023-01-29 13:30:58 +01:00
parent 90ee86d14e
commit 22a1c1dfb4
5 changed files with 25 additions and 21 deletions

View File

@@ -166,6 +166,7 @@ mod test {
IdGenerator,
};
use assert_json_diff::assert_json_eq;
use indexmap::IndexMap;
use serde_json::{self, json};
use std::{collections::HashMap, path::PathBuf};
@@ -176,8 +177,8 @@ mod test {
package: PackageName,
id_gen: IdGenerator,
module_types: HashMap<String, TypeInfo>,
functions: HashMap<FunctionAccessKey, TypedFunction>,
data_types: HashMap<DataTypeKey, TypedDataType>,
functions: IndexMap<FunctionAccessKey, TypedFunction>,
data_types: IndexMap<DataTypeKey, TypedDataType>,
}
impl TestProject {

View File

@@ -65,8 +65,8 @@ where
sources: Vec<Source>,
pub warnings: Vec<Warning>,
event_listener: T,
functions: HashMap<FunctionAccessKey, TypedFunction>,
data_types: HashMap<DataTypeKey, TypedDataType>,
functions: IndexMap<FunctionAccessKey, TypedFunction>,
data_types: IndexMap<DataTypeKey, TypedDataType>,
}
impl<T> Project<T>

View File

@@ -9,6 +9,7 @@ use aiken_lang::{
uplc::CodeGenerator,
VALIDATOR_NAMES,
};
use indexmap::IndexMap;
use petgraph::{algo, graph::NodeIndex, Direction, Graph};
use std::{
collections::{HashMap, HashSet},
@@ -272,16 +273,16 @@ impl CheckedModules {
pub fn new_generator<'a>(
&'a self,
builtin_functions: &'a HashMap<FunctionAccessKey, TypedFunction>,
builtin_data_types: &'a HashMap<DataTypeKey, TypedDataType>,
builtin_functions: &'a IndexMap<FunctionAccessKey, TypedFunction>,
builtin_data_types: &'a IndexMap<DataTypeKey, TypedDataType>,
module_types: &'a HashMap<String, TypeInfo>,
) -> CodeGenerator<'a> {
let mut functions = HashMap::new();
let mut functions = IndexMap::new();
for (k, v) in builtin_functions {
functions.insert(k.clone(), v);
}
let mut data_types = HashMap::new();
let mut data_types = IndexMap::new();
for (k, v) in builtin_data_types {
data_types.insert(k.clone(), v);
}
@@ -316,7 +317,11 @@ impl CheckedModules {
}
}
}
CodeGenerator::new(functions, data_types, module_types)
let mut module_types_index = IndexMap::new();
module_types_index.extend(module_types);
CodeGenerator::new(functions, data_types, module_types_index)
}
}