File tree Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -323,16 +323,23 @@ ViewPureChecker::MutabilityAndLocation const& ViewPureChecker::modifierMutabilit
323
323
return m_inferredMutability.at (&_modifier);
324
324
}
325
325
326
+ void ViewPureChecker::reportFunctionCallMutability (StateMutability _mutability, langutil::SourceLocation const & _location)
327
+ {
328
+ // We only require "nonpayable" to call a payable function.
329
+ if (_mutability == StateMutability::Payable)
330
+ _mutability = StateMutability::NonPayable;
331
+ reportMutability (_mutability, _location);
332
+ }
333
+
326
334
void ViewPureChecker::endVisit (FunctionCall const & _functionCall)
327
335
{
328
336
if (*_functionCall.annotation ().kind != FunctionCallKind::FunctionCall)
329
337
return ;
330
338
331
- StateMutability mutability = dynamic_cast <FunctionType const &>(*_functionCall.expression ().annotation ().type ).stateMutability ();
332
- // We only require "nonpayable" to call a payble function.
333
- if (mutability == StateMutability::Payable)
334
- mutability = StateMutability::NonPayable;
335
- reportMutability (mutability, _functionCall.location ());
339
+ reportFunctionCallMutability (
340
+ dynamic_cast <FunctionType const &>(*_functionCall.expression ().annotation ().type ).stateMutability (),
341
+ _functionCall.location ()
342
+ );
336
343
}
337
344
338
345
bool ViewPureChecker::visit (MemberAccess const & _memberAccess)
Original file line number Diff line number Diff line change @@ -73,6 +73,8 @@ class ViewPureChecker: private ASTConstVisitor
73
73
std::optional<langutil::SourceLocation> const & _nestedLocation = {}
74
74
);
75
75
76
+ void reportFunctionCallMutability (StateMutability _mutability, langutil::SourceLocation const & _location);
77
+
76
78
// / Determines the mutability of modifier if not already cached.
77
79
MutabilityAndLocation const & modifierMutability (ModifierDefinition const & _modifier);
78
80
You can’t perform that action at this time.
0 commit comments