aboutsummaryrefslogtreecommitdiffstats
path: root/Compiler.cpp
diff options
context:
space:
mode:
authorLefteris Karapetsas <lefteris@refu.co>2015-01-23 23:37:06 +0800
committerLefteris Karapetsas <lefteris@refu.co>2015-01-29 04:46:16 +0800
commit5c7359aa09c46eb7fc27a70e328adde93d4844ab (patch)
treedf6c6146f6d3b417fdc7312faac11df2374487bc /Compiler.cpp
parent3cc04923015cc3f40ad285fba5ed71464bd9ff2a (diff)
downloaddexon-solidity-5c7359aa09c46eb7fc27a70e328adde93d4844ab.tar
dexon-solidity-5c7359aa09c46eb7fc27a70e328adde93d4844ab.tar.gz
dexon-solidity-5c7359aa09c46eb7fc27a70e328adde93d4844ab.tar.bz2
dexon-solidity-5c7359aa09c46eb7fc27a70e328adde93d4844ab.tar.lz
dexon-solidity-5c7359aa09c46eb7fc27a70e328adde93d4844ab.tar.xz
dexon-solidity-5c7359aa09c46eb7fc27a70e328adde93d4844ab.tar.zst
dexon-solidity-5c7359aa09c46eb7fc27a70e328adde93d4844ab.zip
State variable accessors code is now more organized
- FunctionDescription is the abstraction of what should describe a function. It can either be a VariableDeclaration of a FunctionDefinition. - ParamDescription is what FunctionDescription uses to describe its parameters for outside use purposes with a pair of (name, type) strings - Modified code around Solidity and especially interface handler to adapt to this change
Diffstat (limited to 'Compiler.cpp')
-rw-r--r--Compiler.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/Compiler.cpp b/Compiler.cpp
index 13f8282e..f6f48a8c 100644
--- a/Compiler.cpp
+++ b/Compiler.cpp
@@ -177,13 +177,14 @@ void Compiler::appendConstructorCall(FunctionDefinition const& _constructor)
unsigned argumentSize = 0;
for (ASTPointer<VariableDeclaration> const& var: _constructor.getParameters())
argumentSize += CompilerUtils::getPaddedSize(var->getType()->getCalldataEncodedSize());
+
if (argumentSize > 0)
{
m_context << u256(argumentSize);
m_context.appendProgramSize();
m_context << u256(CompilerUtils::dataStartOffset); // copy it to byte four as expected for ABI calls
m_context << eth::Instruction::CODECOPY;
- appendCalldataUnpacker(_constructor, true);
+ appendCalldataUnpacker(FunctionType(_constructor).getParameterTypes(), true);
}
m_context.appendJumpTo(m_context.getFunctionEntryLabel(_constructor));
m_context << returnTag;
@@ -201,7 +202,7 @@ set<FunctionDefinition const*> Compiler::getFunctionsCalled(set<ASTNode const*>
void Compiler::appendFunctionSelector(ContractDefinition const& _contract)
{
- map<FixedHash<4>, FunctionType const*, Declaration const*> interfaceFunctions = _contract.getInterfaceFunctions();
+ map<FixedHash<4>, FunctionDescription> interfaceFunctions = _contract.getInterfaceFunctions();
map<FixedHash<4>, const eth::AssemblyItem> callDataUnpackerEntryPoints;
// retrieve the function signature hash from the calldata
@@ -219,11 +220,11 @@ void Compiler::appendFunctionSelector(ContractDefinition const& _contract)
for (auto const& it: interfaceFunctions)
{
- FunctionType const* functionType = *it.second.first;
+ FunctionType const* functionType = it.second.getFunctionType();
m_context << callDataUnpackerEntryPoints.at(it.first);
eth::AssemblyItem returnTag = m_context.pushNewTag();
appendCalldataUnpacker(functionType->getParameterTypes());
- m_context.appendJumpTo(m_context.getFunctionEntryLabel(it.second.second));
+ m_context.appendJumpTo(m_context.getFunctionEntryLabel(*it.second.getDeclaration()));
m_context << returnTag;
appendReturnValuePacker(functionType->getReturnParameterTypes());
}