renamed externalTypes to externalSignature

This commit is contained in:
Liana Husikyan 2015-03-24 11:11:27 +01:00
parent 701b34fbeb
commit 9986b072ad
6 changed files with 15 additions and 15 deletions

12
AST.cpp
View File

@ -88,7 +88,7 @@ void ContractDefinition::checkTypeRequirements()
if (hashes.count(hash)) if (hashes.count(hash))
BOOST_THROW_EXCEPTION(createTypeError( BOOST_THROW_EXCEPTION(createTypeError(
std::string("Function signature hash collision for ") + std::string("Function signature hash collision for ") +
it.second->externalTypes())); it.second->externalSignature()));
hashes.insert(hash); hashes.insert(hash);
} }
} }
@ -192,7 +192,7 @@ vector<pair<FixedHash<4>, FunctionTypePointer>> const& ContractDefinition::getIn
if (functionsSeen.count(f->getName()) == 0 && f->isPartOfExternalInterface()) if (functionsSeen.count(f->getName()) == 0 && f->isPartOfExternalInterface())
{ {
functionsSeen.insert(f->getName()); functionsSeen.insert(f->getName());
FixedHash<4> hash(dev::sha3(f->externalTypes())); FixedHash<4> hash(dev::sha3(f->externalSignature()));
m_interfaceFunctionList->push_back(make_pair(hash, make_shared<FunctionType>(*f, false))); m_interfaceFunctionList->push_back(make_pair(hash, make_shared<FunctionType>(*f, false)));
} }
@ -202,7 +202,7 @@ vector<pair<FixedHash<4>, FunctionTypePointer>> const& ContractDefinition::getIn
FunctionType ftype(*v); FunctionType ftype(*v);
solAssert(v->getType().get(), ""); solAssert(v->getType().get(), "");
functionsSeen.insert(v->getName()); functionsSeen.insert(v->getName());
FixedHash<4> hash(dev::sha3(ftype.externalTypes(v->getName()))); FixedHash<4> hash(dev::sha3(ftype.externalSignature(v->getName())));
m_interfaceFunctionList->push_back(make_pair(hash, make_shared<FunctionType>(*v))); m_interfaceFunctionList->push_back(make_pair(hash, make_shared<FunctionType>(*v)));
} }
} }
@ -320,9 +320,9 @@ void FunctionDefinition::checkTypeRequirements()
m_body->checkTypeRequirements(); m_body->checkTypeRequirements();
} }
string FunctionDefinition::externalTypes() const string FunctionDefinition::externalSignature() const
{ {
return FunctionType(*this).externalTypes(getName()); return FunctionType(*this).externalSignature(getName());
} }
bool VariableDeclaration::isLValue() const bool VariableDeclaration::isLValue() const
@ -430,7 +430,7 @@ void EventDefinition::checkTypeRequirements()
numIndexed++; numIndexed++;
if (!var->getType()->canLiveOutsideStorage()) if (!var->getType()->canLiveOutsideStorage())
BOOST_THROW_EXCEPTION(var->createTypeError("Type is required to live outside storage.")); BOOST_THROW_EXCEPTION(var->createTypeError("Type is required to live outside storage."));
if (!var->getType()->externalType() && getVisibility() >= Visibility::Public) if (!var->getType()->externalType())
BOOST_THROW_EXCEPTION(var->createTypeError("Internal type is not allowed for Events")); BOOST_THROW_EXCEPTION(var->createTypeError("Internal type is not allowed for Events"));
} }
if (numIndexed > 3) if (numIndexed > 3)

6
AST.h
View File

@ -421,10 +421,10 @@ public:
/// Checks that all parameters have allowed types and calls checkTypeRequirements on the body. /// Checks that all parameters have allowed types and calls checkTypeRequirements on the body.
void checkTypeRequirements(); void checkTypeRequirements();
/// @returns the canonical signature of the function /// @returns the external signature of the function
/// That consists of the name of the function followed by the types of the /// That consists of the name of the function followed by the external types of the
/// arguments separated by commas all enclosed in parentheses without any spaces. /// arguments separated by commas all enclosed in parentheses without any spaces.
std::string externalTypes() const; std::string externalSignature() const;
private: private:
bool m_isConstructor; bool m_isConstructor;

View File

@ -544,7 +544,7 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall)
} }
if (!event.isAnonymous()) if (!event.isAnonymous())
{ {
m_context << u256(h256::Arith(dev::sha3(function.externalTypes(event.getName())))); m_context << u256(h256::Arith(dev::sha3(function.externalSignature(event.getName()))));
++numIndexed; ++numIndexed;
} }
solAssert(numIndexed <= 4, "Too many indexed arguments."); solAssert(numIndexed <= 4, "Too many indexed arguments.");

View File

@ -129,7 +129,7 @@ std::unique_ptr<std::string> InterfaceHandler::getUserDocumentation(ContractDefi
if (!m_notice.empty()) if (!m_notice.empty())
{// since @notice is the only user tag if missing function should not appear {// since @notice is the only user tag if missing function should not appear
user["notice"] = Json::Value(m_notice); user["notice"] = Json::Value(m_notice);
methods[it.second->externalTypes()] = user; methods[it.second->externalSignature()] = user;
} }
} }
} }
@ -185,7 +185,7 @@ std::unique_ptr<std::string> InterfaceHandler::getDevDocumentation(ContractDefin
method["return"] = m_return; method["return"] = m_return;
if (!method.empty()) // add the function, only if we have any documentation to add if (!method.empty()) // add the function, only if we have any documentation to add
methods[it.second->externalTypes()] = method; methods[it.second->externalSignature()] = method;
} }
} }
doc["methods"] = methods; doc["methods"] = methods;

View File

@ -1127,7 +1127,7 @@ MemberList const& FunctionType::getMembers() const
} }
} }
string FunctionType::externalTypes(std::string const& _name) const string FunctionType::externalSignature(std::string const& _name) const
{ {
std::string funcName = _name; std::string funcName = _name;
if (_name == "") if (_name == "")

View File

@ -550,10 +550,10 @@ public:
virtual MemberList const& getMembers() const override; virtual MemberList const& getMembers() const override;
Location const& getLocation() const { return m_location; } Location const& getLocation() const { return m_location; }
/// @returns the external type of this function type given the function name /// @returns the external signature of this function type given the function name
/// If @a _name is not provided (empty string) then the @c m_declaration member of the /// If @a _name is not provided (empty string) then the @c m_declaration member of the
/// function type is used /// function type is used
std::string externalTypes(std::string const& _name = "") const; std::string externalSignature(std::string const& _name = "") const;
Declaration const& getDeclaration() const Declaration const& getDeclaration() const
{ {
solAssert(m_declaration, "Requested declaration from a FunctionType that has none"); solAssert(m_declaration, "Requested declaration from a FunctionType that has none");