| 1456 | } |
| 1457 | |
| 1458 | Json StandardCompiler::compileSolidity(StandardCompiler::InputsAndSettings _inputsAndSettings) |
| 1459 | { |
| 1460 | solAssert(_inputsAndSettings.jsonSources.empty()); |
| 1461 | |
| 1462 | CompilerStack compilerStack(m_readFile); |
| 1463 | |
| 1464 | StringMap sourceList = std::move(_inputsAndSettings.sources); |
| 1465 | if (_inputsAndSettings.language == "Solidity") |
| 1466 | compilerStack.setSources(sourceList); |
| 1467 | for (auto const& smtLib2Response: _inputsAndSettings.smtLib2Responses) |
| 1468 | compilerStack.addSMTLib2Response(smtLib2Response.first, smtLib2Response.second); |
| 1469 | compilerStack.setViaIR(_inputsAndSettings.viaIR); |
| 1470 | compilerStack.setViaSSACFG(_inputsAndSettings.viaSSACFG); |
| 1471 | compilerStack.setEVMVersion(_inputsAndSettings.evmVersion); |
| 1472 | compilerStack.setEOFVersion(_inputsAndSettings.eofVersion); |
| 1473 | compilerStack.setRemappings(std::move(_inputsAndSettings.remappings)); |
| 1474 | compilerStack.setOptimiserSettings(std::move(_inputsAndSettings.optimiserSettings)); |
| 1475 | compilerStack.setRevertStringBehaviour(_inputsAndSettings.revertStrings); |
| 1476 | if (_inputsAndSettings.debugInfoSelection.has_value()) |
| 1477 | compilerStack.selectDebugInfo(_inputsAndSettings.debugInfoSelection.value()); |
| 1478 | compilerStack.setLibraries(_inputsAndSettings.libraries); |
| 1479 | compilerStack.useMetadataLiteralSources(_inputsAndSettings.metadataLiteralSources); |
| 1480 | compilerStack.setMetadataFormat(_inputsAndSettings.metadataFormat); |
| 1481 | compilerStack.setMetadataHash(_inputsAndSettings.metadataHash); |
| 1482 | compilerStack.selectContracts(pipelineConfig(_inputsAndSettings.outputSelection)); |
| 1483 | compilerStack.setModelCheckerSettings(_inputsAndSettings.modelCheckerSettings); |
| 1484 | compilerStack.setExperimental(_inputsAndSettings.experimental); |
| 1485 | |
| 1486 | Json errors = std::move(_inputsAndSettings.errors); |
| 1487 | |
| 1488 | bool const binariesRequested = isBinaryRequested(_inputsAndSettings.outputSelection); |
| 1489 | |
| 1490 | try |
| 1491 | { |
| 1492 | if (_inputsAndSettings.language == "SolidityAST") |
| 1493 | { |
| 1494 | try |
| 1495 | { |
| 1496 | compilerStack.importASTs(parseAstFromInput(sourceList)); |
| 1497 | if (!compilerStack.analyze()) |
| 1498 | errors.emplace_back(formatError(Error::Type::FatalError, "general", "Analysis of the AST failed.")); |
| 1499 | if (binariesRequested) |
| 1500 | compilerStack.compile(); |
| 1501 | } |
| 1502 | catch (util::Exception const& _exc) |
| 1503 | { |
| 1504 | solThrow(util::Exception, "Failed to import AST: "s + _exc.what()); |
| 1505 | } |
| 1506 | } |
| 1507 | else |
| 1508 | { |
| 1509 | if (binariesRequested) |
| 1510 | compilerStack.compile(); |
| 1511 | else |
| 1512 | compilerStack.parseAndAnalyze(_inputsAndSettings.stopAfter); |
| 1513 | |
| 1514 | for (auto const& error: compilerStack.errors()) |
| 1515 | errors.emplace_back(formatErrorWithException( |
nothing calls this directly
no test coverage detected