mirror of
https://github.com/kmc7468/cs420.git
synced 2025-12-16 07:28:52 +00:00
Update
This commit is contained in:
@@ -17,7 +17,6 @@ use ordered_float::OrderedFloat;
|
||||
use std::collections::{BTreeMap, HashMap};
|
||||
use std::hash::{Hash, Hasher};
|
||||
|
||||
use crate::write_base::*;
|
||||
pub use dtype::{Dtype, DtypeError, HasDtype};
|
||||
pub use interp::{interp, Value};
|
||||
pub use parse::Parse;
|
||||
@@ -260,6 +259,16 @@ impl Instruction {
|
||||
}
|
||||
}
|
||||
|
||||
/// Format `lang_c::ast::{Binary,Unary}Operations` into KECC-IR.
|
||||
///
|
||||
/// Most cases, `fmt::Display` is used to format a type to a string. However, in some cases, we
|
||||
/// can't implement `fmt::Display` for a type as it is defined in another crate. In such cases, we
|
||||
/// can implement this trait to format the type to a string.
|
||||
pub trait WriteOp {
|
||||
/// Change operations into a String.
|
||||
fn write_operation(&self) -> String;
|
||||
}
|
||||
|
||||
impl WriteOp for ast::BinaryOperator {
|
||||
fn write_operation(&self) -> String {
|
||||
match self {
|
||||
|
||||
Reference in New Issue
Block a user