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

Function checkOutputSelection

libsolidity/interface/StandardCompiler.cpp:580–619  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

578}
579
580std::optional<Json> checkOutputSelection(Json const& _outputSelection)
581{
582 if (!_outputSelection.empty() && !_outputSelection.is_object())
583 return formatFatalError(Error::Type::JSONError, "\"settings.outputSelection\" must be an object");
584
585 for (auto const& [sourceName, sourceVal]: _outputSelection.items())
586 {
587 if (!sourceVal.is_object())
588 return formatFatalError(
589 Error::Type::JSONError,
590 "\"settings.outputSelection." + sourceName + "\" must be an object"
591 );
592
593 for (auto const& [contractName, contractVal]: sourceVal.items())
594 {
595 if (!contractVal.is_array())
596 return formatFatalError(
597 Error::Type::JSONError,
598 "\"settings.outputSelection." +
599 sourceName +
600 "." +
601 contractName +
602 "\" must be a string array"
603 );
604
605 for (auto const& output: contractVal)
606 if (!output.is_string())
607 return formatFatalError(
608 Error::Type::JSONError,
609 "\"settings.outputSelection." +
610 sourceName +
611 "." +
612 contractName +
613 "\" must be a string array"
614 );
615 }
616 }
617
618 return std::nullopt;
619}
620
621/// Validates the optimizer settings and returns them in a parsed object.
622/// On error returns the json-formatted error message.

Callers 1

parseInputMethod · 0.85

Calls 2

formatFatalErrorFunction · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected