From d2cf34548322598ae067434a61a171bd190fc2c9 Mon Sep 17 00:00:00 2001 From: Christian Date: Wed, 3 Dec 2014 18:52:28 +0100 Subject: Improved external interface for multi-source and multi-contract compilation. --- CompilerStack.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'CompilerStack.cpp') diff --git a/CompilerStack.cpp b/CompilerStack.cpp index 49ac3b64..198ded09 100644 --- a/CompilerStack.cpp +++ b/CompilerStack.cpp @@ -81,10 +81,20 @@ void CompilerStack::parse(string const& _sourceCode) parse(); } -void CompilerStack::compile(bool _optimize) +vector CompilerStack::getContractNames() { if (!m_parseSuccessful) BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Parsing was not successful.")); + vector contractNames; + for (auto const& contract: m_contracts) + contractNames.push_back(contract.first); + return contractNames; +} + +void CompilerStack::compile(bool _optimize) +{ + if (!m_parseSuccessful) + parse(); for (Source const* source: m_sourceOrder) for (ASTPointer const& node: source->ast->getNodes()) if (ContractDefinition* contract = dynamic_cast(node.get())) -- cgit