diff options
author | Christian <c@ethdev.com> | 2015-01-23 09:35:27 +0800 |
---|---|---|
committer | Christian <c@ethdev.com> | 2015-01-26 17:23:39 +0800 |
commit | 7ded95c776717cf96e96dffb7425c86b47ad8b0e (patch) | |
tree | 35ef6d03bd36236ab72f9d9bf3cae6acd4c02b51 /Compiler.h | |
parent | 941c77c8fadd6195809cd2d572feb64478c4fb20 (diff) | |
download | dexon-solidity-7ded95c776717cf96e96dffb7425c86b47ad8b0e.tar.gz dexon-solidity-7ded95c776717cf96e96dffb7425c86b47ad8b0e.tar.zst dexon-solidity-7ded95c776717cf96e96dffb7425c86b47ad8b0e.zip |
Compilation of function modifiers.
Diffstat (limited to 'Compiler.h')
-rw-r--r-- | Compiler.h | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -31,7 +31,8 @@ namespace solidity { class Compiler: private ASTConstVisitor { public: - explicit Compiler(bool _optimize = false): m_optimize(_optimize), m_context(), m_returnTag(m_context.newTag()) {} + explicit Compiler(bool _optimize = false): m_optimize(_optimize), m_context(), + m_returnTag(m_context.newTag()) {} void compileContract(ContractDefinition const& _contract, std::map<ContractDefinition const*, bytes const*> const& _contracts); @@ -70,8 +71,13 @@ private: virtual bool visit(Return const& _return) override; virtual bool visit(VariableDefinition const& _variableDefinition) override; virtual bool visit(ExpressionStatement const& _expressionStatement) override; + virtual bool visit(PlaceholderStatement const&) override; - void compileExpression(Expression const& _expression); + /// Appends one layer of function modifier code of the current function, or the function + /// body itself if the last modifier was reached. + void appendModifierOrFunctionCode(); + + void compileExpression(Expression const& _expression, TypePointer const& _targetType = TypePointer()); bool const m_optimize; CompilerContext m_context; @@ -79,6 +85,9 @@ private: std::vector<eth::AssemblyItem> m_breakTags; ///< tag to jump to for a "break" statement std::vector<eth::AssemblyItem> m_continueTags; ///< tag to jump to for a "continue" statement eth::AssemblyItem m_returnTag; ///< tag to jump to for a "return" statement + unsigned m_modifierDepth = 0; + FunctionDefinition const* m_currentFunction; + unsigned m_stackCleanupForReturn; ///< this number of stack elements need to be removed before jump to m_returnTag }; } |