Skip to main content

oxilean_codegen/evm_backend/
yulstmt_traits.rs

1//! # YulStmt - Trait Implementations
2//!
3//! This module contains trait implementations for `YulStmt`.
4//!
5//! ## Implemented Traits
6//!
7//! - `Display`
8//!
9//! 🤖 Generated with [SplitRS](https://github.com/cool-japan/splitrs)
10
11use super::types::YulStmt;
12use std::fmt;
13
14impl std::fmt::Display for YulStmt {
15    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
16        match self {
17            YulStmt::Let(vars, Some(val)) => {
18                write!(f, "let {} := {}", vars.join(", "), val)
19            }
20            YulStmt::Let(vars, None) => write!(f, "let {}", vars.join(", ")),
21            YulStmt::Assign(vars, val) => write!(f, "{} := {}", vars.join(", "), val),
22            YulStmt::Break => write!(f, "break"),
23            YulStmt::Continue => write!(f, "continue"),
24            YulStmt::Leave => write!(f, "leave"),
25            YulStmt::Return(p, s) => write!(f, "return({}, {})", p, s),
26            YulStmt::Revert(p, s) => write!(f, "revert({}, {})", p, s),
27            YulStmt::Pop(e) => write!(f, "pop({})", e),
28            YulStmt::Expr(e) => write!(f, "{}", e),
29            _ => write!(f, "/* yul */"),
30        }
31    }
32}