Adjustments after review

This commit is contained in:
wechman 2022-08-29 14:29:26 +02:00
parent 3bc52acbd1
commit 5572d3aed8
8 changed files with 11 additions and 12 deletions

View File

@ -5,7 +5,7 @@ Language Features:
Compiler Features:
* Yul Optimizer: Allow replacing the previously hard-coded cleanup sequence by specifying custom steps after a colon delimiter (``:``) in the sequence string.
* Allow user-defined operators via ``using {f as +} for Typename;``.
* Allow defining custom operators for user-defined value types and structs via ``using {f as +} for Typename;`` syntax.
Bugfixes:

View File

@ -97,7 +97,7 @@ bool ControlFlowBuilder::visit(BinaryOperation const& _operation)
bool ControlFlowBuilder::visit(UnaryOperation const& _operation)
{
solAssert(!!m_currentNode, "");
solAssert(!!m_currentNode);
if (_operation.annotation().userDefinedFunction)
{
@ -112,7 +112,7 @@ bool ControlFlowBuilder::visit(UnaryOperation const& _operation)
return true;
}
return false;
return ASTConstVisitor::visit(_operation);
}
bool ControlFlowBuilder::visit(Conditional const& _conditional)

View File

@ -29,8 +29,8 @@ using namespace solidity::frontend;
FunctionDefinition const* CFGNode::resolveFunctionCall(ContractDefinition const* _mostDerivedContract) const
{
return std::visit(GenericVisitor{
[=](FunctionCall const* _funCall) { return _funCall ? ASTNode::resolveFunctionCall(*_funCall, _mostDerivedContract) : nullptr; },
[](FunctionDefinition const* _funDef) { return _funDef; }
[=](FunctionCall const* _call) { return _call ? ASTNode::resolveFunctionCall(*_call, _mostDerivedContract) : nullptr; },
[](FunctionDefinition const* _definition) { return _definition; }
}, functionCall);
}

View File

@ -656,7 +656,7 @@ private:
* 2, this check is only done when a function is called.
*
* For version 4, T has to be user-defined value type or struct. All parameters and
* return value of all the functions has to be of type T.
* return value of all the functions have to be of type T.
*
* Finally, `using {f1, f2, ..., fn} for T global` is also valid at file level, as long as T is
* a user-defined type defined in the same file at file level. In this case, the methods are

View File

@ -573,7 +573,7 @@ bool ExpressionCompiler::visit(BinaryOperation const& _binaryOperation)
return false;
}
solAssert(!!_binaryOperation.annotation().commonType, "");
solAssert(!!_binaryOperation.annotation().commonType);
Type const* commonType = _binaryOperation.annotation().commonType;
Token const c_op = _binaryOperation.getOperator();

View File

@ -696,7 +696,7 @@ bool IRGeneratorForStatements::visit(UnaryOperation const& _unaryOperation)
string argument = expressionAsType(_unaryOperation.subExpression(), *functionType->selfType());
solAssert(!argument.empty());
solAssert(function->isImplemented(), "");
solAssert(function->isImplemented());
solAssert(
function->returnParameters().size() == 1,
@ -843,7 +843,7 @@ bool IRGeneratorForStatements::visit(BinaryOperation const& _binOp)
string right = expressionAsType(_binOp.rightExpression(), *functionType->parameterTypes().at(0));
solAssert(!left.empty() && !right.empty());
solAssert(function->isImplemented(), "");
solAssert(function->isImplemented());
solAssert(
function->returnParameters().size() == 1,
@ -860,7 +860,7 @@ bool IRGeneratorForStatements::visit(BinaryOperation const& _binOp)
return false;
}
solAssert(!!_binOp.annotation().commonType, "");
solAssert(!!_binOp.annotation().commonType);
Type const* commonType = _binOp.annotation().commonType;
langutil::Token op = _binOp.getOperator();

View File

@ -980,7 +980,7 @@ ASTPointer<UsingForDirective> Parser::parseUsingDirective()
{
advance();
Token operator_ = m_scanner->currentToken();
vector<Token> overridableOperators = {
vector<Token> static const overridableOperators = {
// Potential future additions: <<, >>, **, !
Token::BitOr, Token::BitAnd, Token::BitXor,
Token::Add, Token::Sub, Token::Mul, Token::Div, Token::Mod,