[libsolidity] Prepare evm assembly json import.

This commit is contained in:
Alexander Arlt
2021-11-12 10:34:45 -05:00
parent 235af2b4d1
commit 9a3e248d51
4 changed files with 196 additions and 144 deletions
+11
View File
@@ -388,6 +388,17 @@ bool CompilerStack::parse()
return !m_hasError;
}
void CompilerStack::importEvmAssemblyJson(map<string, Json::Value> const& _sources)
{
solAssert(_sources.size() == 1, "");
if (m_stackState != Empty)
solThrow(CompilerError, "Must call importEvmAssemblyJson only before the SourcesSet state.");
m_evmAssemblyJson = std::make_unique<Json::Value>(_sources.begin()->second);
m_importedSources = true;
m_stackState = SourcesSet;
}
void CompilerStack::importASTs(map<string, Json::Value> const& _sources)
{
if (m_stackState != Empty)
+3
View File
@@ -222,6 +222,8 @@ public:
/// Will throw errors if the import fails
void importASTs(std::map<std::string, Json::Value> const& _sources);
void importEvmAssemblyJson(std::map<std::string, Json::Value> const& _sources);
/// Performs the analysis steps (imports, scopesetting, syntaxCheck, referenceResolving,
/// typechecking, staticAnalysis) on previously parsed sources.
/// @returns false on error.
@@ -499,6 +501,7 @@ private:
std::map<std::string const, Source> m_sources;
// if imported, store AST-JSONS for each filename
std::map<std::string, Json::Value> m_sourceJsons;
std::unique_ptr<Json::Value> m_evmAssemblyJson;
std::vector<std::string> m_unhandledSMTLib2Queries;
std::map<util::h256, std::string> m_smtlib2Responses;
std::shared_ptr<GlobalContext> m_globalContext;