From c3491e446964f366101f28e3d51ab59dd9aaa5b2 Mon Sep 17 00:00:00 2001 From: LianaHus Date: Wed, 14 Oct 2015 20:37:41 +0200 Subject: errors instead of exceptions Conflicts: libsolidity/CompilerStack.cpp libsolidity/NameAndTypeResolver.cpp libsolidity/NameAndTypeResolver.h libsolidity/TypeChecker.cpp test/libsolidity/SolidityNameAndTypeResolution.cpp --- test/libsolidity/Assembly.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'test/libsolidity/Assembly.cpp') diff --git a/test/libsolidity/Assembly.cpp b/test/libsolidity/Assembly.cpp index ca1e8980..f69ae680 100644 --- a/test/libsolidity/Assembly.cpp +++ b/test/libsolidity/Assembly.cpp @@ -48,21 +48,29 @@ namespace eth::AssemblyItems compileContract(const string& _sourceCode) { - Parser parser; + ErrorList errors; + Parser parser(errors); ASTPointer sourceUnit; BOOST_REQUIRE_NO_THROW(sourceUnit = parser.parse(make_shared(CharStream(_sourceCode)))); - NameAndTypeResolver resolver({}); + BOOST_CHECK(!!sourceUnit); + + NameAndTypeResolver resolver({}, errors); + solAssert(Error::containsOnlyWarnings(errors), ""); resolver.registerDeclarations(*sourceUnit); for (ASTPointer const& node: sourceUnit->nodes()) if (ContractDefinition* contract = dynamic_cast(node.get())) { BOOST_REQUIRE_NO_THROW(resolver.resolveNamesAndTypes(*contract)); + if (!Error::containsOnlyWarnings(errors)) + return AssemblyItems(); } for (ASTPointer const& node: sourceUnit->nodes()) if (ContractDefinition* contract = dynamic_cast(node.get())) { - TypeChecker checker; + TypeChecker checker(errors); BOOST_REQUIRE_NO_THROW(checker.checkTypeRequirements(*contract)); + if (!Error::containsOnlyWarnings(errors)) + return AssemblyItems(); } for (ASTPointer const& node: sourceUnit->nodes()) if (ContractDefinition* contract = dynamic_cast(node.get())) -- cgit