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

Method compileContract

libsolidity/interface/CompilerStack.cpp:1564–1602  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1562}
1563
1564void CompilerStack::compileContract(
1565 ContractDefinition const& _contract,
1566 std::map<ContractDefinition const*, std::shared_ptr<Compiler const>>& _otherCompilers
1567)
1568{
1569 solAssert(!m_viaIR, "");
1570 solUnimplementedAssert(!m_eofVersion.has_value(), "Experimental EOF support is only available for via-IR compilation.");
1571 solAssert(m_stackState >= AnalysisSuccessful, "");
1572
1573 if (_otherCompilers.count(&_contract))
1574 return;
1575
1576 for (auto const& [dependency, referencee]: _contract.annotation().contractDependencies)
1577 compileContract(*dependency, _otherCompilers);
1578
1579 if (!_contract.canBeDeployed())
1580 return;
1581
1582 Contract& compiledContract = m_contracts.at(_contract.fullyQualifiedName());
1583
1584 std::shared_ptr<Compiler> compiler = std::make_shared<Compiler>(
1585 m_evmVersion,
1586 m_eofVersion,
1587 m_revertStrings,
1588 m_optimiserSettings
1589 );
1590
1591 solAssert(!m_viaIR, "");
1592 bytes cborEncodedMetadata = createCBORMetadata(compiledContract, /* _forIR */ false);
1593
1594 // Run optimiser and compile the contract.
1595 compiler->compileContract(_contract, _otherCompilers, cborEncodedMetadata);
1596 compiledContract.generatedYulUtilityCode = compiler->generatedYulUtilityCode();
1597 compiledContract.runtimeGeneratedYulUtilityCode = compiler->runtimeGeneratedYulUtilityCode();
1598
1599 _otherCompilers[compiledContract.contract] = compiler;
1600
1601 assembleYul(_contract, compiler->assemblyPtr(), compiler->runtimeAssemblyPtr());
1602}
1603
1604void CompilerStack::generateIR(ContractDefinition const& _contract, bool _unoptimizedOnly)
1605{

Callers

nothing calls this directly

Calls 9

compileContractFunction · 0.85
canBeDeployedMethod · 0.80
atMethod · 0.80
fullyQualifiedNameMethod · 0.80
runtimeAssemblyPtrMethod · 0.80
countMethod · 0.45
assemblyPtrMethod · 0.45

Tested by

no test coverage detected