mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-05-06 02:17:57 +00:00
use normal style for comments
Signed-off-by: xermicus <cyrill@parity.io>
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
//!
|
||||
//! The contract EVM legacy assembly source code.
|
||||
//!
|
||||
|
||||
use std::collections::HashSet;
|
||||
|
||||
@@ -10,9 +8,7 @@ use serde::Serialize;
|
||||
use crate::evmla::assembly::Assembly;
|
||||
use crate::solc::standard_json::output::contract::evm::extra_metadata::ExtraMetadata;
|
||||
|
||||
///
|
||||
/// The contract EVM legacy assembly source code.
|
||||
///
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[allow(non_camel_case_types)]
|
||||
#[allow(clippy::upper_case_acronyms)]
|
||||
@@ -22,17 +18,13 @@ pub struct EVMLA {
|
||||
}
|
||||
|
||||
impl EVMLA {
|
||||
///
|
||||
/// A shortcut constructor.
|
||||
///
|
||||
pub fn new(mut assembly: Assembly, extra_metadata: ExtraMetadata) -> Self {
|
||||
assembly.extra_metadata = Some(extra_metadata);
|
||||
Self { assembly }
|
||||
}
|
||||
|
||||
///
|
||||
/// Get the list of missing deployable libraries.
|
||||
///
|
||||
pub fn get_missing_libraries(&self) -> HashSet<String> {
|
||||
self.assembly.get_missing_libraries()
|
||||
}
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
//!
|
||||
//! The contract LLVM IR source code.
|
||||
//!
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
///
|
||||
/// The contract LLVM IR source code.
|
||||
///
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[allow(clippy::upper_case_acronyms)]
|
||||
pub struct LLVMIR {
|
||||
@@ -18,9 +14,7 @@ pub struct LLVMIR {
|
||||
}
|
||||
|
||||
impl LLVMIR {
|
||||
///
|
||||
/// A shortcut constructor.
|
||||
///
|
||||
pub fn new(path: String, source: String) -> Self {
|
||||
Self { path, source }
|
||||
}
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
//!
|
||||
//! The contract source code.
|
||||
//!
|
||||
|
||||
pub mod evmla;
|
||||
pub mod llvm_ir;
|
||||
@@ -21,9 +19,7 @@ use self::llvm_ir::LLVMIR;
|
||||
use self::yul::Yul;
|
||||
use self::zkasm::ZKASM;
|
||||
|
||||
///
|
||||
/// The contract source code.
|
||||
///
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[allow(non_camel_case_types)]
|
||||
#[allow(clippy::upper_case_acronyms)]
|
||||
@@ -40,37 +36,27 @@ pub enum IR {
|
||||
}
|
||||
|
||||
impl IR {
|
||||
///
|
||||
/// A shortcut constructor.
|
||||
///
|
||||
pub fn new_yul(source_code: String, object: Object) -> Self {
|
||||
Self::Yul(Yul::new(source_code, object))
|
||||
}
|
||||
|
||||
///
|
||||
/// A shortcut constructor.
|
||||
///
|
||||
pub fn new_evmla(assembly: Assembly, extra_metadata: ExtraMetadata) -> Self {
|
||||
Self::EVMLA(EVMLA::new(assembly, extra_metadata))
|
||||
}
|
||||
|
||||
///
|
||||
/// A shortcut constructor.
|
||||
///
|
||||
pub fn new_llvm_ir(path: String, source: String) -> Self {
|
||||
Self::LLVMIR(LLVMIR::new(path, source))
|
||||
}
|
||||
|
||||
///
|
||||
/// A shortcut constructor.
|
||||
///
|
||||
pub fn new_zkasm(path: String, source: String) -> Self {
|
||||
Self::ZKASM(ZKASM::new(path, source))
|
||||
}
|
||||
|
||||
///
|
||||
/// Get the list of missing deployable libraries.
|
||||
///
|
||||
pub fn get_missing_libraries(&self) -> HashSet<String> {
|
||||
match self {
|
||||
Self::Yul(inner) => inner.get_missing_libraries(),
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
//!
|
||||
//! The contract Yul source code.
|
||||
//!
|
||||
|
||||
use std::collections::HashSet;
|
||||
|
||||
@@ -9,9 +7,7 @@ use serde::Serialize;
|
||||
|
||||
use crate::yul::parser::statement::object::Object;
|
||||
|
||||
///
|
||||
/// The contract Yul source code.
|
||||
///
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
pub struct Yul {
|
||||
/// The Yul source code.
|
||||
@@ -21,9 +17,7 @@ pub struct Yul {
|
||||
}
|
||||
|
||||
impl Yul {
|
||||
///
|
||||
/// A shortcut constructor.
|
||||
///
|
||||
pub fn new(source_code: String, object: Object) -> Self {
|
||||
Self {
|
||||
source_code,
|
||||
@@ -31,9 +25,7 @@ impl Yul {
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Get the list of missing deployable libraries.
|
||||
///
|
||||
pub fn get_missing_libraries(&self) -> HashSet<String> {
|
||||
self.object.get_missing_libraries()
|
||||
}
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
//!
|
||||
//! The contract EraVM assembly source code.
|
||||
//!
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
///
|
||||
/// The contract EraVM assembly source code.
|
||||
///
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[allow(clippy::upper_case_acronyms)]
|
||||
pub struct ZKASM {
|
||||
@@ -18,9 +14,7 @@ pub struct ZKASM {
|
||||
}
|
||||
|
||||
impl ZKASM {
|
||||
///
|
||||
/// A shortcut constructor.
|
||||
///
|
||||
pub fn new(path: String, source: String) -> Self {
|
||||
Self { path, source }
|
||||
}
|
||||
|
||||
@@ -1,14 +1,9 @@
|
||||
//!
|
||||
//! The Solidity contract metadata.
|
||||
//!
|
||||
|
||||
use serde::Serialize;
|
||||
|
||||
///
|
||||
/// The Solidity contract metadata.
|
||||
///
|
||||
/// Is used to append the metadata hash to the contract bytecode.
|
||||
///
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct Metadata {
|
||||
/// The `solc` metadata.
|
||||
@@ -24,9 +19,7 @@ pub struct Metadata {
|
||||
}
|
||||
|
||||
impl Metadata {
|
||||
///
|
||||
/// A shortcut constructor.
|
||||
///
|
||||
pub fn new(
|
||||
solc_metadata: serde_json::Value,
|
||||
solc_version: semver::Version,
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
//!
|
||||
//! The contract data.
|
||||
//!
|
||||
|
||||
pub mod ir;
|
||||
pub mod metadata;
|
||||
@@ -20,9 +18,7 @@ use crate::solc::version::Version as SolcVersion;
|
||||
use self::ir::IR;
|
||||
use self::metadata::Metadata;
|
||||
|
||||
///
|
||||
/// The contract data.
|
||||
///
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
pub struct Contract {
|
||||
/// The absolute file path.
|
||||
@@ -34,9 +30,7 @@ pub struct Contract {
|
||||
}
|
||||
|
||||
impl Contract {
|
||||
///
|
||||
/// A shortcut constructor.
|
||||
///
|
||||
pub fn new(
|
||||
path: String,
|
||||
source_hash: [u8; revive_common::BYTE_LENGTH_FIELD],
|
||||
@@ -58,12 +52,10 @@ impl Contract {
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Returns the contract identifier, which is:
|
||||
/// - the Yul object identifier for Yul
|
||||
/// - the full contract path for EVM legacy assembly
|
||||
/// - the module name for LLVM IR
|
||||
///
|
||||
pub fn identifier(&self) -> &str {
|
||||
match self.ir {
|
||||
IR::Yul(ref yul) => yul.object.identifier.as_str(),
|
||||
@@ -73,9 +65,7 @@ impl Contract {
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Extract factory dependencies.
|
||||
///
|
||||
pub fn drain_factory_dependencies(&mut self) -> HashSet<String> {
|
||||
match self.ir {
|
||||
IR::Yul(ref mut yul) => yul.object.factory_dependencies.drain().collect(),
|
||||
@@ -85,9 +75,7 @@ impl Contract {
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Compiles the specified contract, setting its build artifacts.
|
||||
///
|
||||
pub fn compile(
|
||||
mut self,
|
||||
project: Project,
|
||||
@@ -196,9 +184,7 @@ impl Contract {
|
||||
))
|
||||
}
|
||||
|
||||
///
|
||||
/// Get the list of missing deployable libraries.
|
||||
///
|
||||
pub fn get_missing_libraries(&self) -> HashSet<String> {
|
||||
self.ir.get_missing_libraries()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user