From bd6a36dca30047856ef76d98096bab3f218641cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Fri, 21 Apr 2023 22:23:26 +0200 Subject: [PATCH] Remove EVMAssemblyStack from CompilerStack --- libsolidity/interface/CompilerStack.cpp | 41 ++----------------------- libsolidity/interface/CompilerStack.h | 6 ---- 2 files changed, 3 insertions(+), 44 deletions(-) diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp index de06e6263..9a4b62bf6 100644 --- a/libsolidity/interface/CompilerStack.cpp +++ b/libsolidity/interface/CompilerStack.cpp @@ -427,25 +427,6 @@ void CompilerStack::importASTs(map const& _sources) storeContractDefinitions(); } -void CompilerStack::importFromEVMAssemblyStack(std::string const& _sourceName, std::string const& _source) -{ - solRequire(m_stackState == Empty, CompilerError, ""); - m_evmAssemblyStack = make_unique(m_evmVersion); - Json::Value evmAsmJson; - if (m_evmAssemblyStack->parseAndAnalyze(_sourceName, _source)) - { - m_evmAssemblyStack->assemble(); - string const name{m_evmAssemblyStack->name()}; - Contract& contract = m_contracts[name]; - contract.evmAssembly = m_evmAssemblyStack->evmAssembly(); - contract.evmRuntimeAssembly = m_evmAssemblyStack->evmRuntimeAssembly(); - contract.object = m_evmAssemblyStack->object(); - contract.runtimeObject = m_evmAssemblyStack->runtimeObject(); - - m_stackState = CompilationSuccessful; - } -} - bool CompilerStack::analyze() { if (m_stackState != ParsedAndImported || m_stackState >= AnalysisPerformed) @@ -680,7 +661,6 @@ bool CompilerStack::isRequestedContract(ContractDefinition const& _contract) con bool CompilerStack::compile(State _stopAfter) { - solAssert(m_compilationSourceType != CompilationSourceType::EvmAssemblyJSON); m_stopAfter = _stopAfter; if (m_stackState < AnalysisPerformed) if (!parseAndAnalyze(_stopAfter)) @@ -979,9 +959,6 @@ Json::Value CompilerStack::assemblyJSON(string const& _contractName) const vector CompilerStack::sourceNames() const { - if (m_evmAssemblyStack) - return m_evmAssemblyStack->evmAssembly()->sourceList(); - return ranges::to(m_sources | ranges::views::keys); } @@ -989,18 +966,9 @@ map CompilerStack::sourceIndices() const { map indices; unsigned index = 0; - if (m_evmAssemblyStack) - { - for (auto const& s: m_evmAssemblyStack->evmAssembly()->sourceList()) - if (s != CompilerContext::yulUtilityFileName()) - indices[s] = index++; - } - else - { - for (auto const& s: m_sources) - if (s.first != CompilerContext::yulUtilityFileName()) - indices[s.first] = index++; - } + for (auto const& s: m_sources) + if (s.first != CompilerContext::yulUtilityFileName()) + indices[s.first] = index++; if (indices.find(CompilerContext::yulUtilityFileName()) == indices.end()) indices[CompilerContext::yulUtilityFileName()] = index++; @@ -1607,9 +1575,6 @@ string CompilerStack::createMetadata(Contract const& _contract, bool _forIR) con case CompilationSourceType::SolidityAST: sourceType = "SolidityAST"; break; - case CompilationSourceType::EvmAssemblyJSON: - sourceType = "EvmAssemblyJson"; - break; default: solAssert(false); } diff --git a/libsolidity/interface/CompilerStack.h b/libsolidity/interface/CompilerStack.h index 73e5e896d..cfd950329 100644 --- a/libsolidity/interface/CompilerStack.h +++ b/libsolidity/interface/CompilerStack.h @@ -42,7 +42,6 @@ #include #include -#include #include #include @@ -124,8 +123,6 @@ public: Solidity, /// Compilation from an imported Solidity AST. SolidityAST, - /// Compilation from an imported EVM Assembly JSON. - EvmAssemblyJSON }; /// Creates a new compiler stack. @@ -237,8 +234,6 @@ public: /// Will throw errors if the import fails void importASTs(std::map const& _sources); - void importFromEVMAssemblyStack(std::string const& _sourceName, std::string const& _source); - /// Performs the analysis steps (imports, scopesetting, syntaxCheck, referenceResolving, /// typechecking, staticAnalysis) on previously parsed sources. /// @returns false on error. @@ -538,7 +533,6 @@ private: /// If this is true, the stack will refuse to generate code. bool m_hasError = false; MetadataFormat m_metadataFormat = defaultMetadataFormat(); - std::unique_ptr m_evmAssemblyStack; }; }