mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Throws error on library calling itself externally.
This commit is contained in:
@@ -309,6 +309,19 @@ bool StaticAnalyzer::visit(FunctionCall const& _functionCall)
|
||||
"Arithmetic modulo zero."
|
||||
);
|
||||
}
|
||||
if (
|
||||
m_currentContract->isLibrary() &&
|
||||
functionType->kind() == FunctionType::Kind::DelegateCall &&
|
||||
functionType->declaration().scope() == m_currentContract
|
||||
)
|
||||
m_errorReporter.typeError(
|
||||
_functionCall.location(),
|
||||
SecondarySourceLocation().append(
|
||||
"The function declaration is here:",
|
||||
functionType->declaration().scope()->location()
|
||||
),
|
||||
"Libraries cannot call their own functions externally."
|
||||
);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user