Skip to content

Commit

Permalink
fix: add missing leaf span collection for final_expr_opt of asm blocks (
Browse files Browse the repository at this point in the history
  • Loading branch information
kayagokalp authored Oct 14, 2022
1 parent f4ea752 commit a9eaef2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion examples/asm_return_tuple_pointer/src/main.sw
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fn adder(a: u64, b: u64, c: u64) -> (u64, u64) {
}

fn main() -> bool {
let(first, second) = adder(1, 2, 3);
let (first, second) = adder(1, 2, 3);
assert(first == 3);
assert(second == 5);
true
Expand Down
3 changes: 3 additions & 0 deletions swayfmt/src/utils/language/expr/asm_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@ impl LeafSpans for AsmBlockContents {
for instruction in &self.instructions {
collected_spans.append(&mut instruction.leaf_spans());
}
if let Some(final_expr) = &self.final_expr_opt {
collected_spans.append(&mut final_expr.leaf_spans());
}
collected_spans
}
}
Expand Down

0 comments on commit a9eaef2

Please sign in to comment.