@returns The set of selected contracts, along with their compiler pipeline configuration, based on outputs requested in the JSON. Translates wildcards to the ones understood by CompilerStack. Note that as an exception, '*' does not yet match "ir", "irAst", "irOptimized" or "irOptimizedAst".
| 366 | /// on outputs requested in the JSON. Translates wildcards to the ones understood by CompilerStack. |
| 367 | /// Note that as an exception, '*' does not yet match "ir", "irAst", "irOptimized" or "irOptimizedAst". |
| 368 | CompilerStack::ContractSelection pipelineConfig( |
| 369 | Json const& _jsonOutputSelection |
| 370 | ) |
| 371 | { |
| 372 | if (!_jsonOutputSelection.is_object()) |
| 373 | return {}; |
| 374 | |
| 375 | CompilerStack::ContractSelection contractSelection; |
| 376 | for (auto const& [sourceUnitName, jsonOutputSelectionForSource]: _jsonOutputSelection.items()) |
| 377 | { |
| 378 | solAssert(jsonOutputSelectionForSource.is_object()); |
| 379 | for (auto const& [contractName, jsonOutputSelectionForContract]: jsonOutputSelectionForSource.items()) |
| 380 | { |
| 381 | solAssert(jsonOutputSelectionForContract.is_array()); |
| 382 | CompilerStack::PipelineConfig pipelineForContract; |
| 383 | for (Json const& request: jsonOutputSelectionForContract) |
| 384 | { |
| 385 | solAssert(request.is_string()); |
| 386 | pipelineForContract.irOptimization = |
| 387 | pipelineForContract.irOptimization || |
| 388 | request == "irOptimized" || |
| 389 | request == "irOptimizedAst" || |
| 390 | request == "yulCFGJson"; |
| 391 | pipelineForContract.irCodegen = |
| 392 | pipelineForContract.irCodegen || |
| 393 | pipelineForContract.irOptimization || |
| 394 | request == "ir" || |
| 395 | request == "irAst"; |
| 396 | pipelineForContract.bytecode = isEvmBytecodeRequested(_jsonOutputSelection); |
| 397 | } |
| 398 | std::string key = (sourceUnitName == "*") ? "" : sourceUnitName; |
| 399 | std::string value = (contractName == "*") ? "" : contractName; |
| 400 | contractSelection[key][value] = pipelineForContract; |
| 401 | } |
| 402 | } |
| 403 | return contractSelection; |
| 404 | } |
| 405 | |
| 406 | Json formatLinkReferences(std::map<size_t, std::string> const& linkReferences) |
| 407 | { |
no test coverage detected