diff options
author | chriseth <c@ethdev.com> | 2015-06-26 00:52:19 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-06-26 00:52:19 +0800 |
commit | 2e5c52bfabdc7ac221bf4617ed98d9a9abef85b8 (patch) | |
tree | e2cf306d37298b8de3da3a9c0c29a024bfc3f080 /Compiler.cpp | |
parent | fb14a586f4084d8acb3a765f3995e2a5e7b3a5b3 (diff) | |
parent | 529ed468df4c8fc9947cf92b42a5da84c7434b49 (diff) | |
download | dexon-solidity-2e5c52bfabdc7ac221bf4617ed98d9a9abef85b8.tar dexon-solidity-2e5c52bfabdc7ac221bf4617ed98d9a9abef85b8.tar.gz dexon-solidity-2e5c52bfabdc7ac221bf4617ed98d9a9abef85b8.tar.bz2 dexon-solidity-2e5c52bfabdc7ac221bf4617ed98d9a9abef85b8.tar.lz dexon-solidity-2e5c52bfabdc7ac221bf4617ed98d9a9abef85b8.tar.xz dexon-solidity-2e5c52bfabdc7ac221bf4617ed98d9a9abef85b8.tar.zst dexon-solidity-2e5c52bfabdc7ac221bf4617ed98d9a9abef85b8.zip |
Merge pull request #2276 from chriseth/sol_memoryArrays7
Copy routines for non-byte arrays.
Diffstat (limited to 'Compiler.cpp')
-rw-r--r-- | Compiler.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/Compiler.cpp b/Compiler.cpp index f5570b98..b05a7a9b 100644 --- a/Compiler.cpp +++ b/Compiler.cpp @@ -392,9 +392,9 @@ bool Compiler::visit(FunctionDefinition const& _function) } for (ASTPointer<VariableDeclaration const> const& variable: _function.getReturnParameters()) - m_context.addAndInitializeVariable(*variable); + appendStackVariableInitialisation(*variable); for (VariableDeclaration const* localVariable: _function.getLocalVariables()) - m_context.addAndInitializeVariable(*localVariable); + appendStackVariableInitialisation(*localVariable); if (_function.isConstructor()) if (auto c = m_context.getNextConstructor(dynamic_cast<ContractDefinition const&>(*_function.getScope()))) @@ -639,7 +639,7 @@ void Compiler::appendModifierOrFunctionCode() modifier.getParameters()[i]->getType()); } for (VariableDeclaration const* localVariable: modifier.getLocalVariables()) - m_context.addAndInitializeVariable(*localVariable); + appendStackVariableInitialisation(*localVariable); unsigned const c_stackSurplus = CompilerUtils::getSizeOnStack(modifier.getParameters()) + CompilerUtils::getSizeOnStack(modifier.getLocalVariables()); @@ -653,6 +653,13 @@ void Compiler::appendModifierOrFunctionCode() } } +void Compiler::appendStackVariableInitialisation(VariableDeclaration const& _variable) +{ + CompilerContext::LocationSetter location(m_context, _variable); + m_context.addVariable(_variable); + ExpressionCompiler(m_context).appendStackVariableInitialisation(*_variable.getType()); +} + void Compiler::compileExpression(Expression const& _expression, TypePointer const& _targetType) { ExpressionCompiler expressionCompiler(m_context, m_optimize); |