mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-11-13 06:07:11 +00:00
use normal style for comments
Signed-off-by: xermicus <cyrill@parity.io>
This commit is contained in:
184 files changed
+3
-1789
No files matched your search
@@ -1,13 +1,9 @@
|
||||
//!
|
||||
//! The `solc --standard-json` input language.
|
||||
//!
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
///
|
||||
/// The `solc --standard-json` input language.
|
||||
///
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
pub enum Language {
|
||||
/// The Solidity language.
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
//!
|
||||
//! The `solc --standard-json` input.
|
||||
//!
|
||||
|
||||
pub mod language;
|
||||
pub mod settings;
|
||||
@@ -25,9 +23,7 @@ use self::language::Language;
|
||||
use self::settings::Settings;
|
||||
use self::source::Source;
|
||||
|
||||
///
|
||||
/// The `solc --standard-json` input.
|
||||
///
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Input {
|
||||
@@ -43,9 +39,7 @@ pub struct Input {
|
||||
}
|
||||
|
||||
impl Input {
|
||||
///
|
||||
/// A shortcut constructor from stdin.
|
||||
///
|
||||
pub fn try_from_stdin(solc_pipeline: SolcPipeline) -> anyhow::Result<Self> {
|
||||
let mut input: Self = serde_json::from_reader(std::io::BufReader::new(std::io::stdin()))?;
|
||||
input
|
||||
@@ -56,9 +50,7 @@ impl Input {
|
||||
Ok(input)
|
||||
}
|
||||
|
||||
///
|
||||
/// A shortcut constructor from paths.
|
||||
///
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn try_from_paths(
|
||||
language: Language,
|
||||
@@ -100,11 +92,8 @@ impl Input {
|
||||
})
|
||||
}
|
||||
|
||||
///
|
||||
/// A shortcut constructor from source code.
|
||||
///
|
||||
/// Only for the integration test purposes.
|
||||
///
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn try_from_sources(
|
||||
evm_version: Option<revive_common::EVMVersion>,
|
||||
@@ -138,9 +127,7 @@ impl Input {
|
||||
})
|
||||
}
|
||||
|
||||
///
|
||||
/// Sets the necessary defaults.
|
||||
///
|
||||
pub fn normalize(&mut self, version: &semver::Version) {
|
||||
self.settings.normalize(version);
|
||||
}
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
//!
|
||||
//! The `solc --standard-json` input settings metadata.
|
||||
//!
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
///
|
||||
/// The `solc --standard-json` input settings metadata.
|
||||
///
|
||||
#[derive(Debug, Default, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Metadata {
|
||||
@@ -17,9 +13,7 @@ pub struct Metadata {
|
||||
}
|
||||
|
||||
impl Metadata {
|
||||
///
|
||||
/// A shortcut constructor.
|
||||
///
|
||||
pub fn new(bytecode_hash: revive_llvm_context::EraVMMetadataHash) -> Self {
|
||||
Self {
|
||||
bytecode_hash: Some(bytecode_hash),
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
//!
|
||||
//! The `solc --standard-json` input settings.
|
||||
//!
|
||||
|
||||
pub mod metadata;
|
||||
pub mod optimizer;
|
||||
@@ -16,9 +14,7 @@ use self::metadata::Metadata;
|
||||
use self::optimizer::Optimizer;
|
||||
use self::selection::Selection;
|
||||
|
||||
///
|
||||
/// The `solc --standard-json` input settings.
|
||||
///
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Settings {
|
||||
@@ -49,9 +45,7 @@ pub struct Settings {
|
||||
}
|
||||
|
||||
impl Settings {
|
||||
///
|
||||
/// A shortcut constructor.
|
||||
///
|
||||
pub fn new(
|
||||
evm_version: Option<revive_common::EVMVersion>,
|
||||
libraries: BTreeMap<String, BTreeMap<String, String>>,
|
||||
@@ -72,16 +66,12 @@ impl Settings {
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Sets the necessary defaults.
|
||||
///
|
||||
pub fn normalize(&mut self, version: &semver::Version) {
|
||||
self.optimizer.normalize(version);
|
||||
}
|
||||
|
||||
///
|
||||
/// Parses the library list and returns their double hashmap with path and name as keys.
|
||||
///
|
||||
pub fn parse_libraries(
|
||||
input: Vec<String>,
|
||||
) -> anyhow::Result<BTreeMap<String, BTreeMap<String, String>>> {
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
//!
|
||||
//! The `solc --standard-json` input settings optimizer details.
|
||||
//!
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
///
|
||||
/// The `solc --standard-json` input settings optimizer details.
|
||||
///
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Details {
|
||||
@@ -29,9 +25,7 @@ pub struct Details {
|
||||
}
|
||||
|
||||
impl Details {
|
||||
///
|
||||
/// A shortcut constructor.
|
||||
///
|
||||
pub fn new(
|
||||
peephole: bool,
|
||||
inliner: Option<bool>,
|
||||
@@ -52,9 +46,7 @@ impl Details {
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Creates a set of disabled optimizations.
|
||||
///
|
||||
pub fn disabled(version: &semver::Version) -> Self {
|
||||
let inliner = if version >= &semver::Version::new(0, 8, 5) {
|
||||
Some(false)
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
//!
|
||||
//! The `solc --standard-json` input settings optimizer.
|
||||
//!
|
||||
|
||||
pub mod details;
|
||||
|
||||
@@ -9,9 +7,7 @@ use serde::Serialize;
|
||||
|
||||
use self::details::Details;
|
||||
|
||||
///
|
||||
/// The `solc --standard-json` input settings optimizer.
|
||||
///
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Optimizer {
|
||||
@@ -32,9 +28,7 @@ pub struct Optimizer {
|
||||
}
|
||||
|
||||
impl Optimizer {
|
||||
///
|
||||
/// A shortcut constructor.
|
||||
///
|
||||
pub fn new(
|
||||
enabled: bool,
|
||||
mode: Option<char>,
|
||||
@@ -51,9 +45,7 @@ impl Optimizer {
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Sets the necessary defaults.
|
||||
///
|
||||
pub fn normalize(&mut self, version: &semver::Version) {
|
||||
self.details = if version >= &semver::Version::new(0, 5, 5) {
|
||||
Some(Details::disabled(version))
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
//!
|
||||
//! The `solc --standard-json` expected output selection flag.
|
||||
//!
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::solc::pipeline::Pipeline as SolcPipeline;
|
||||
|
||||
///
|
||||
/// The `solc --standard-json` expected output selection flag.
|
||||
///
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
#[allow(non_camel_case_types)]
|
||||
#[allow(clippy::upper_case_acronyms)]
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
//!
|
||||
//! The `solc --standard-json` output file selection.
|
||||
//!
|
||||
|
||||
pub mod flag;
|
||||
|
||||
@@ -13,9 +11,7 @@ use crate::solc::pipeline::Pipeline as SolcPipeline;
|
||||
|
||||
use self::flag::Flag as SelectionFlag;
|
||||
|
||||
///
|
||||
/// The `solc --standard-json` output file selection.
|
||||
///
|
||||
#[derive(Debug, Default, Serialize, Deserialize)]
|
||||
pub struct File {
|
||||
/// The per-file output selections.
|
||||
@@ -27,9 +23,7 @@ pub struct File {
|
||||
}
|
||||
|
||||
impl File {
|
||||
///
|
||||
/// Creates the selection required by our compilation process.
|
||||
///
|
||||
pub fn new_required(pipeline: SolcPipeline) -> Self {
|
||||
Self {
|
||||
per_file: Some(HashSet::from_iter([SelectionFlag::AST])),
|
||||
@@ -42,9 +36,7 @@ impl File {
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Extends the user's output selection with flag required by our compilation process.
|
||||
///
|
||||
pub fn extend_with_required(&mut self, pipeline: SolcPipeline) -> &mut Self {
|
||||
let required = Self::new_required(pipeline);
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
//!
|
||||
//! The `solc --standard-json` output selection.
|
||||
//!
|
||||
|
||||
pub mod file;
|
||||
|
||||
@@ -11,9 +9,7 @@ use crate::solc::pipeline::Pipeline as SolcPipeline;
|
||||
|
||||
use self::file::File as FileSelection;
|
||||
|
||||
///
|
||||
/// The `solc --standard-json` output selection.
|
||||
///
|
||||
#[derive(Debug, Default, Serialize, Deserialize)]
|
||||
pub struct Selection {
|
||||
/// Only the 'all' wildcard is available for robustness reasons.
|
||||
@@ -22,18 +18,14 @@ pub struct Selection {
|
||||
}
|
||||
|
||||
impl Selection {
|
||||
///
|
||||
/// Creates the selection required by our compilation process.
|
||||
///
|
||||
pub fn new_required(pipeline: SolcPipeline) -> Self {
|
||||
Self {
|
||||
all: Some(FileSelection::new_required(pipeline)),
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Extends the user's output selection with flag required by our compilation process.
|
||||
///
|
||||
pub fn extend_with_required(&mut self, pipeline: SolcPipeline) -> &mut Self {
|
||||
self.all
|
||||
.get_or_insert_with(|| FileSelection::new_required(pipeline))
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
//!
|
||||
//! The `solc --standard-json` input source.
|
||||
//!
|
||||
|
||||
use std::io::Read;
|
||||
use std::path::Path;
|
||||
@@ -8,9 +6,7 @@ use std::path::Path;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
///
|
||||
/// The `solc --standard-json` input source.
|
||||
///
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Source {
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
//!
|
||||
//! The `solc <input>.sol --standard-json`.
|
||||
//!
|
||||
|
||||
pub mod input;
|
||||
pub mod output;
|
||||
@@ -1,13 +1,9 @@
|
||||
//!
|
||||
//! The `solc --standard-json` output contract EVM bytecode.
|
||||
//!
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
///
|
||||
/// The `solc --standard-json` output contract EVM bytecode.
|
||||
///
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Bytecode {
|
||||
@@ -16,17 +12,13 @@ pub struct Bytecode {
|
||||
}
|
||||
|
||||
impl Bytecode {
|
||||
///
|
||||
/// A shortcut constructor.
|
||||
///
|
||||
pub fn new(object: String) -> Self {
|
||||
Self { object }
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// The `solc --standard-json` output contract EVM deployed bytecode.
|
||||
///
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct DeployedBytecode {
|
||||
@@ -35,9 +27,7 @@ pub struct DeployedBytecode {
|
||||
}
|
||||
|
||||
impl DeployedBytecode {
|
||||
///
|
||||
/// A shortcut constructor.
|
||||
///
|
||||
pub fn new(object: String) -> Self {
|
||||
Self { object }
|
||||
}
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
//!
|
||||
//! The `solc --standard-json` output contract EVM extra metadata.
|
||||
//!
|
||||
|
||||
pub mod recursive_function;
|
||||
|
||||
@@ -9,9 +7,7 @@ use serde::Serialize;
|
||||
|
||||
use self::recursive_function::RecursiveFunction;
|
||||
|
||||
///
|
||||
/// The `solc --standard-json` output contract EVM extra metadata.
|
||||
///
|
||||
#[derive(Debug, Default, Serialize, Deserialize, Clone)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ExtraMetadata {
|
||||
@@ -21,9 +17,7 @@ pub struct ExtraMetadata {
|
||||
}
|
||||
|
||||
impl ExtraMetadata {
|
||||
///
|
||||
/// Returns the recursive function reference for the specified tag.
|
||||
///
|
||||
pub fn get(
|
||||
&self,
|
||||
block_key: &revive_llvm_context::EraVMFunctionBlockKey,
|
||||
|
||||
-4
@@ -1,13 +1,9 @@
|
||||
//!
|
||||
//! The `solc --standard-json` output contract EVM recursive function.
|
||||
//!
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
///
|
||||
/// The `solc --standard-json` output contract EVM recursive function.
|
||||
///
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct RecursiveFunction {
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
//!
|
||||
//! The `solc --standard-json` output contract EVM data.
|
||||
//!
|
||||
|
||||
pub mod bytecode;
|
||||
pub mod extra_metadata;
|
||||
@@ -16,11 +14,8 @@ use self::bytecode::Bytecode;
|
||||
use self::bytecode::DeployedBytecode;
|
||||
use self::extra_metadata::ExtraMetadata;
|
||||
|
||||
///
|
||||
/// The `solc --standard-json` output contract EVM data.
|
||||
///
|
||||
/// It is replaced by EraVM data after compiling.
|
||||
///
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct EVM {
|
||||
@@ -44,9 +39,7 @@ pub struct EVM {
|
||||
}
|
||||
|
||||
impl EVM {
|
||||
///
|
||||
/// Sets the EraVM assembly and bytecode.
|
||||
///
|
||||
pub fn modify(&mut self, assembly_text: String, bytecode: String) {
|
||||
self.assembly_text = Some(assembly_text);
|
||||
self.bytecode = Some(Bytecode::new(bytecode));
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
//!
|
||||
//! The `solc --standard-json` output contract.
|
||||
//!
|
||||
|
||||
pub mod evm;
|
||||
|
||||
@@ -12,9 +10,7 @@ use serde::Serialize;
|
||||
|
||||
use self::evm::EVM;
|
||||
|
||||
///
|
||||
/// The `solc --standard-json` output contract.
|
||||
///
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Contract {
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
//!
|
||||
//! The `solc --standard-json` output error.
|
||||
//!
|
||||
|
||||
pub mod source_location;
|
||||
|
||||
@@ -11,9 +9,7 @@ use serde::Serialize;
|
||||
|
||||
use self::source_location::SourceLocation;
|
||||
|
||||
///
|
||||
/// The `solc --standard-json` output error.
|
||||
///
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Error {
|
||||
@@ -34,9 +30,7 @@ pub struct Error {
|
||||
}
|
||||
|
||||
impl Error {
|
||||
///
|
||||
/// Returns the `ecrecover` function usage warning.
|
||||
///
|
||||
pub fn message_ecrecover(src: Option<&str>) -> Self {
|
||||
let message = r#"
|
||||
┌──────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
@@ -59,9 +53,7 @@ impl Error {
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Returns the `<address payable>`'s `send` and `transfer` methods usage error.
|
||||
///
|
||||
pub fn message_send_and_transfer(src: Option<&str>) -> Self {
|
||||
let message = r#"
|
||||
┌──────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
@@ -87,9 +79,7 @@ impl Error {
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Returns the `extcodesize` instruction usage warning.
|
||||
///
|
||||
pub fn message_extcodesize(src: Option<&str>) -> Self {
|
||||
let message = r#"
|
||||
┌──────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
@@ -114,9 +104,7 @@ impl Error {
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Returns the `origin` instruction usage warning.
|
||||
///
|
||||
pub fn message_tx_origin(src: Option<&str>) -> Self {
|
||||
let message = r#"
|
||||
┌──────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
@@ -139,9 +127,7 @@ impl Error {
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Returns the internal function pointer usage error.
|
||||
///
|
||||
pub fn message_internal_function_pointer(src: Option<&str>) -> Self {
|
||||
let message = r#"
|
||||
┌──────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
@@ -161,9 +147,7 @@ impl Error {
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Appends the contract path to the message..
|
||||
///
|
||||
pub fn push_contract_path(&mut self, path: &str) {
|
||||
self.formatted_message
|
||||
.push_str(format!("\n--> {path}\n").as_str());
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
//!
|
||||
//! The `solc --standard-json` output error source location.
|
||||
//!
|
||||
|
||||
use std::str::FromStr;
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
///
|
||||
/// The `solc --standard-json` output error source location.
|
||||
///
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct SourceLocation {
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
//!
|
||||
//! The `solc --standard-json` output.
|
||||
//!
|
||||
|
||||
pub mod contract;
|
||||
pub mod error;
|
||||
@@ -27,9 +25,7 @@ use self::contract::Contract;
|
||||
use self::error::Error as SolcStandardJsonOutputError;
|
||||
use self::source::Source;
|
||||
|
||||
///
|
||||
/// The `solc --standard-json` output.
|
||||
///
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
pub struct Output {
|
||||
/// The file-contract hashmap.
|
||||
@@ -53,9 +49,7 @@ pub struct Output {
|
||||
}
|
||||
|
||||
impl Output {
|
||||
///
|
||||
/// Converts the `solc` JSON output into a convenient project.
|
||||
///
|
||||
pub fn try_to_project(
|
||||
&mut self,
|
||||
source_code_files: BTreeMap<String, String>,
|
||||
@@ -144,9 +138,7 @@ impl Output {
|
||||
))
|
||||
}
|
||||
|
||||
///
|
||||
/// Removes EVM artifacts to prevent their accidental usage.
|
||||
///
|
||||
pub fn remove_evm(&mut self) {
|
||||
if let Some(files) = self.contracts.as_mut() {
|
||||
for (_, file) in files.iter_mut() {
|
||||
@@ -159,9 +151,7 @@ impl Output {
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Traverses the AST and returns the list of additional errors and warnings.
|
||||
///
|
||||
pub fn preprocess_ast(
|
||||
&mut self,
|
||||
version: &SolcVersion,
|
||||
@@ -196,9 +186,7 @@ impl Output {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
///
|
||||
/// The pass, which replaces with dependency indexes with actual data.
|
||||
///
|
||||
fn preprocess_dependencies(&mut self) -> anyhow::Result<()> {
|
||||
let files = match self.contracts.as_mut() {
|
||||
Some(files) => files,
|
||||
@@ -242,9 +230,7 @@ impl Output {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
///
|
||||
/// Preprocesses an assembly JSON structure dependency data map.
|
||||
///
|
||||
fn preprocess_dependency_level(
|
||||
full_path: &str,
|
||||
assembly: &mut Assembly,
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
//!
|
||||
//! The `solc --standard-json` output source.
|
||||
//!
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
@@ -10,9 +8,7 @@ use crate::solc::standard_json::output::error::Error as SolcStandardJsonOutputEr
|
||||
use crate::solc::version::Version as SolcVersion;
|
||||
use crate::warning::Warning;
|
||||
|
||||
///
|
||||
/// The `solc --standard-json` output source.
|
||||
///
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Source {
|
||||
@@ -23,9 +19,7 @@ pub struct Source {
|
||||
}
|
||||
|
||||
impl Source {
|
||||
///
|
||||
/// Checks the AST node for the `ecrecover` function usage.
|
||||
///
|
||||
pub fn check_ecrecover(ast: &serde_json::Value) -> Option<SolcStandardJsonOutputError> {
|
||||
let ast = ast.as_object()?;
|
||||
|
||||
@@ -46,9 +40,7 @@ impl Source {
|
||||
))
|
||||
}
|
||||
|
||||
///
|
||||
/// Checks the AST node for the `<address payable>`'s `send` and `transfer` methods usage.
|
||||
///
|
||||
pub fn check_send_and_transfer(ast: &serde_json::Value) -> Option<SolcStandardJsonOutputError> {
|
||||
let ast = ast.as_object()?;
|
||||
|
||||
@@ -70,9 +62,7 @@ impl Source {
|
||||
))
|
||||
}
|
||||
|
||||
///
|
||||
/// Checks the AST node for the `extcodesize` assembly instruction usage.
|
||||
///
|
||||
pub fn check_assembly_extcodesize(
|
||||
ast: &serde_json::Value,
|
||||
) -> Option<SolcStandardJsonOutputError> {
|
||||
@@ -96,9 +86,7 @@ impl Source {
|
||||
))
|
||||
}
|
||||
|
||||
///
|
||||
/// Checks the AST node for the `origin` assembly instruction usage.
|
||||
///
|
||||
pub fn check_assembly_origin(ast: &serde_json::Value) -> Option<SolcStandardJsonOutputError> {
|
||||
let ast = ast.as_object()?;
|
||||
|
||||
@@ -120,9 +108,7 @@ impl Source {
|
||||
))
|
||||
}
|
||||
|
||||
///
|
||||
/// Checks the AST node for the `tx.origin` value usage.
|
||||
///
|
||||
pub fn check_tx_origin(ast: &serde_json::Value) -> Option<SolcStandardJsonOutputError> {
|
||||
let ast = ast.as_object()?;
|
||||
|
||||
@@ -146,9 +132,7 @@ impl Source {
|
||||
))
|
||||
}
|
||||
|
||||
///
|
||||
/// Checks the AST node for the internal function pointers value usage.
|
||||
///
|
||||
pub fn check_internal_function_pointer(
|
||||
ast: &serde_json::Value,
|
||||
) -> Option<SolcStandardJsonOutputError> {
|
||||
@@ -174,9 +158,7 @@ impl Source {
|
||||
)
|
||||
}
|
||||
|
||||
///
|
||||
/// Returns the list of messages for some specific parts of the AST.
|
||||
///
|
||||
pub fn get_messages(
|
||||
ast: &serde_json::Value,
|
||||
version: &SolcVersion,
|
||||
@@ -240,9 +222,7 @@ impl Source {
|
||||
messages
|
||||
}
|
||||
|
||||
///
|
||||
/// Returns the name of the last contract.
|
||||
///
|
||||
pub fn last_contract_name(&self) -> anyhow::Result<String> {
|
||||
self.ast
|
||||
.as_ref()
|
||||
|
||||
Reference in new issue
Block a user