aboutsummaryrefslogtreecommitdiffstats
path: root/Compiler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Compiler.cpp')
-rw-r--r--Compiler.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/Compiler.cpp b/Compiler.cpp
index 1fa31ce7..3c46d455 100644
--- a/Compiler.cpp
+++ b/Compiler.cpp
@@ -146,8 +146,8 @@ void Compiler::appendFunctionSelector(ContractDefinition const& _contract)
map<FixedHash<4>, const eth::AssemblyItem> callDataUnpackerEntryPoints;
// retrieve the function signature hash from the calldata
- m_context << u256(1) << u256(0);
- CompilerUtils(m_context).loadFromMemory(0, 4, false, true);
+ if (!interfaceFunctions.empty())
+ CompilerUtils(m_context).loadFromMemory(0, 4, false, true);
// stack now is: 1 0 <funhash>
for (auto const& it: interfaceFunctions)
@@ -156,7 +156,15 @@ void Compiler::appendFunctionSelector(ContractDefinition const& _contract)
m_context << eth::dupInstruction(1) << u256(FixedHash<4>::Arith(it.first)) << eth::Instruction::EQ;
m_context.appendConditionalJumpTo(callDataUnpackerEntryPoints.at(it.first));
}
- m_context << eth::Instruction::STOP; // function not found
+ if (FunctionDefinition const* fallback = _contract.getFallbackFunction())
+ {
+ eth::AssemblyItem returnTag = m_context.pushNewTag();
+ fallback->accept(*this);
+ m_context << returnTag;
+ appendReturnValuePacker(FunctionType(*fallback).getReturnParameterTypes());
+ }
+ else
+ m_context << eth::Instruction::STOP; // function not found
for (auto const& it: interfaceFunctions)
{