mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
OperationAnnotation::userDefinedFunction can be set only once
This commit is contained in:
@@ -673,11 +673,13 @@ bool IRGeneratorForStatements::visit(UnaryOperation const& _unaryOperation)
|
||||
{
|
||||
setLocation(_unaryOperation);
|
||||
|
||||
if (FunctionDefinition const* function = _unaryOperation.annotation().userDefinedFunction)
|
||||
if (_unaryOperation.annotation().userDefinedFunction.set())
|
||||
{
|
||||
_unaryOperation.subExpression().accept(*this);
|
||||
setLocation(_unaryOperation);
|
||||
|
||||
FunctionDefinition const* function = *_unaryOperation.annotation().userDefinedFunction;
|
||||
solAssert(function);
|
||||
solAssert(
|
||||
function->isFree() || function->libraryFunction(),
|
||||
"Only file-level functions and library functions can be bound to a user type operator."
|
||||
@@ -817,12 +819,14 @@ bool IRGeneratorForStatements::visit(BinaryOperation const& _binOp)
|
||||
{
|
||||
setLocation(_binOp);
|
||||
|
||||
if (FunctionDefinition const* function = _binOp.annotation().userDefinedFunction)
|
||||
if (_binOp.annotation().userDefinedFunction.set())
|
||||
{
|
||||
_binOp.leftExpression().accept(*this);
|
||||
_binOp.rightExpression().accept(*this);
|
||||
setLocation(_binOp);
|
||||
|
||||
FunctionDefinition const* function = *_binOp.annotation().userDefinedFunction;
|
||||
solAssert(function);
|
||||
solAssert(
|
||||
function->isFree() || function->libraryFunction(),
|
||||
"Only file-level functions and library functions can be bound to a user type operator."
|
||||
|
||||
Reference in New Issue
Block a user