mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge remote-tracking branch 'origin/develop' into breaking
This commit is contained in:
@@ -1106,11 +1106,22 @@ void CompilerUtils::convertType(
|
||||
}
|
||||
case DataLocation::CallData:
|
||||
{
|
||||
solUnimplementedAssert(!typeOnStack.isDynamicallyEncoded(), "");
|
||||
m_context << Instruction::DUP1;
|
||||
m_context << Instruction::CALLDATASIZE;
|
||||
m_context << Instruction::SUB;
|
||||
abiDecode({&targetType}, false);
|
||||
if (typeOnStack.isDynamicallyEncoded())
|
||||
{
|
||||
solAssert(m_context.useABICoderV2(), "");
|
||||
m_context.callYulFunction(
|
||||
m_context.utilFunctions().conversionFunction(typeOnStack, targetType),
|
||||
1,
|
||||
1
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_context << Instruction::DUP1;
|
||||
m_context << Instruction::CALLDATASIZE;
|
||||
m_context << Instruction::SUB;
|
||||
abiDecode({&targetType}, false);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DataLocation::Memory:
|
||||
|
||||
@@ -433,7 +433,7 @@ bool IRGeneratorForStatements::visit(Assignment const& _assignment)
|
||||
{
|
||||
solAssert(type(_assignment) == leftIntermediate.type(), "");
|
||||
solAssert(type(_assignment) == type(_assignment.leftHandSide()), "");
|
||||
define(_assignment) << shiftOperation(binaryOperator, leftIntermediate, value);
|
||||
define(_assignment) << shiftOperation(binaryOperator, leftIntermediate, value) << "\n";
|
||||
|
||||
writeToLValue(*m_currentLValue, IRVariable(_assignment));
|
||||
m_currentLValue.reset();
|
||||
@@ -1010,7 +1010,7 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall)
|
||||
m_utils.packedHashFunction({arg.annotation().type}, {referenceType}) <<
|
||||
"(" <<
|
||||
IRVariable(arg).commaSeparatedList() <<
|
||||
")";
|
||||
")\n";
|
||||
else if (auto functionType = dynamic_cast<FunctionType const*>(paramTypes[i]))
|
||||
{
|
||||
solAssert(
|
||||
@@ -1403,6 +1403,8 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall)
|
||||
</saltSet>
|
||||
<?isTryCall>
|
||||
let <success> := iszero(iszero(<address>))
|
||||
<!isTryCall>
|
||||
if iszero(<address>) { <forwardingRevert>() }
|
||||
</isTryCall>
|
||||
<releaseTemporaryMemory>()
|
||||
)");
|
||||
@@ -1425,6 +1427,8 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall)
|
||||
t("isTryCall", _functionCall.annotation().tryCall);
|
||||
if (_functionCall.annotation().tryCall)
|
||||
t("success", IRNames::trySuccessConditionVariable(_functionCall));
|
||||
else
|
||||
t("forwardingRevert", m_utils.forwardingRevertFunction());
|
||||
m_code << t.render();
|
||||
|
||||
break;
|
||||
@@ -1581,7 +1585,7 @@ void IRGeneratorForStatements::endVisit(MemberAccess const& _memberAccess)
|
||||
auto contract = dynamic_cast<ContractDefinition const*>(functionDefinition.scope());
|
||||
solAssert(contract && contract->isLibrary(), "");
|
||||
define(IRVariable(_memberAccess).part("address")) << linkerSymbol(*contract) << "\n";
|
||||
define(IRVariable(_memberAccess).part("functionSelector")) << memberFunctionType->externalIdentifier();
|
||||
define(IRVariable(_memberAccess).part("functionSelector")) << memberFunctionType->externalIdentifier() << "\n";
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -1789,15 +1793,13 @@ void IRGeneratorForStatements::endVisit(MemberAccess const& _memberAccess)
|
||||
baseRef <<
|
||||
", " <<
|
||||
offset <<
|
||||
")" <<
|
||||
std::endl;
|
||||
")\n";
|
||||
else
|
||||
define(_memberAccess) <<
|
||||
m_utils.readFromCalldata(*_memberAccess.annotation().type) <<
|
||||
"(" <<
|
||||
offset <<
|
||||
")" <<
|
||||
std::endl;
|
||||
")\n";
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -2064,7 +2066,7 @@ void IRGeneratorForStatements::endVisit(IndexAccess const& _indexAccess)
|
||||
IRVariable(_indexAccess.baseExpression()).commaSeparatedList() +
|
||||
", " +
|
||||
expressionAsType(*_indexAccess.indexExpression(), *TypeProvider::uint256()) +
|
||||
")\n";
|
||||
")";
|
||||
if (arrayType.isByteArray())
|
||||
define(_indexAccess) <<
|
||||
m_utils.cleanupFunction(*arrayType.baseType()) <<
|
||||
@@ -2078,7 +2080,7 @@ void IRGeneratorForStatements::endVisit(IndexAccess const& _indexAccess)
|
||||
indexAccessFunctionCall <<
|
||||
")\n";
|
||||
else
|
||||
define(_indexAccess) << indexAccessFunctionCall;
|
||||
define(_indexAccess) << indexAccessFunctionCall << "\n";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1922,18 +1922,24 @@ smtutil::Expression SMTEncoder::compoundAssignment(Assignment const& _assignment
|
||||
|
||||
auto decl = identifierToVariable(_assignment.leftHandSide());
|
||||
|
||||
TypePointer commonType = Type::commonType(
|
||||
_assignment.leftHandSide().annotation().type,
|
||||
_assignment.rightHandSide().annotation().type
|
||||
);
|
||||
solAssert(commonType == _assignment.annotation().type, "");
|
||||
|
||||
if (compoundToBitwise.count(op))
|
||||
return bitwiseOperation(
|
||||
compoundToBitwise.at(op),
|
||||
decl ? currentValue(*decl) : expr(_assignment.leftHandSide()),
|
||||
expr(_assignment.rightHandSide()),
|
||||
decl ? currentValue(*decl) : expr(_assignment.leftHandSide(), _assignment.annotation().type),
|
||||
expr(_assignment.rightHandSide(), _assignment.annotation().type),
|
||||
_assignment.annotation().type
|
||||
);
|
||||
|
||||
auto values = arithmeticOperation(
|
||||
compoundToArithmetic.at(op),
|
||||
decl ? currentValue(*decl) : expr(_assignment.leftHandSide()),
|
||||
expr(_assignment.rightHandSide()),
|
||||
decl ? currentValue(*decl) : expr(_assignment.leftHandSide(), _assignment.annotation().type),
|
||||
expr(_assignment.rightHandSide(), _assignment.annotation().type),
|
||||
_assignment.annotation().type,
|
||||
_assignment
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user