diff options
author | chriseth <c@ethdev.com> | 2016-03-02 05:56:39 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2016-03-30 08:37:00 +0800 |
commit | f0494307232e52dcc268f5f32d26cc89d7e98e3a (patch) | |
tree | 5a03eae3515eb50d67388e7d7d1193d016baaddf /solc/CommandLineInterface.cpp | |
parent | 949b00ed591303c531ed8fa73087b710b7a554de (diff) | |
download | dexon-solidity-f0494307232e52dcc268f5f32d26cc89d7e98e3a.tar.gz dexon-solidity-f0494307232e52dcc268f5f32d26cc89d7e98e3a.tar.zst dexon-solidity-f0494307232e52dcc268f5f32d26cc89d7e98e3a.zip |
Code generation (missing external access and source locations).
Diffstat (limited to 'solc/CommandLineInterface.cpp')
-rw-r--r-- | solc/CommandLineInterface.cpp | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp index 1cf87bc9..a302e024 100644 --- a/solc/CommandLineInterface.cpp +++ b/solc/CommandLineInterface.cpp @@ -773,7 +773,7 @@ void CommandLineInterface::handleAst(string const& _argStr) void CommandLineInterface::actOnInput() { if (m_onlyAssemble) - return; //@TODO + outputAssembly(); else if (m_onlyLink) writeLinkedFiles(); else @@ -831,27 +831,40 @@ bool CommandLineInterface::assemble() { //@TODO later, we will use the convenience interface and should also remove the include above bool successful = true; - ErrorList errors; map<string, shared_ptr<Scanner>> scanners; for (auto const& src: m_sourceCodes) { auto scanner = make_shared<Scanner>(CharStream(src.second), src.first); scanners[src.first] = scanner; - InlineAssemblyParser parser(errors); - if (!parser.parse(scanner)) + if (!m_assemblyStacks[src.first].parse(scanner)) successful = false; + else + //@TODO we should not just throw away the result here + m_assemblyStacks[src.first].assemble(); } - for (auto const& error: errors) - SourceReferenceFormatter::printExceptionInformation( - cerr, - *error, - (error->type() == Error::Type::Warning) ? "Warning" : "Error", - [&](string const& _source) -> Scanner const& { return *scanners.at(_source); } - ); + for (auto const& stack: m_assemblyStacks) + for (auto const& error: stack.second.errors()) + SourceReferenceFormatter::printExceptionInformation( + cerr, + *error, + (error->type() == Error::Type::Warning) ? "Warning" : "Error", + [&](string const& _source) -> Scanner const& { return *scanners.at(_source); } + ); return successful; } +void CommandLineInterface::outputAssembly() +{ + for (auto const& src: m_sourceCodes) + { + cout << endl << "======= " << src.first << " =======" << endl; + eth::Assembly assembly = m_assemblyStacks[src.first].assemble(); + cout << assembly.assemble().toHex() << endl; + cout << assembly.out(); + } +} + void CommandLineInterface::outputCompilationResults() { handleCombinedJSON(); |