Refactor: simplify bad code

This commit is contained in:
Adam Chalmers
2024-01-25 08:25:03 +11:00
parent c2d3808f7c
commit 4fa9eb4a0e
2 changed files with 4 additions and 8 deletions

View File

@ -427,8 +427,7 @@ impl Planner {
KclValueGroup::Single(init_value) => { KclValueGroup::Single(init_value) => {
// Simple! Just evaluate it, note where the final value will be stored in KCEP memory, // Simple! Just evaluate it, note where the final value will be stored in KCEP memory,
// and bind it to the KCL identifier. // and bind it to the KCL identifier.
let EvalPlan { instructions, binding } = self.plan_to_compute_single(ctx, init_value)?; self.plan_to_compute_single(ctx, init_value)
Ok(EvalPlan { instructions, binding })
} }
KclValueGroup::ArrayExpression(expr) => { KclValueGroup::ArrayExpression(expr) => {
let length_at = self.next_addr.offset_by(1); let length_at = self.next_addr.offset_by(1);

View File

@ -707,14 +707,11 @@ fn store_object() {
assert_eq!( assert_eq!(
bindings.get("x0").unwrap(), bindings.get("x0").unwrap(),
&EpBinding::Map(HashMap::from([ &EpBinding::Map(HashMap::from([
("a".to_owned(), EpBinding::Single(Address::ZERO),), ("a".to_owned(), EpBinding::Single(Address::ZERO)),
("b".to_owned(), EpBinding::Single(Address::ZERO.offset(1))), ("b".to_owned(), EpBinding::Single(Address::ZERO + 1)),
( (
"c".to_owned(), "c".to_owned(),
EpBinding::Map(HashMap::from([( EpBinding::Map(HashMap::from([("d".to_owned(), EpBinding::Single(Address::ZERO + 2))]))
"d".to_owned(),
EpBinding::Single(Address::ZERO.offset(2))
)]))
), ),
])) ]))
) )