diff options
Diffstat (limited to 'libsolidity/analysis/TypeChecker.cpp')
-rw-r--r-- | libsolidity/analysis/TypeChecker.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index ce55de00..6b2c1cb8 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -830,6 +830,22 @@ void TypeChecker::endVisit(ExpressionStatement const& _statement) if (type(_statement.expression())->category() == Type::Category::RationalNumber) if (!dynamic_cast<RationalNumberType const&>(*type(_statement.expression())).mobileType()) typeError(_statement.expression().location(), "Invalid rational number."); + + if (auto call = dynamic_cast<FunctionCall const*>(&_statement.expression())) + { + if (auto callType = dynamic_cast<FunctionType const*>(type(call->expression()).get())) + { + using Location = FunctionType::Location; + Location location = callType->location(); + if ( + location == Location::Bare || + location == Location::BareCallCode || + location == Location::BareDelegateCall || + location == Location::Send + ) + warning(_statement.location(), "Return value of low-level calls not used."); + } + } } bool TypeChecker::visit(Conditional const& _conditional) @@ -1570,6 +1586,16 @@ void TypeChecker::typeError(SourceLocation const& _location, string const& _desc m_errors.push_back(err); } +void TypeChecker::warning(SourceLocation const& _location, string const& _description) +{ + auto err = make_shared<Error>(Error::Type::Warning); + *err << + errinfo_sourceLocation(_location) << + errinfo_comment(_description); + + m_errors.push_back(err); +} + void TypeChecker::fatalTypeError(SourceLocation const& _location, string const& _description) { typeError(_location, _description); |