mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Unary operators with using for directive fix
This commit is contained in:
@@ -384,7 +384,7 @@ vector<UsingForDirective const*> usingForDirectivesForType(Type const& _type, AS
|
||||
|
||||
}
|
||||
|
||||
FunctionDefinition const* Type::userDefinedOperator(Token _token, ASTNode const& _scope) const
|
||||
FunctionDefinition const* Type::userDefinedOperator(Token _token, ASTNode const& _scope, bool _unaryOperation) const
|
||||
{
|
||||
// Check if it is a user-defined type.
|
||||
if (!typeDefinition())
|
||||
@@ -405,8 +405,11 @@ FunctionDefinition const* Type::userDefinedOperator(Token _token, ASTNode const&
|
||||
solAssert(functionType && !functionType->parameterTypes().empty());
|
||||
// TODO does this work (data location)?
|
||||
solAssert(isImplicitlyConvertibleTo(*functionType->parameterTypes().front()));
|
||||
seenFunctions.insert(&function);
|
||||
if ((_unaryOperation && function.parameterList().parameters().size() == 1) ||
|
||||
(!_unaryOperation && function.parameterList().parameters().size() == 2))
|
||||
seenFunctions.insert(&function);
|
||||
}
|
||||
|
||||
// TODO proper error handling.
|
||||
if (seenFunctions.size() == 1)
|
||||
return *seenFunctions.begin();
|
||||
|
||||
@@ -377,7 +377,7 @@ public:
|
||||
/// Clears all internally cached values (if any).
|
||||
virtual void clearCache() const;
|
||||
|
||||
FunctionDefinition const* userDefinedOperator(Token _token, ASTNode const& _scope) const;
|
||||
FunctionDefinition const* userDefinedOperator(Token _token, ASTNode const& _scope, bool _unaryOperation) const;
|
||||
|
||||
private:
|
||||
/// @returns a member list containing all members added to this type by `using for` directives.
|
||||
|
||||
Reference in New Issue
Block a user