diff options
Diffstat (limited to 'libsolidity/inlineasm/AsmAnalysis.h')
-rw-r--r-- | libsolidity/inlineasm/AsmAnalysis.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/libsolidity/inlineasm/AsmAnalysis.h b/libsolidity/inlineasm/AsmAnalysis.h index c6d23227..cfc9b25a 100644 --- a/libsolidity/inlineasm/AsmAnalysis.h +++ b/libsolidity/inlineasm/AsmAnalysis.h @@ -53,7 +53,7 @@ struct Scope; /** * Performs the full analysis stage, calls the ScopeFiller internally, then resolves * references and performs other checks. - * @todo Does not yet check for stack height issues. + * If all these checks pass, code generation should not throw errors. */ class AsmAnalyzer: public boost::static_visitor<bool> { @@ -63,7 +63,7 @@ public: bool analyze(assembly::Block const& _block); - bool operator()(assembly::Instruction const&) { return true; } + bool operator()(assembly::Instruction const&); bool operator()(assembly::Literal const& _literal); bool operator()(assembly::Identifier const&); bool operator()(assembly::FunctionalInstruction const& _functionalInstruction); @@ -76,9 +76,16 @@ public: bool operator()(assembly::Block const& _block); private: - bool checkAssignment(assembly::Identifier const& _assignment); + /// Verifies that a variable to be assigned to exists and has the same size + /// as the value, @a _valueSize, unless that is equal to -1. + bool checkAssignment(assembly::Identifier const& _assignment, size_t _valueSize = size_t(-1)); + bool expectDeposit(int _deposit, int _oldHeight, SourceLocation const& _location); Scope& scope(assembly::Block const* _block); + /// Number of excess stack slots generated by function arguments to take into account for + /// next block. + int m_virtualVariablesInNextBlock = 0; + int m_stackHeight = 0; ExternalIdentifierAccess::Resolver const& m_resolver; Scope* m_currentScope = nullptr; Scopes& m_scopes; |