aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLianaHus <liana@ethdev.com>2015-11-07 01:43:17 +0800
committerLianaHus <liana@ethdev.com>2015-11-07 01:45:06 +0800
commit63060fc1f0f2f27ab4ad853c7295c2cfba373b83 (patch)
tree495d30b41f8fa1f49478d9ff19e0ef61ac0313e7 /test
parent7eb162c0df52fc6335613f00e9d105fe2a4df7ff (diff)
downloaddexon-solidity-63060fc1f0f2f27ab4ad853c7295c2cfba373b83.tar.gz
dexon-solidity-63060fc1f0f2f27ab4ad853c7295c2cfba373b83.tar.zst
dexon-solidity-63060fc1f0f2f27ab4ad853c7295c2cfba373b83.zip
fixed test framework
Diffstat (limited to 'test')
-rw-r--r--test/libsolidity/SolidityNameAndTypeResolution.cpp37
1 files changed, 20 insertions, 17 deletions
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp
index 6b36f4cc..f4e01000 100644
--- a/test/libsolidity/SolidityNameAndTypeResolution.cpp
+++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp
@@ -62,33 +62,36 @@ parseAnalyseAndReturnError(string const& _source, bool _reportWarnings = false)
solAssert(Error::containsOnlyWarnings(errors), "");
resolver.registerDeclarations(*sourceUnit);
+ bool success = true;
for (ASTPointer<ASTNode> const& node: sourceUnit->nodes())
if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get()))
{
globalContext->setCurrentContract(*contract);
resolver.updateDeclaration(*globalContext->currentThis());
resolver.updateDeclaration(*globalContext->currentSuper());
- resolver.resolveNamesAndTypes(*contract);
+ if (! resolver.resolveNamesAndTypes(*contract))
+ success = false;
}
- for (ASTPointer<ASTNode> const& node: sourceUnit->nodes())
- if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get()))
- {
- globalContext->setCurrentContract(*contract);
- resolver.updateDeclaration(*globalContext->currentThis());
+ if (success)
+ for (ASTPointer<ASTNode> const& node: sourceUnit->nodes())
+ if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get()))
+ {
+ globalContext->setCurrentContract(*contract);
+ resolver.updateDeclaration(*globalContext->currentThis());
- TypeChecker typeChecker(errors);
- bool success = typeChecker.checkTypeRequirements(*contract);
- BOOST_CHECK(success || !errors.empty());
+ TypeChecker typeChecker(errors);
+ bool success = typeChecker.checkTypeRequirements(*contract);
+ BOOST_CHECK(success || !errors.empty());
- for (auto const& currentError: errors)
- {
- if (
- (_reportWarnings && currentError->type() == Error::Type::Warning) ||
- (!_reportWarnings && currentError->type() != Error::Type::Warning)
- )
- return make_pair(sourceUnit, std::make_shared<Error::Type const>(currentError->type()));
}
- }
+ for (auto const& currentError: errors)
+ {
+ if (
+ (_reportWarnings && currentError->type() == Error::Type::Warning) ||
+ (!_reportWarnings && currentError->type() != Error::Type::Warning)
+ )
+ return make_pair(sourceUnit, std::make_shared<Error::Type const>(currentError->type()));
+ }
}
catch(Error const& _e)
{