diff options
author | chriseth <chris@ethereum.org> | 2017-01-13 20:05:02 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-13 20:05:02 +0800 |
commit | 60cc1668517f56ce6ca8225555472e7a27eab8b0 (patch) | |
tree | 8eac35131efc4beeee921356052375233edd7102 /libsolidity/codegen/ExpressionCompiler.cpp | |
parent | 822622cf5bf23e79a6e2292cb837d1a39ca1c419 (diff) | |
parent | e22672b7c739dde9f37a919e63245abda4b1fc89 (diff) | |
download | dexon-solidity-60cc1668517f56ce6ca8225555472e7a27eab8b0.tar dexon-solidity-60cc1668517f56ce6ca8225555472e7a27eab8b0.tar.gz dexon-solidity-60cc1668517f56ce6ca8225555472e7a27eab8b0.tar.bz2 dexon-solidity-60cc1668517f56ce6ca8225555472e7a27eab8b0.tar.lz dexon-solidity-60cc1668517f56ce6ca8225555472e7a27eab8b0.tar.xz dexon-solidity-60cc1668517f56ce6ca8225555472e7a27eab8b0.tar.zst dexon-solidity-60cc1668517f56ce6ca8225555472e7a27eab8b0.zip |
Merge pull request #1561 from ethereum/develop
Merge develop into release for 0.4.8
Diffstat (limited to 'libsolidity/codegen/ExpressionCompiler.cpp')
-rw-r--r-- | libsolidity/codegen/ExpressionCompiler.cpp | 42 |
1 files changed, 33 insertions, 9 deletions
diff --git a/libsolidity/codegen/ExpressionCompiler.cpp b/libsolidity/codegen/ExpressionCompiler.cpp index a7fb8408..3922da88 100644 --- a/libsolidity/codegen/ExpressionCompiler.cpp +++ b/libsolidity/codegen/ExpressionCompiler.cpp @@ -908,19 +908,43 @@ bool ExpressionCompiler::visit(MemberAccess const& _memberAccess) solAssert(_memberAccess.annotation().type, "_memberAccess has no type"); if (auto funType = dynamic_cast<FunctionType const*>(_memberAccess.annotation().type.get())) { - if (funType->location() != FunctionType::Location::Internal) - { - _memberAccess.expression().accept(*this); - m_context << funType->externalIdentifier(); - } - else + switch (funType->location()) { + case FunctionType::Location::Internal: // We do not visit the expression here on purpose, because in the case of an // internal library function call, this would push the library address forcing // us to link against it although we actually do not need it. - auto const* function = dynamic_cast<FunctionDefinition const*>(_memberAccess.annotation().referencedDeclaration); - solAssert(!!function, "Function not found in member access"); - utils().pushCombinedFunctionEntryLabel(*function); + if (auto const* function = dynamic_cast<FunctionDefinition const*>(_memberAccess.annotation().referencedDeclaration)) + utils().pushCombinedFunctionEntryLabel(*function); + else + solAssert(false, "Function not found in member access"); + break; + case FunctionType::Location::Event: + if (!dynamic_cast<EventDefinition const*>(_memberAccess.annotation().referencedDeclaration)) + solAssert(false, "event not found"); + // no-op, because the parent node will do the job + break; + case FunctionType::Location::External: + case FunctionType::Location::Creation: + case FunctionType::Location::DelegateCall: + case FunctionType::Location::CallCode: + case FunctionType::Location::Send: + case FunctionType::Location::Bare: + case FunctionType::Location::BareCallCode: + case FunctionType::Location::BareDelegateCall: + _memberAccess.expression().accept(*this); + m_context << funType->externalIdentifier(); + break; + case FunctionType::Location::Log0: + case FunctionType::Location::Log1: + case FunctionType::Location::Log2: + case FunctionType::Location::Log3: + case FunctionType::Location::Log4: + case FunctionType::Location::ECRecover: + case FunctionType::Location::SHA256: + case FunctionType::Location::RIPEMD160: + default: + solAssert(false, "unsupported member function"); } } else if (dynamic_cast<TypeType const*>(_memberAccess.annotation().type.get())) |