diff options
Diffstat (limited to 'src/stages/bytecode.rs')
-rw-r--r-- | src/stages/bytecode.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/stages/bytecode.rs b/src/stages/bytecode.rs index f0b99df..02cc739 100644 --- a/src/stages/bytecode.rs +++ b/src/stages/bytecode.rs @@ -1,6 +1,6 @@ use crate::*; -use std::collections::HashMap; +use indexmap::IndexMap; /// Doesn't truncate trailing null bytes. @@ -22,8 +22,8 @@ pub fn generate_bytecode(semantic: &Program) -> Result<AssembledProgram, Vec<Tra pub struct BytecodeGenerator<'a> { - definitions: &'a HashMap<String, Tracked<Definition>>, - labels: HashMap<String, LabelInformation>, + definitions: &'a IndexMap<String, Tracked<Definition>>, + labels: IndexMap<String, LabelInformation>, stack: Vec<usize>, bytecode: Vec<u8>, errors: Vec<Tracked<BytecodeError>>, @@ -35,8 +35,8 @@ struct LabelInformation { } impl<'a> BytecodeGenerator<'a> { - pub fn new(definitions: &'a HashMap<String, Tracked<Definition>>) -> Self { - let mut labels = HashMap::new(); + pub fn new(definitions: &'a IndexMap<String, Tracked<Definition>>) -> Self { + let mut labels = IndexMap::new(); for (name, definition) in definitions { if let DefinitionVariant::LabelDefinition = definition.variant { // Use fake address for now. |