aboutsummaryrefslogtreecommitdiffstats
path: root/AST.cpp
diff options
context:
space:
mode:
authorLefteris Karapetsas <lefteris@refu.co>2015-01-07 23:39:21 +0800
committerLefteris Karapetsas <lefteris@refu.co>2015-01-07 23:39:21 +0800
commitc55608f94b834d5286c4b638dd4daa77cf406807 (patch)
treefb60c5c2a916e8fa1b4e06915bd233f81cb8bd08 /AST.cpp
parentdf0dce584d2d1aacf3d33658b0540f243b3adb81 (diff)
downloaddexon-solidity-c55608f94b834d5286c4b638dd4daa77cf406807.tar.gz
dexon-solidity-c55608f94b834d5286c4b638dd4daa77cf406807.tar.zst
dexon-solidity-c55608f94b834d5286c4b638dd4daa77cf406807.zip
Solidity getInterfaceFunctions is now a map of hash to Function
- Also introduced dependency between libsolidity and libdevcrypto - Compler's appendFunctionSelector now has a first version of using function signature hash instead of index
Diffstat (limited to 'AST.cpp')
-rw-r--r--AST.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/AST.cpp b/AST.cpp
index 0c56cb7a..300303ac 100644
--- a/AST.cpp
+++ b/AST.cpp
@@ -27,6 +27,8 @@
#include <libsolidity/Exceptions.h>
#include <libsolidity/AST_accept.h>
+#include <libdevcrypto/SHA3.h>
+
using namespace std;
namespace dev
@@ -50,18 +52,16 @@ void ContractDefinition::checkTypeRequirements()
function->checkTypeRequirements();
}
-vector<FunctionDefinition const*> ContractDefinition::getInterfaceFunctions() const
+map<FixedHash<4>, FunctionDefinition const*> ContractDefinition::getInterfaceFunctions() const
{
- vector<FunctionDefinition const*> exportedFunctions;
+ map<FixedHash<4>, FunctionDefinition const*> exportedFunctions;
for (ASTPointer<FunctionDefinition> const& f: m_definedFunctions)
if (f->isPublic() && f->getName() != getName())
- exportedFunctions.push_back(f.get());
- auto compareNames = [](FunctionDefinition const* _a, FunctionDefinition const* _b)
- {
- return _a->getName().compare(_b->getName()) < 0;
- };
+ {
+ FixedHash<4> hash(dev::sha3(f->getCanonicalSignature()));
+ exportedFunctions[hash] = f.get();
+ }
- sort(exportedFunctions.begin(), exportedFunctions.end(), compareNames);
return exportedFunctions;
}