diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-05-28 21:13:41 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-06-07 21:42:22 +0800 |
commit | 502304f30b1dfa45a936d500c173858baf5735df (patch) | |
tree | 1a948469c7abd95b2ff4b9cb4142ff526a8f8bc0 | |
parent | 937c2083207f28e0b084959492f72ef01119c202 (diff) | |
download | dexon-solidity-502304f30b1dfa45a936d500c173858baf5735df.tar.gz dexon-solidity-502304f30b1dfa45a936d500c173858baf5735df.tar.zst dexon-solidity-502304f30b1dfa45a936d500c173858baf5735df.zip |
Add analyze(block) to AssemblyStack
-rw-r--r-- | libsolidity/interface/AssemblyStack.cpp | 14 | ||||
-rw-r--r-- | libsolidity/interface/AssemblyStack.h | 4 |
2 files changed, 18 insertions, 0 deletions
diff --git a/libsolidity/interface/AssemblyStack.cpp b/libsolidity/interface/AssemblyStack.cpp index dc9d7db2..a571a008 100644 --- a/libsolidity/interface/AssemblyStack.cpp +++ b/libsolidity/interface/AssemblyStack.cpp @@ -57,6 +57,20 @@ bool AssemblyStack::parseAndAnalyze(std::string const& _sourceName, std::string return m_analysisSuccessful; } +bool AssemblyStack::analyze(assembly::Block const& _block, Scanner const* _scanner) +{ + m_errors.clear(); + m_analysisSuccessful = false; + if (_scanner) + m_scanner = make_shared<Scanner>(*_scanner); + m_parserResult = make_shared<assembly::Block>(_block); + + m_analysisInfo = make_shared<assembly::AsmAnalysisInfo>(); + assembly::AsmAnalyzer analyzer(*m_analysisInfo, m_errorReporter); + m_analysisSuccessful = analyzer.analyze(*m_parserResult); + return m_analysisSuccessful; +} + eth::LinkerObject AssemblyStack::assemble(Machine _machine) { solAssert(m_analysisSuccessful, ""); diff --git a/libsolidity/interface/AssemblyStack.h b/libsolidity/interface/AssemblyStack.h index 62a5134a..f13a25ca 100644 --- a/libsolidity/interface/AssemblyStack.h +++ b/libsolidity/interface/AssemblyStack.h @@ -60,6 +60,10 @@ public: /// Multiple calls overwrite the previous state. bool parseAndAnalyze(std::string const& _sourceName, std::string const& _source); + /// Runs analysis step on the supplied block, returns false if input cannot be assembled. + /// Multiple calls overwrite the previous state. + bool analyze(assembly::Block const& _block, Scanner const* _scanner = nullptr); + /// Run the assembly step (should only be called after parseAndAnalyze). eth::LinkerObject assemble(Machine _machine); |