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:
@@ -1,9 +1,3 @@
|
||||
use std::{cell::RefCell, collections::HashMap, sync::Arc};
|
||||
|
||||
use strum::IntoEnumIterator;
|
||||
|
||||
use uplc::builtins::DefaultFunction;
|
||||
|
||||
use crate::{
|
||||
ast::{Arg, ArgName, CallArg, Function, ModuleKind, Span, TypedDataType, TypedFunction, UnOp},
|
||||
builder::{DataTypeKey, FunctionAccessKey},
|
||||
@@ -14,6 +8,10 @@ use crate::{
|
||||
},
|
||||
IdGenerator,
|
||||
};
|
||||
use indexmap::IndexMap;
|
||||
use std::{cell::RefCell, collections::HashMap, sync::Arc};
|
||||
use strum::IntoEnumIterator;
|
||||
use uplc::builtins::DefaultFunction;
|
||||
|
||||
pub const BYTE_ARRAY: &str = "ByteArray";
|
||||
pub const BOOL: &str = "Bool";
|
||||
@@ -533,8 +531,8 @@ pub fn from_default_function(
|
||||
})
|
||||
}
|
||||
|
||||
pub fn prelude_functions(id_gen: &IdGenerator) -> HashMap<FunctionAccessKey, TypedFunction> {
|
||||
let mut functions = HashMap::new();
|
||||
pub fn prelude_functions(id_gen: &IdGenerator) -> IndexMap<FunctionAccessKey, TypedFunction> {
|
||||
let mut functions = IndexMap::new();
|
||||
|
||||
// /// Negate the argument. Useful for map/fold and pipelines.
|
||||
// pub fn not(self: Bool) -> Bool {
|
||||
@@ -800,8 +798,8 @@ pub fn prelude_functions(id_gen: &IdGenerator) -> HashMap<FunctionAccessKey, Typ
|
||||
functions
|
||||
}
|
||||
|
||||
pub fn prelude_data_types(id_gen: &IdGenerator) -> HashMap<DataTypeKey, TypedDataType> {
|
||||
let mut data_types = HashMap::new();
|
||||
pub fn prelude_data_types(id_gen: &IdGenerator) -> IndexMap<DataTypeKey, TypedDataType> {
|
||||
let mut data_types = IndexMap::new();
|
||||
|
||||
// Option
|
||||
let option_data_type = TypedDataType::option(generic_var(id_gen.next()));
|
||||
|
||||
@@ -44,7 +44,7 @@ pub struct CodeGenerator<'a> {
|
||||
defined_functions: IndexMap<FunctionAccessKey, ()>,
|
||||
functions: IndexMap<FunctionAccessKey, &'a TypedFunction>,
|
||||
data_types: IndexMap<DataTypeKey, &'a TypedDataType>,
|
||||
module_types: &'a IndexMap<String, TypeInfo>,
|
||||
module_types: IndexMap<&'a String, &'a TypeInfo>,
|
||||
id_gen: IdGenerator,
|
||||
needs_field_access: bool,
|
||||
used_data_assert_on_list: bool,
|
||||
@@ -55,7 +55,7 @@ impl<'a> CodeGenerator<'a> {
|
||||
pub fn new(
|
||||
functions: IndexMap<FunctionAccessKey, &'a TypedFunction>,
|
||||
data_types: IndexMap<DataTypeKey, &'a TypedDataType>,
|
||||
module_types: &'a IndexMap<String, TypeInfo>,
|
||||
module_types: IndexMap<&'a String, &'a TypeInfo>,
|
||||
) -> Self {
|
||||
CodeGenerator {
|
||||
defined_functions: IndexMap::new(),
|
||||
|
||||
Reference in New Issue
Block a user