diff options
author | chriseth <c@ethdev.com> | 2015-10-05 23:19:23 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-10-06 20:20:06 +0800 |
commit | bc609c55c0fa622a68fa9718c55046416c201b1d (patch) | |
tree | 0757a485f2e6c0e0c70bb924c4b4acfac53aec5c /libsolidity/AST.cpp | |
parent | ce25ddfa6a9b8cfff08b4a05591dcc3b4a8b63cc (diff) | |
download | dexon-solidity-bc609c55c0fa622a68fa9718c55046416c201b1d.tar dexon-solidity-bc609c55c0fa622a68fa9718c55046416c201b1d.tar.gz dexon-solidity-bc609c55c0fa622a68fa9718c55046416c201b1d.tar.bz2 dexon-solidity-bc609c55c0fa622a68fa9718c55046416c201b1d.tar.lz dexon-solidity-bc609c55c0fa622a68fa9718c55046416c201b1d.tar.xz dexon-solidity-bc609c55c0fa622a68fa9718c55046416c201b1d.tar.zst dexon-solidity-bc609c55c0fa622a68fa9718c55046416c201b1d.zip |
Compute canonical names of types for function signatures.
Diffstat (limited to 'libsolidity/AST.cpp')
-rw-r--r-- | libsolidity/AST.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/libsolidity/AST.cpp b/libsolidity/AST.cpp index 00b51c42..d55bc13c 100644 --- a/libsolidity/AST.cpp +++ b/libsolidity/AST.cpp @@ -135,7 +135,7 @@ vector<pair<FixedHash<4>, FunctionTypePointer>> const& ContractDefinition::inter FunctionType ftype(*v); solAssert(!!v->annotation().type.get(), ""); functionsSeen.insert(v->name()); - FixedHash<4> hash(dev::sha3(ftype.externalSignature(v->name()))); + FixedHash<4> hash(dev::sha3(ftype.externalSignature())); m_interfaceFunctionList->push_back(make_pair(hash, make_shared<FunctionType>(*v))); } } @@ -215,6 +215,13 @@ TypePointer StructDefinition::type(ContractDefinition const*) const return make_shared<TypeType>(make_shared<StructType>(*this)); } +TypeDeclarationAnnotation& StructDefinition::annotation() const +{ + if (!m_annotation) + m_annotation = new TypeDeclarationAnnotation(); + return static_cast<TypeDeclarationAnnotation&>(*m_annotation); +} + TypePointer EnumValue::type(ContractDefinition const*) const { auto parentDef = dynamic_cast<EnumDefinition const*>(scope()); @@ -227,6 +234,13 @@ TypePointer EnumDefinition::type(ContractDefinition const*) const return make_shared<TypeType>(make_shared<EnumType>(*this)); } +TypeDeclarationAnnotation& EnumDefinition::annotation() const +{ + if (!m_annotation) + m_annotation = new TypeDeclarationAnnotation(); + return static_cast<TypeDeclarationAnnotation&>(*m_annotation); +} + TypePointer FunctionDefinition::type(ContractDefinition const*) const { return make_shared<FunctionType>(*this); @@ -234,7 +248,7 @@ TypePointer FunctionDefinition::type(ContractDefinition const*) const string FunctionDefinition::externalSignature() const { - return FunctionType(*this).externalSignature(name()); + return FunctionType(*this).externalSignature(); } TypePointer ModifierDefinition::type(ContractDefinition const*) const |