From bc609c55c0fa622a68fa9718c55046416c201b1d Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 5 Oct 2015 17:19:23 +0200 Subject: Compute canonical names of types for function signatures. --- libsolidity/AST.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'libsolidity/AST.cpp') 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, 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(*v))); } } @@ -215,6 +215,13 @@ TypePointer StructDefinition::type(ContractDefinition const*) const return make_shared(make_shared(*this)); } +TypeDeclarationAnnotation& StructDefinition::annotation() const +{ + if (!m_annotation) + m_annotation = new TypeDeclarationAnnotation(); + return static_cast(*m_annotation); +} + TypePointer EnumValue::type(ContractDefinition const*) const { auto parentDef = dynamic_cast(scope()); @@ -227,6 +234,13 @@ TypePointer EnumDefinition::type(ContractDefinition const*) const return make_shared(make_shared(*this)); } +TypeDeclarationAnnotation& EnumDefinition::annotation() const +{ + if (!m_annotation) + m_annotation = new TypeDeclarationAnnotation(); + return static_cast(*m_annotation); +} + TypePointer FunctionDefinition::type(ContractDefinition const*) const { return make_shared(*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 -- cgit