diff options
author | Christian <c@ethdev.com> | 2014-12-04 01:52:28 +0800 |
---|---|---|
committer | Christian <c@ethdev.com> | 2014-12-04 01:52:28 +0800 |
commit | d2cf34548322598ae067434a61a171bd190fc2c9 (patch) | |
tree | 9f89db707b8435f4774aea1115249e076fb37b74 /CompilerStack.cpp | |
parent | 254df50feab6bb4c9f013257591b73919e4013a5 (diff) | |
download | dexon-solidity-d2cf34548322598ae067434a61a171bd190fc2c9.tar.gz dexon-solidity-d2cf34548322598ae067434a61a171bd190fc2c9.tar.zst dexon-solidity-d2cf34548322598ae067434a61a171bd190fc2c9.zip |
Improved external interface for multi-source and multi-contract compilation.
Diffstat (limited to 'CompilerStack.cpp')
-rw-r--r-- | CompilerStack.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
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<string> CompilerStack::getContractNames() { if (!m_parseSuccessful) BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Parsing was not successful.")); + vector<string> 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<ASTNode> const& node: source->ast->getNodes()) if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get())) |