aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-10-16 21:20:25 +0800
committerchriseth <c@ethdev.com>2015-10-16 21:20:25 +0800
commitfd8eb2d074acbad1a16bd7a286eea7a192723960 (patch)
tree39dcc1fab4eff3bbad4c5faf5943c83d2d076475
parente5d473448bbe980594d5f923823f349731922de3 (diff)
parentcd9132672a71f8edf6f18ba5588b5b70f20ed186 (diff)
downloaddexon-solidity-fd8eb2d074acbad1a16bd7a286eea7a192723960.tar.gz
dexon-solidity-fd8eb2d074acbad1a16bd7a286eea7a192723960.tar.zst
dexon-solidity-fd8eb2d074acbad1a16bd7a286eea7a192723960.zip
Merge pull request #141 from chriseth/fixExternalTypes
Do not include function in interface list if there are errors.
-rw-r--r--libsolidity/AST.cpp25
1 files changed, 11 insertions, 14 deletions
diff --git a/libsolidity/AST.cpp b/libsolidity/AST.cpp
index f184e037..062febb9 100644
--- a/libsolidity/AST.cpp
+++ b/libsolidity/AST.cpp
@@ -115,29 +115,26 @@ vector<pair<FixedHash<4>, FunctionTypePointer>> const& ContractDefinition::inter
m_interfaceFunctionList.reset(new vector<pair<FixedHash<4>, FunctionTypePointer>>());
for (ContractDefinition const* contract: annotation().linearizedBaseContracts)
{
+ vector<FunctionTypePointer> functions;
for (ASTPointer<FunctionDefinition> const& f: contract->definedFunctions())
+ if (f->isPartOfExternalInterface())
+ functions.push_back(make_shared<FunctionType>(*f, false));
+ for (ASTPointer<VariableDeclaration> const& v: contract->stateVariables())
+ if (v->isPartOfExternalInterface())
+ functions.push_back(make_shared<FunctionType>(*v));
+ for (FunctionTypePointer const& fun: functions)
{
- if (!f->isPartOfExternalInterface())
+ if (!fun->interfaceFunctionType())
+ // Fails hopefully because we already registered the error
continue;
- string functionSignature = f->externalSignature();
+ string functionSignature = fun->externalSignature();
if (signaturesSeen.count(functionSignature) == 0)
{
- functionsSeen.insert(f->name());
signaturesSeen.insert(functionSignature);
FixedHash<4> hash(dev::sha3(functionSignature));
- m_interfaceFunctionList->push_back(make_pair(hash, make_shared<FunctionType>(*f, false)));
+ m_interfaceFunctionList->push_back(make_pair(hash, fun));
}
}
-
- for (ASTPointer<VariableDeclaration> const& v: contract->stateVariables())
- if (functionsSeen.count(v->name()) == 0 && v->isPartOfExternalInterface())
- {
- FunctionType ftype(*v);
- solAssert(!!v->annotation().type.get(), "");
- functionsSeen.insert(v->name());
- FixedHash<4> hash(dev::sha3(ftype.externalSignature()));
- m_interfaceFunctionList->push_back(make_pair(hash, make_shared<FunctionType>(*v)));
- }
}
}
return *m_interfaceFunctionList;