mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Adjust code to review findings
This commit is contained in:
@@ -61,8 +61,6 @@ bool ControlFlowBuilder::visit(BinaryOperation const& _operation)
|
||||
|
||||
switch (_operation.getOperator())
|
||||
{
|
||||
case Token::Conditional:
|
||||
return true;
|
||||
case Token::Or:
|
||||
case Token::And:
|
||||
{
|
||||
@@ -89,10 +87,12 @@ bool ControlFlowBuilder::visit(BinaryOperation const& _operation)
|
||||
|
||||
connect(m_currentNode, nextNode);
|
||||
m_currentNode = nextNode;
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
}
|
||||
return ASTConstVisitor::visit(_operation);
|
||||
}
|
||||
|
||||
bool ControlFlowBuilder::visit(UnaryOperation const& _operation)
|
||||
|
||||
@@ -3853,7 +3853,7 @@ void TypeChecker::endVisit(UsingForDirective const& _usingFor)
|
||||
m_errorReporter.typeError(
|
||||
9921_error,
|
||||
_usingFor.location(),
|
||||
"The \"using\" directive cannot be used to attach functions to the enum type."
|
||||
"The \"using\" directive cannot be used to attach functions to enum types."
|
||||
);
|
||||
|
||||
Type const* normalizedType = TypeProvider::withLocationIfReference(
|
||||
|
||||
@@ -403,20 +403,23 @@ FunctionDefinitionResult Type::userDefinedOperator(Token _token, ASTNode const&
|
||||
);
|
||||
solAssert(functionType && !functionType->parameterTypes().empty());
|
||||
solAssert(isImplicitlyConvertibleTo(*functionType->parameterTypes().front()));
|
||||
if ((_unaryOperation && function.parameterList().parameters().size() == 1) ||
|
||||
(!_unaryOperation && function.parameterList().parameters().size() == 2))
|
||||
if (
|
||||
(_unaryOperation && function.parameterList().parameters().size() == 1) ||
|
||||
(!_unaryOperation && function.parameterList().parameters().size() == 2)
|
||||
)
|
||||
seenFunctions.insert(&function);
|
||||
}
|
||||
|
||||
if (seenFunctions.size() == 1)
|
||||
return *seenFunctions.begin();
|
||||
else if (seenFunctions.size() == 0)
|
||||
return FunctionDefinitionResult::err("A user-defined operator not found.");
|
||||
else if (!!typeDefinition() && seenFunctions.size() == 0)
|
||||
return FunctionDefinitionResult::err("Operator has not been user-defined.");
|
||||
else if (!!typeDefinition())
|
||||
return FunctionDefinitionResult::err("Multiple user-defined functions provided for this operator.");
|
||||
else
|
||||
return FunctionDefinitionResult::err("A user-defined operator not unique.");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
MemberList::MemberMap Type::boundFunctions(Type const& _type, ASTNode const& _scope)
|
||||
{
|
||||
MemberList::MemberMap members;
|
||||
|
||||
Reference in New Issue
Block a user