mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-04-23 08:28:00 +00:00
use normal style for comments
Signed-off-by: xermicus <cyrill@parity.io>
This commit is contained in:
@@ -1,10 +1,6 @@
|
||||
//!
|
||||
//! The debug IR type.
|
||||
//!
|
||||
|
||||
///
|
||||
/// The debug IR type.
|
||||
///
|
||||
#[allow(non_camel_case_types)]
|
||||
#[allow(clippy::upper_case_acronyms)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
@@ -24,9 +20,7 @@ pub enum IRType {
|
||||
}
|
||||
|
||||
impl IRType {
|
||||
///
|
||||
/// Returns the file extension for the specified IR.
|
||||
///
|
||||
pub fn file_extension(&self) -> &'static str {
|
||||
match self {
|
||||
Self::Yul => revive_common::EXTENSION_YUL,
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
//!
|
||||
//! The debug configuration.
|
||||
//!
|
||||
|
||||
pub mod ir_type;
|
||||
|
||||
@@ -11,9 +9,7 @@ use serde::Serialize;
|
||||
|
||||
use self::ir_type::IRType;
|
||||
|
||||
///
|
||||
/// The debug configuration.
|
||||
///
|
||||
#[derive(Debug, Default, Serialize, Deserialize, Clone)]
|
||||
pub struct DebugConfig {
|
||||
/// The directory to dump the IRs to.
|
||||
@@ -21,16 +17,12 @@ pub struct DebugConfig {
|
||||
}
|
||||
|
||||
impl DebugConfig {
|
||||
///
|
||||
/// A shortcut constructor.
|
||||
///
|
||||
pub fn new(output_directory: PathBuf) -> Self {
|
||||
Self { output_directory }
|
||||
}
|
||||
|
||||
///
|
||||
/// Dumps the Yul IR.
|
||||
///
|
||||
pub fn dump_yul(&self, contract_path: &str, code: &str) -> anyhow::Result<()> {
|
||||
let mut file_path = self.output_directory.to_owned();
|
||||
let full_file_name = Self::full_file_name(contract_path, None, IRType::Yul);
|
||||
@@ -40,9 +32,7 @@ impl DebugConfig {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
///
|
||||
/// Dumps the EVM legacy assembly IR.
|
||||
///
|
||||
pub fn dump_evmla(&self, contract_path: &str, code: &str) -> anyhow::Result<()> {
|
||||
let mut file_path = self.output_directory.to_owned();
|
||||
let full_file_name = Self::full_file_name(contract_path, None, IRType::EVMLA);
|
||||
@@ -52,9 +42,7 @@ impl DebugConfig {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
///
|
||||
/// Dumps the Ethereal IR.
|
||||
///
|
||||
pub fn dump_ethir(&self, contract_path: &str, code: &str) -> anyhow::Result<()> {
|
||||
let mut file_path = self.output_directory.to_owned();
|
||||
let full_file_name = Self::full_file_name(contract_path, None, IRType::EthIR);
|
||||
@@ -64,9 +52,7 @@ impl DebugConfig {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
///
|
||||
/// Dumps the LLL IR.
|
||||
///
|
||||
pub fn dump_lll(&self, contract_path: &str, code: &str) -> anyhow::Result<()> {
|
||||
let mut file_path = self.output_directory.to_owned();
|
||||
let full_file_name = Self::full_file_name(contract_path, None, IRType::LLL);
|
||||
@@ -76,9 +62,7 @@ impl DebugConfig {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
///
|
||||
/// Dumps the unoptimized LLVM IR.
|
||||
///
|
||||
pub fn dump_llvm_ir_unoptimized(
|
||||
&self,
|
||||
contract_path: &str,
|
||||
@@ -94,9 +78,7 @@ impl DebugConfig {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
///
|
||||
/// Dumps the optimized LLVM IR.
|
||||
///
|
||||
pub fn dump_llvm_ir_optimized(
|
||||
&self,
|
||||
contract_path: &str,
|
||||
@@ -112,9 +94,7 @@ impl DebugConfig {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
///
|
||||
/// Dumps the assembly.
|
||||
///
|
||||
pub fn dump_assembly(&self, contract_path: &str, code: &str) -> anyhow::Result<()> {
|
||||
let mut file_path = self.output_directory.to_owned();
|
||||
let full_file_name = Self::full_file_name(contract_path, None, IRType::Assembly);
|
||||
@@ -124,9 +104,7 @@ impl DebugConfig {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
///
|
||||
/// Creates a full file name, given the contract full path, suffix, and extension.
|
||||
///
|
||||
fn full_file_name(contract_path: &str, suffix: Option<&str>, ir_type: IRType) -> String {
|
||||
let mut full_file_name = contract_path.replace('/', "_").replace(':', ".");
|
||||
if let Some(suffix) = suffix {
|
||||
|
||||
Reference in New Issue
Block a user