Throws error on library calling itself externally.

This commit is contained in:
Erik Kundt
2019-05-02 12:41:07 +02:00
parent d4c4a473d8
commit 07744dbd12
3 changed files with 27 additions and 0 deletions
+13
View File
@@ -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;
}