Skip to content

Commit

Permalink
Minor fix and new test
Browse files Browse the repository at this point in the history
  • Loading branch information
gzanitti committed Nov 8, 2023
1 parent a549703 commit 91a797e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions etk-asm/src/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ mod error {

pub use self::error::Error;
use crate::ops::expression::Error::{UndefinedVariable, UnknownLabel, UnknownMacro};
use crate::ops::{self, AbstractOp, Assemble, Expression, Imm, MacroDefinition};
use crate::ops::{self, AbstractOp, Assemble, Expression, MacroDefinition};
use rand::Rng;
use std::cmp;
use std::collections::{hash_map, HashMap};
Expand Down Expand Up @@ -187,7 +187,7 @@ impl From<Vec<u8>> for RawOp {
/// #
/// # use hex_literal::hex;
/// let mut asm = Assembler::new();
/// let code = ec![AbstractOp::new(GetPc)]
/// let code = vec![AbstractOp::new(GetPc)];
/// let result = asm.assemble(&code)?;
/// # assert_eq!(result, hex!("58"));
/// # Result::<(), Error>::Ok(())
Expand Down Expand Up @@ -349,7 +349,7 @@ impl Assembler {
/// Feed a single instruction into the `Assembler`.
fn push<O>(&mut self, rop: &O) -> Result<usize, Error>
where
O: Into<RawOp> + Clone,
O: Into<RawOp> + Clone, //TODO: Remove clone and fix code
{
//let rop = rop.into();
let rop = rop.clone().into();
Expand Down Expand Up @@ -410,7 +410,7 @@ impl Assembler {
.fail()
}
Err(ops::Error::ContextIncomplete {
source: UnknownLabel { label: _label, .. },
source: UnknownLabel { label, .. },
}) => {
let mut dynamic_push = false;
if let AbstractOp::Push(_) = op {
Expand All @@ -421,7 +421,7 @@ impl Assembler {
}

self.undeclared_labels.push(PendingLabel {
label: _label.to_owned(),
label,
position: self.ready.len(),
dynamic_push,
});
Expand Down
2 changes: 1 addition & 1 deletion etk-asm/tests/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ fn test_dynamic_push2() -> Result<(), Error> {

println!("{:x?}", output);
println!("{:?}", output);
assert_eq!(output, hex!("61010058"));
assert_eq!(output, hex!("61010158"));

Ok(())
}

0 comments on commit 91a797e

Please sign in to comment.