Update OperationAnnotation to use SetOnce for userDefinedFunction

This commit is contained in:
wechman
2022-09-28 13:07:12 +02:00
parent 6fcd717ab4
commit d124f83b88
9 changed files with 26 additions and 21 deletions
+2 -2
View File
@@ -411,7 +411,7 @@ bool ExpressionCompiler::visit(UnaryOperation const& _unaryOperation)
{
CompilerContext::LocationSetter locationSetter(m_context, _unaryOperation);
if (FunctionDefinition const* function = _unaryOperation.annotation().userDefinedFunction)
if (FunctionDefinition const* function = *_unaryOperation.annotation().userDefinedFunction)
{
solAssert(
function->isFree() || function->libraryFunction(),
@@ -538,7 +538,7 @@ bool ExpressionCompiler::visit(BinaryOperation const& _binaryOperation)
CompilerContext::LocationSetter locationSetter(m_context, _binaryOperation);
Expression const& leftExpression = _binaryOperation.leftExpression();
Expression const& rightExpression = _binaryOperation.rightExpression();
if (FunctionDefinition const* function =_binaryOperation.annotation().userDefinedFunction)
if (FunctionDefinition const* function = *_binaryOperation.annotation().userDefinedFunction)
{
solAssert(
function->isFree() || function->libraryFunction(),
@@ -673,7 +673,7 @@ bool IRGeneratorForStatements::visit(UnaryOperation const& _unaryOperation)
{
setLocation(_unaryOperation);
if (FunctionDefinition const* function = _unaryOperation.annotation().userDefinedFunction)
if (FunctionDefinition const* function = *_unaryOperation.annotation().userDefinedFunction)
{
_unaryOperation.subExpression().accept(*this);
setLocation(_unaryOperation);
@@ -817,7 +817,7 @@ bool IRGeneratorForStatements::visit(BinaryOperation const& _binOp)
{
setLocation(_binOp);
if (FunctionDefinition const* function = _binOp.annotation().userDefinedFunction)
if (FunctionDefinition const* function = *_binOp.annotation().userDefinedFunction)
{
_binOp.leftExpression().accept(*this);
_binOp.rightExpression().accept(*this);