diff options
author | chriseth <c@ethdev.com> | 2015-11-17 21:46:00 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-11-17 21:46:00 +0800 |
commit | 28c3f1839b6de71cd1339e076d0128da498a38c9 (patch) | |
tree | 1747eacbdc09a0c6e9ac88a9db3515fe03368f9b /libsolidity/codegen | |
parent | 6411bf00266b4489cc4f928fdf7d486df73f84db (diff) | |
parent | a35f91816b410a51c8d2759a90a67605b3f3b5b0 (diff) | |
download | dexon-solidity-28c3f1839b6de71cd1339e076d0128da498a38c9.tar.gz dexon-solidity-28c3f1839b6de71cd1339e076d0128da498a38c9.tar.zst dexon-solidity-28c3f1839b6de71cd1339e076d0128da498a38c9.zip |
Merge pull request #216 from chriseth/dynamic_indexed_event_args
Fix dynamic indexed event arguments - applies sha3.
Diffstat (limited to 'libsolidity/codegen')
-rw-r--r-- | libsolidity/codegen/ExpressionCompiler.cpp | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/libsolidity/codegen/ExpressionCompiler.cpp b/libsolidity/codegen/ExpressionCompiler.cpp index 3774e731..3906a897 100644 --- a/libsolidity/codegen/ExpressionCompiler.cpp +++ b/libsolidity/codegen/ExpressionCompiler.cpp @@ -587,11 +587,24 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall) { ++numIndexed; arguments[arg - 1]->accept(*this); - utils().convertType( - *arguments[arg - 1]->annotation().type, - *function.parameterTypes()[arg - 1], - true - ); + if (auto const& arrayType = dynamic_pointer_cast<ArrayType const>(function.parameterTypes()[arg - 1])) + { + utils().fetchFreeMemoryPointer(); + utils().encodeToMemory( + {arguments[arg - 1]->annotation().type}, + {arrayType}, + false, + true + ); + utils().toSizeAfterFreeMemoryPointer(); + m_context << eth::Instruction::SHA3; + } + else + utils().convertType( + *arguments[arg - 1]->annotation().type, + *function.parameterTypes()[arg - 1], + true + ); } if (!event.isAnonymous()) { |