diff options
author | chriseth <c@ethdev.com> | 2015-09-16 22:56:30 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-09-22 02:03:05 +0800 |
commit | 34a81fd60e0218ef93813ffce22fb6d0ed4955e2 (patch) | |
tree | e15e3f2c224688c43859d4c4588743c8fd07adc1 /libsolidity/CompilerStack.cpp | |
parent | 352c196eb37744b8054909a9801d55c672d0eb1c (diff) | |
download | dexon-solidity-34a81fd60e0218ef93813ffce22fb6d0ed4955e2.tar dexon-solidity-34a81fd60e0218ef93813ffce22fb6d0ed4955e2.tar.gz dexon-solidity-34a81fd60e0218ef93813ffce22fb6d0ed4955e2.tar.bz2 dexon-solidity-34a81fd60e0218ef93813ffce22fb6d0ed4955e2.tar.lz dexon-solidity-34a81fd60e0218ef93813ffce22fb6d0ed4955e2.tar.xz dexon-solidity-34a81fd60e0218ef93813ffce22fb6d0ed4955e2.tar.zst dexon-solidity-34a81fd60e0218ef93813ffce22fb6d0ed4955e2.zip |
Refactoring: Check types outside of AST and recover from some errors.
Diffstat (limited to 'libsolidity/CompilerStack.cpp')
-rw-r--r-- | libsolidity/CompilerStack.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/libsolidity/CompilerStack.cpp b/libsolidity/CompilerStack.cpp index 70bb1b4c..b8139187 100644 --- a/libsolidity/CompilerStack.cpp +++ b/libsolidity/CompilerStack.cpp @@ -27,6 +27,7 @@ #include <libsolidity/Parser.h> #include <libsolidity/GlobalContext.h> #include <libsolidity/NameAndTypeResolver.h> +#include <libsolidity/TypeChecker.h> #include <libsolidity/Compiler.h> #include <libsolidity/CompilerStack.h> #include <libsolidity/InterfaceHandler.h> @@ -123,7 +124,12 @@ void CompilerStack::parse() { m_globalContext->setCurrentContract(*contract); resolver.updateDeclaration(*m_globalContext->currentThis()); - resolver.checkTypeRequirements(*contract); + TypeChecker typeChecker; + bool typesFine = typeChecker.checkTypeRequirements(*contract); + if (!typesFine) + BOOST_THROW_EXCEPTION(*typeChecker.errors().front()); + //@todo extract warnings and errors + // store whether we had an error contract->setDevDocumentation(interfaceHandler.devDocumentation(*contract)); contract->setUserDocumentation(interfaceHandler.userDocumentation(*contract)); m_contracts[contract->name()].contract = contract; @@ -153,12 +159,14 @@ void CompilerStack::compile(bool _optimize, unsigned _runs) if (!m_parseSuccessful) parse(); + //@todo do not compile or error (also in other places) + map<ContractDefinition const*, eth::Assembly const*> compiledContracts; for (Source const* source: m_sourceOrder) for (ASTPointer<ASTNode> const& node: source->ast->nodes()) if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get())) { - if (!contract->isFullyImplemented()) + if (!contract->annotation().isFullyImplemented) continue; shared_ptr<Compiler> compiler = make_shared<Compiler>(_optimize, _runs); compiler->compileContract(*contract, compiledContracts); |