aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLianaHus <liana@ethdev.com>2015-10-15 22:27:26 +0800
committerLianaHus <liana@ethdev.com>2015-10-15 22:27:26 +0800
commit162d021c3faf0fdb671778870c9da8ad74256b2e (patch)
tree9840b1b5db02ee4d1df5f09e98b4ee1de12ce730
parent3871e77946866cdef36147ddd2e6d322f63cea37 (diff)
downloaddexon-solidity-162d021c3faf0fdb671778870c9da8ad74256b2e.tar.gz
dexon-solidity-162d021c3faf0fdb671778870c9da8ad74256b2e.tar.zst
dexon-solidity-162d021c3faf0fdb671778870c9da8ad74256b2e.zip
some more style fixes
-rw-r--r--libsolidity/NameAndTypeResolver.h6
-rw-r--r--libsolidity/Parser.cpp3
-rw-r--r--libsolidity/Parser.h3
-rw-r--r--libsolidity/TypeChecker.cpp15
-rw-r--r--libsolidity/TypeChecker.h2
-rw-r--r--test/libsolidity/SolidityParser.cpp8
-rw-r--r--test/libsolidity/solidityExecutionFramework.h4
7 files changed, 14 insertions, 27 deletions
diff --git a/libsolidity/NameAndTypeResolver.h b/libsolidity/NameAndTypeResolver.h
index fd939de8..4fe8dd8c 100644
--- a/libsolidity/NameAndTypeResolver.h
+++ b/libsolidity/NameAndTypeResolver.h
@@ -44,14 +44,14 @@ class NameAndTypeResolver: private boost::noncopyable
public:
NameAndTypeResolver(std::vector<Declaration const*> const& _globals, ErrorList& _errors);
/// Registers all declarations found in the source unit.
- /// @returns false in case of type error.
+ /// @returns false in case of error.
bool registerDeclarations(SourceUnit& _sourceUnit);
/// Resolves all names and types referenced from the given contract.
- /// @returns false in case of type error.
+ /// @returns false in case of error.
bool resolveNamesAndTypes(ContractDefinition& _contract);
/// Updates the given global declaration (used for "this"). Not to be used with declarations
/// that create their own scope.
- /// @returns false in case of type error.
+ /// @returns false in case of error.
bool updateDeclaration(Declaration const& _declaration);
/// Resolves the given @a _name inside the scope @a _scope. If @a _scope is omitted,
diff --git a/libsolidity/Parser.cpp b/libsolidity/Parser.cpp
index 58632b85..47d1fb2f 100644
--- a/libsolidity/Parser.cpp
+++ b/libsolidity/Parser.cpp
@@ -66,7 +66,8 @@ private:
ASTPointer<SourceUnit> Parser::parse(shared_ptr<Scanner> const& _scanner)
{
- try{
+ try
+ {
m_scanner = _scanner;
ASTNodeFactory nodeFactory(*this);
vector<ASTPointer<ASTNode>> nodes;
diff --git a/libsolidity/Parser.h b/libsolidity/Parser.h
index 3fc3768e..ee5be51c 100644
--- a/libsolidity/Parser.h
+++ b/libsolidity/Parser.h
@@ -34,8 +34,7 @@ class Scanner;
class Parser
{
public:
- Parser(ErrorList& errors):
- m_errors(errors){};
+ Parser(ErrorList& errors): m_errors(errors){};
ASTPointer<SourceUnit> parse(std::shared_ptr<Scanner> const& _scanner);
std::shared_ptr<std::string const> const& sourceName() const;
diff --git a/libsolidity/TypeChecker.cpp b/libsolidity/TypeChecker.cpp
index 9ceb8203..ca5b1eb7 100644
--- a/libsolidity/TypeChecker.cpp
+++ b/libsolidity/TypeChecker.cpp
@@ -43,19 +43,7 @@ bool TypeChecker::checkTypeRequirements(const ContractDefinition& _contract)
if (m_errors.empty())
throw; // Something is weird here, rather throw again.
}
-
-return Error::containsOnlyWarnings(m_errors);
-// bool success = true;
-// for (auto const& it: m_errors)
-// {
-// auto e = dynamic_cast<Error const*>(it.get());
-// if (e->type() != Error::Type::Warning)
-// {
-// success = false;
-// break;
-// }
-// }
-// return success;
+ return Error::containsOnlyWarnings(m_errors);
}
TypePointer const& TypeChecker::type(Expression const& _expression) const
@@ -72,7 +60,6 @@ TypePointer const& TypeChecker::type(VariableDeclaration const& _variable) const
bool TypeChecker::visit(ContractDefinition const& _contract)
{
-
// We force our own visiting order here.
ASTNode::listAccept(_contract.definedStructs(), *this);
ASTNode::listAccept(_contract.baseContracts(), *this);
diff --git a/libsolidity/TypeChecker.h b/libsolidity/TypeChecker.h
index de095e3b..d9cb39ae 100644
--- a/libsolidity/TypeChecker.h
+++ b/libsolidity/TypeChecker.h
@@ -42,7 +42,7 @@ namespace solidity
class TypeChecker: private ASTConstVisitor
{
public:
- /// @_errors the reference to the list of errors and warnings to add them found during type checking.
+ /// @param _errors the reference to the list of errors and warnings to add them found during type checking.
TypeChecker(ErrorList& _errors): m_errors(_errors) {}
/// Performs type checking on the given contract and all of its sub-nodes.
diff --git a/test/libsolidity/SolidityParser.cpp b/test/libsolidity/SolidityParser.cpp
index 2482acff..35393811 100644
--- a/test/libsolidity/SolidityParser.cpp
+++ b/test/libsolidity/SolidityParser.cpp
@@ -42,7 +42,7 @@ namespace
ASTPointer<ContractDefinition> parseText(std::string const& _source, ErrorList& _errors)
{
ASTPointer<SourceUnit> sourceUnit = Parser(_errors).parse(std::make_shared<Scanner>(CharStream(_source)));
- if(!sourceUnit)
+ if (!sourceUnit)
return ASTPointer<ContractDefinition>();
for (ASTPointer<ASTNode> const& node: sourceUnit->nodes())
if (ASTPointer<ContractDefinition> contract = dynamic_pointer_cast<ContractDefinition>(node))
@@ -57,7 +57,7 @@ bool successParse(std::string const& _source)
try
{
auto sourceUnit = parseText(_source, errors);
- if(!sourceUnit)
+ if (!sourceUnit)
return false;
}
catch (FatalError const& _exception)
@@ -68,6 +68,7 @@ bool successParse(std::string const& _source)
if (Error::containsErrorOfType(errors, Error::Type::ParserError))
return false;
+ BOOST_CHECK(Error::containsOnlyWarnings(errors));
return true;
}
@@ -168,7 +169,6 @@ BOOST_AUTO_TEST_CASE(two_exact_functions)
// with support of overloaded functions, during parsing,
// we can't determine whether they match exactly, however
// it will throw DeclarationError in following stage.
- // TODO add test to the SolidityNameAndTypeDeclaration
BOOST_CHECK(successParse(text));
}
@@ -848,7 +848,7 @@ BOOST_AUTO_TEST_CASE(external_variable)
BOOST_CHECK(!successParse(text));
}
-BOOST_AUTO_TEST_CASE(arrays_in_storagze)
+BOOST_AUTO_TEST_CASE(arrays_in_storage)
{
char const* text = R"(
contract c {
diff --git a/test/libsolidity/solidityExecutionFramework.h b/test/libsolidity/solidityExecutionFramework.h
index 27dd4fb7..82fede84 100644
--- a/test/libsolidity/solidityExecutionFramework.h
+++ b/test/libsolidity/solidityExecutionFramework.h
@@ -77,12 +77,12 @@ public:
m_compiler.compile(m_optimize, m_optimizeRuns);
BOOST_REQUIRE(Error::containsErrorOfType(m_compiler.errors(), _type));
}
- catch(Error const& _e)
+ catch (Error const& _e)
{
BOOST_REQUIRE(_e.type() == _type);
foundError = true;
}
- catch(Exception const& _exception)
+ catch (Exception const& _exception)
{
BOOST_REQUIRE(false);
}