aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Kotewicz <marek.kotewicz@gmail.com>2014-11-14 21:08:44 +0800
committerMarek Kotewicz <marek.kotewicz@gmail.com>2014-11-14 21:08:44 +0800
commit7dbfde91e39dbcf69bc169c9bb1351987fba2be3 (patch)
treef1edbefe354bae356fb93337d54e972740b25da4
parenta5e5516a01e903ec906af96e4b3a55f191ad1c32 (diff)
parentad4b027781a4f7b8adfd708b3b37c2b4bec99a83 (diff)
downloaddexon-solidity-7dbfde91e39dbcf69bc169c9bb1351987fba2be3.tar
dexon-solidity-7dbfde91e39dbcf69bc169c9bb1351987fba2be3.tar.gz
dexon-solidity-7dbfde91e39dbcf69bc169c9bb1351987fba2be3.tar.bz2
dexon-solidity-7dbfde91e39dbcf69bc169c9bb1351987fba2be3.tar.lz
dexon-solidity-7dbfde91e39dbcf69bc169c9bb1351987fba2be3.tar.xz
dexon-solidity-7dbfde91e39dbcf69bc169c9bb1351987fba2be3.tar.zst
dexon-solidity-7dbfde91e39dbcf69bc169c9bb1351987fba2be3.zip
Merge branch 'develop' into js_abi
-rw-r--r--main.cpp39
1 files changed, 15 insertions, 24 deletions
diff --git a/main.cpp b/main.cpp
index 04fdc0ee..a7216e59 100644
--- a/main.cpp
+++ b/main.cpp
@@ -26,12 +26,13 @@
#include <libdevcore/Common.h>
#include <libdevcore/CommonData.h>
#include <libdevcore/CommonIO.h>
+#include <libevmcore/Instruction.h>
#include <libsolidity/Scanner.h>
#include <libsolidity/Parser.h>
#include <libsolidity/ASTPrinter.h>
#include <libsolidity/NameAndTypeResolver.h>
#include <libsolidity/Exceptions.h>
-#include <libsolidity/Compiler.h>
+#include <libsolidity/CompilerStack.h>
#include <libsolidity/SourceReferenceFormatter.h>
using namespace std;
@@ -85,48 +86,34 @@ int main(int argc, char** argv)
else
sourceCode = asString(dev::contents(infile));
- ASTPointer<ContractDefinition> ast;
- shared_ptr<Scanner> scanner = make_shared<Scanner>(CharStream(sourceCode));
- Parser parser;
- bytes instructions;
- Compiler compiler;
+ CompilerStack compiler;
try
{
- ast = parser.parse(scanner);
-
- NameAndTypeResolver resolver;
- resolver.resolveNamesAndTypes(*ast.get());
-
- cout << "Syntax tree for the contract:" << endl;
- dev::solidity::ASTPrinter printer(ast, sourceCode);
- printer.print(cout);
-
- compiler.compileContract(*ast);
- instructions = compiler.getAssembledBytecode(optimize);
+ compiler.compile(sourceCode, optimize);
}
catch (ParserError const& exception)
{
- SourceReferenceFormatter::printExceptionInformation(cerr, exception, "Parser error", *scanner);
+ SourceReferenceFormatter::printExceptionInformation(cerr, exception, "Parser error", compiler.getScanner());
return -1;
}
catch (DeclarationError const& exception)
{
- SourceReferenceFormatter::printExceptionInformation(cerr, exception, "Declaration error", *scanner);
+ SourceReferenceFormatter::printExceptionInformation(cerr, exception, "Declaration error", compiler.getScanner());
return -1;
}
catch (TypeError const& exception)
{
- SourceReferenceFormatter::printExceptionInformation(cerr, exception, "Type error", *scanner);
+ SourceReferenceFormatter::printExceptionInformation(cerr, exception, "Type error", compiler.getScanner());
return -1;
}
catch (CompilerError const& exception)
{
- SourceReferenceFormatter::printExceptionInformation(cerr, exception, "Compiler error", *scanner);
+ SourceReferenceFormatter::printExceptionInformation(cerr, exception, "Compiler error", compiler.getScanner());
return -1;
}
catch (InternalCompilerError const& exception)
{
- cerr << "Internal compiler error: " << boost::diagnostic_information(exception) << endl;
+ SourceReferenceFormatter::printExceptionInformation(cerr, exception, "Internal compiler error", compiler.getScanner());
return -1;
}
catch (Exception const& exception)
@@ -140,11 +127,15 @@ int main(int argc, char** argv)
return -1;
}
+ cout << "Syntax tree for the contract:" << endl;
+ ASTPrinter printer(compiler.getAST(), sourceCode);
+ printer.print(cout);
cout << "EVM assembly:" << endl;
compiler.streamAssembly(cout);
cout << "Opcodes:" << endl;
- cout << eth::disassemble(instructions) << endl;
- cout << "Binary: " << toHex(instructions) << endl;
+ cout << eth::disassemble(compiler.getBytecode()) << endl;
+ cout << "Binary: " << toHex(compiler.getBytecode()) << endl;
+ cout << "Interface specification: " << compiler.getInterface() << endl;
return 0;
}