diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-06-27 17:25:36 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-09-13 18:40:57 +0800 |
commit | 58f7a27ee0336423fa7dc76b8a160b78301bbdd2 (patch) | |
tree | 0a5913c37d415d853df6f430dc3b1ff4934579b1 /libsolidity | |
parent | 8bb96eaaf533b17cd9c9109642455408f551348c (diff) | |
download | dexon-solidity-58f7a27ee0336423fa7dc76b8a160b78301bbdd2.tar.gz dexon-solidity-58f7a27ee0336423fa7dc76b8a160b78301bbdd2.tar.zst dexon-solidity-58f7a27ee0336423fa7dc76b8a160b78301bbdd2.zip |
Add sig member on function type
Diffstat (limited to 'libsolidity')
-rw-r--r-- | libsolidity/ast/Types.cpp | 5 | ||||
-rw-r--r-- | libsolidity/codegen/ExpressionCompiler.cpp | 9 |
2 files changed, 13 insertions, 1 deletions
diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index 10424858..5aa52383 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -2436,6 +2436,11 @@ MemberList::MemberMap FunctionType::nativeMembers(ContractDefinition const*) con case Kind::BareDelegateCall: { MemberList::MemberMap members; + if (m_kind == Kind::External) + members.push_back(MemberList::Member( + "sig", + make_shared<FixedBytesType>(4) + )); if (m_kind != Kind::BareDelegateCall && m_kind != Kind::DelegateCall) { if (isPayable()) diff --git a/libsolidity/codegen/ExpressionCompiler.cpp b/libsolidity/codegen/ExpressionCompiler.cpp index 5c9b743a..b7aadc12 100644 --- a/libsolidity/codegen/ExpressionCompiler.cpp +++ b/libsolidity/codegen/ExpressionCompiler.cpp @@ -1068,7 +1068,14 @@ bool ExpressionCompiler::visit(MemberAccess const& _memberAccess) solAssert(false, "Invalid member access to integer"); break; case Type::Category::Function: - solAssert(!!_memberAccess.expression().annotation().type->memberType(member), + if (member == "sig") + { + m_context << Instruction::SWAP1 << Instruction::POP; + /// need to store store it as bytes4 + utils().leftShiftNumberOnStack(224); + } + else + solAssert(!!_memberAccess.expression().annotation().type->memberType(member), "Invalid member access to function."); break; case Type::Category::Magic: |