diff options
author | chriseth <c@ethdev.com> | 2016-08-06 20:48:59 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2016-08-17 17:29:31 +0800 |
commit | 9c83109549547c8fe308969f924d3c07ce2cac76 (patch) | |
tree | 3cf99945327a653af0845201364aed7bbab57874 /libsolidity/codegen/ContractCompiler.h | |
parent | e7683f4722791d39ca63913ec98feb1ea9f5164d (diff) | |
download | dexon-solidity-9c83109549547c8fe308969f924d3c07ce2cac76.tar.gz dexon-solidity-9c83109549547c8fe308969f924d3c07ce2cac76.tar.zst dexon-solidity-9c83109549547c8fe308969f924d3c07ce2cac76.zip |
BREAKING: return only exits current function/modifier
Diffstat (limited to 'libsolidity/codegen/ContractCompiler.h')
-rw-r--r-- | libsolidity/codegen/ContractCompiler.h | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/libsolidity/codegen/ContractCompiler.h b/libsolidity/codegen/ContractCompiler.h index d1517e88..0799a543 100644 --- a/libsolidity/codegen/ContractCompiler.h +++ b/libsolidity/codegen/ContractCompiler.h @@ -40,11 +40,9 @@ class ContractCompiler: private ASTConstVisitor public: explicit ContractCompiler(CompilerContext& _context, bool _optimise): m_optimise(_optimise), - m_context(_context), - m_returnTag(eth::Tag, u256(-1)) + m_context(_context) { m_context = CompilerContext(); - m_returnTag = m_context.newTag(); } void compileContract( @@ -122,7 +120,8 @@ private: CompilerContext& m_context; 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 + /// Tag to jump to for a "return" statement, needs to be stacked because of modifiers. + std::vector<eth::AssemblyItem> m_returnTags; unsigned m_modifierDepth = 0; FunctionDefinition const* m_currentFunction = nullptr; unsigned m_stackCleanupForReturn = 0; ///< this number of stack elements need to be removed before jump to m_returnTag |