| 440 | } |
| 441 | |
| 442 | void CompilerStack::importASTs(std::map<std::string, Json> const& _sources) |
| 443 | { |
| 444 | solAssert(m_stackState == Empty, "Must call importASTs only before the SourcesSet state."); |
| 445 | std::map<std::string, ASTPointer<SourceUnit>> reconstructedSources = |
| 446 | ASTJsonImporter(m_evmVersion, m_eofVersion).jsonToSourceUnit(_sources); |
| 447 | for (auto& src: reconstructedSources) |
| 448 | { |
| 449 | solUnimplementedAssert(!src.second->experimentalSolidity()); |
| 450 | std::string const& path = src.first; |
| 451 | Source source; |
| 452 | source.ast = src.second; |
| 453 | source.charStream = std::make_shared<CharStream>( |
| 454 | util::jsonCompactPrint(_sources.at(src.first)), |
| 455 | src.first, |
| 456 | true // imported from AST |
| 457 | ); |
| 458 | m_sources[path] = std::move(source); |
| 459 | } |
| 460 | m_stackState = ParsedAndImported; |
| 461 | m_compilationSourceType = CompilationSourceType::SolidityAST; |
| 462 | |
| 463 | storeContractDefinitions(); |
| 464 | } |
| 465 | |
| 466 | namespace |
| 467 | { |
no test coverage detected