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

Method compile

libsolidity/interface/StandardCompiler.cpp:1921–1954  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1919}
1920
1921Json StandardCompiler::compile(Json const& _input) noexcept
1922{
1923 YulStringRepository::reset();
1924
1925 try
1926 {
1927 auto parsed = parseInput(_input);
1928 if (std::holds_alternative<Json>(parsed))
1929 return std::get<Json>(std::move(parsed));
1930 InputsAndSettings settings = std::get<InputsAndSettings>(std::move(parsed));
1931 if (settings.language == "Solidity")
1932 return compileSolidity(std::move(settings));
1933 else if (settings.language == "Yul")
1934 return compileYul(std::move(settings));
1935 else if (settings.language == "SolidityAST")
1936 return compileSolidity(std::move(settings));
1937 else if (settings.language == "EVMAssembly")
1938 return importEVMAssembly(std::move(settings));
1939 else
1940 return formatFatalError(Error::Type::JSONError, "Only \"Solidity\", \"Yul\", \"SolidityAST\" or \"EVMAssembly\" is supported as a language.");
1941 }
1942 catch (UnimplementedFeatureError const& _exception)
1943 {
1944 solAssert(_exception.comment(), "Unimplemented feature errors must include a message for the user");
1945 return formatFatalError(Error::Type::UnimplementedFeatureError, stringOrDefault(_exception.comment()));
1946 }
1947 catch (...)
1948 {
1949 return formatFatalError(
1950 Error::Type::InternalCompilerError,
1951 "Uncaught exception:\n" + boost::current_exception_diagnostic_information()
1952 );
1953 }
1954}
1955
1956std::string StandardCompiler::compile(std::string const& _input) noexcept
1957{

Callers 1

compileSolidityMethod · 0.45

Calls 7

formatFatalErrorFunction · 0.85
stringOrDefaultFunction · 0.85
jsonParseStrictFunction · 0.85
jsonPrintFunction · 0.85
commentMethod · 0.80
compileFunction · 0.50
emptyMethod · 0.45

Tested by

no test coverage detected