| 1919 | } |
| 1920 | |
| 1921 | Json 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 | |
| 1956 | std::string StandardCompiler::compile(std::string const& _input) noexcept |
| 1957 | { |
no test coverage detected