Skip to content

Commit 1ca002c

Browse files
committed
[libsolidity] Prepare evm assembly json import.
1 parent 1f091f6 commit 1ca002c

File tree

4 files changed

+191
-139
lines changed

4 files changed

+191
-139
lines changed

libsolidity/interface/CompilerStack.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,17 @@ bool CompilerStack::parse()
388388
return !m_hasError;
389389
}
390390

391+
void CompilerStack::importEvmAssemblyJson(map<string, Json::Value> const& _sources)
392+
{
393+
solAssert(_sources.size() == 1, "");
394+
if (m_stackState != Empty)
395+
solThrow(CompilerError, "Must call importEvmAssemblyJson only before the SourcesSet state.");
396+
397+
m_evmAssemblyJson = std::make_unique<Json::Value>(_sources.begin()->second);
398+
m_importedSources = true;
399+
m_stackState = SourcesSet;
400+
}
401+
391402
void CompilerStack::importASTs(map<string, Json::Value> const& _sources)
392403
{
393404
if (m_stackState != Empty)

libsolidity/interface/CompilerStack.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,8 @@ class CompilerStack: public langutil::CharStreamProvider
222222
/// Will throw errors if the import fails
223223
void importASTs(std::map<std::string, Json::Value> const& _sources);
224224

225+
void importEvmAssemblyJson(std::map<std::string, Json::Value> const& _sources);
226+
225227
/// Performs the analysis steps (imports, scopesetting, syntaxCheck, referenceResolving,
226228
/// typechecking, staticAnalysis) on previously parsed sources.
227229
/// @returns false on error.
@@ -499,6 +501,7 @@ class CompilerStack: public langutil::CharStreamProvider
499501
std::map<std::string const, Source> m_sources;
500502
// if imported, store AST-JSONS for each filename
501503
std::map<std::string, Json::Value> m_sourceJsons;
504+
std::unique_ptr<Json::Value> m_evmAssemblyJson;
502505
std::vector<std::string> m_unhandledSMTLib2Queries;
503506
std::map<util::h256, std::string> m_smtlib2Responses;
504507
std::shared_ptr<GlobalContext> m_globalContext;

0 commit comments

Comments
 (0)