Solidity EntryLabel now uses a generic declaration

- Instead of a FunctionDefinition
This commit is contained in:
Lefteris Karapetsas 2015-01-26 14:41:56 +01:00
parent 3f5eb96584
commit b95048768d
3 changed files with 11 additions and 7 deletions

View File

@ -43,9 +43,13 @@ void Compiler::compileContract(ContractDefinition const& _contract,
for (ContractDefinition const* contract: _contract.getLinearizedBaseContracts())
{
for (ASTPointer<FunctionDefinition> const& function: contract->getDefinedFunctions())
if (!function->isConstructor())
m_context.addFunction(*function);
for (auto const& it: contract->getInterfaceFunctions())
{
auto funcDef = it.second.getFunctionDefinition();
if (funcDef && funcDef->isConstructor())
continue;
m_context.addFunction(*it.second.getDeclaration());
}
for (ASTPointer<ModifierDefinition> const& modifier: contract->getFunctionModifiers())
m_context.addModifier(*modifier);
}

View File

@ -59,11 +59,11 @@ void CompilerContext::addAndInitializeVariable(VariableDeclaration const& _decla
*this << u256(0);
}
void CompilerContext::addFunction(FunctionDefinition const& _function)
void CompilerContext::addFunction(Declaration const& _decl)
{
eth::AssemblyItem tag(m_asm.newTag());
m_functionEntryLabels.insert(make_pair(&_function, tag));
m_virtualFunctionEntryLabels.insert(make_pair(_function.getName(), tag));
m_functionEntryLabels.insert(make_pair(&_decl, tag));
m_virtualFunctionEntryLabels.insert(make_pair(_decl.getName(), tag));
}
void CompilerContext::addModifier(ModifierDefinition const& _modifier)

View File

@ -44,7 +44,7 @@ public:
void startNewFunction() { m_localVariables.clear(); m_asm.setDeposit(0); }
void addVariable(VariableDeclaration const& _declaration, unsigned _offsetToCurrent = 0);
void addAndInitializeVariable(VariableDeclaration const& _declaration);
void addFunction(FunctionDefinition const& _function);
void addFunction(Declaration const& _decl);
/// Adds the given modifier to the list by name if the name is not present already.
void addModifier(ModifierDefinition const& _modifier);