some fixes

This commit is contained in:
LianaHus 2015-10-05 11:06:30 +02:00
parent 742e5b259a
commit 8f7f22c5a6
3 changed files with 8 additions and 4 deletions

View File

@ -41,6 +41,7 @@ public:
DocstringParsingError, DocstringParsingError,
ParserError, ParserError,
TypeError, TypeError,
Warning Warning
}; };
@ -69,7 +70,7 @@ public:
} }
} }
Type type() { return m_type; } Type const type() { return m_type; } const
std::string const& typeName() const { return m_typeName; } std::string const& typeName() const { return m_typeName; }
private: private:

View File

@ -45,11 +45,14 @@ bool TypeChecker::checkTypeRequirements(const ContractDefinition& _contract)
} }
bool success = true; bool success = true;
for (auto const& it: m_errors) for (auto const& it: m_errors)
if (!dynamic_cast<Warning const*>(it.get())) {
Error const& e = dynamic_cast<Error const&>(it.get());
if (e.type() != Error::Type::Warning)
{ {
success = false; success = false;
break; break;
} }
}
return success; return success;
} }

View File

@ -47,7 +47,7 @@ public:
bool checkTypeRequirements(ContractDefinition const& _contract); bool checkTypeRequirements(ContractDefinition const& _contract);
/// @returns the list of errors and warnings found during type checking. /// @returns the list of errors and warnings found during type checking.
std::vector<std::shared_ptr<Error const>> const& errors() const { return m_errors; } ErrorList const& errors() const { return m_errors; }
/// @returns the type of an expression and asserts that it is present. /// @returns the type of an expression and asserts that it is present.
TypePointer const& type(Expression const& _expression) const; TypePointer const& type(Expression const& _expression) const;
@ -114,7 +114,7 @@ private:
/// Runs type checks on @a _expression to infer its type and then checks that it is an LValue. /// Runs type checks on @a _expression to infer its type and then checks that it is an LValue.
void requireLValue(Expression const& _expression); void requireLValue(Expression const& _expression);
std::vector<std::shared_ptr<Error const>> m_errors; ErrorList m_errors;
}; };
} }