MCPcopy Create free account
hub / github.com/argotorg/solidity / entryLabel

Method entryLabel

libsolidity/codegen/CompilerContext.cpp:576–608  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

574}
575
576evmasm::AssemblyItem CompilerContext::FunctionCompilationQueue::entryLabel(
577 Declaration const& _declaration,
578 CompilerContext& _context
579)
580{
581 auto res = m_entryLabels.find(&_declaration);
582 if (res == m_entryLabels.end())
583 {
584 size_t params = 0;
585 size_t returns = 0;
586 if (auto const* function = dynamic_cast<FunctionDefinition const*>(&_declaration))
587 {
588 FunctionType functionType(*function, FunctionType::Kind::Internal);
589 params = CompilerUtils::sizeOnStack(functionType.parameterTypes());
590 returns = CompilerUtils::sizeOnStack(functionType.returnParameterTypes());
591 }
592
593 // some name that cannot clash with yul function names.
594 std::string labelName = "@" + _declaration.name() + "_" + std::to_string(_declaration.id());
595 evmasm::AssemblyItem tag = _context.namedTag(
596 labelName,
597 params,
598 returns,
599 _declaration.id()
600 );
601 m_entryLabels.insert(std::make_pair(&_declaration, tag));
602 m_functionsToCompile.push(&_declaration);
603 return tag.tag();
604 }
605 else
606 return res->second.tag();
607
608}
609
610evmasm::AssemblyItem CompilerContext::FunctionCompilationQueue::entryLabelIfExists(Declaration const& _declaration) const
611{

Callers 1

functionEntryLabelMethod · 0.80

Calls 10

parameterTypesMethod · 0.80
insertMethod · 0.80
tagMethod · 0.80
to_stringFunction · 0.50
findMethod · 0.45
endMethod · 0.45
nameMethod · 0.45
idMethod · 0.45
namedTagMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected