mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Properly terminate definitions using define() in IRGenerateForStatements
The lack of termination can result in unparseable output.
This commit is contained in:
parent
b283a2f894
commit
8d9c332593
@ -433,7 +433,7 @@ bool IRGeneratorForStatements::visit(Assignment const& _assignment)
|
|||||||
{
|
{
|
||||||
solAssert(type(_assignment) == leftIntermediate.type(), "");
|
solAssert(type(_assignment) == leftIntermediate.type(), "");
|
||||||
solAssert(type(_assignment) == type(_assignment.leftHandSide()), "");
|
solAssert(type(_assignment) == type(_assignment.leftHandSide()), "");
|
||||||
define(_assignment) << shiftOperation(binaryOperator, leftIntermediate, value);
|
define(_assignment) << shiftOperation(binaryOperator, leftIntermediate, value) << "\n";
|
||||||
|
|
||||||
writeToLValue(*m_currentLValue, IRVariable(_assignment));
|
writeToLValue(*m_currentLValue, IRVariable(_assignment));
|
||||||
m_currentLValue.reset();
|
m_currentLValue.reset();
|
||||||
@ -991,7 +991,7 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall)
|
|||||||
m_utils.packedHashFunction({arg.annotation().type}, {referenceType}) <<
|
m_utils.packedHashFunction({arg.annotation().type}, {referenceType}) <<
|
||||||
"(" <<
|
"(" <<
|
||||||
IRVariable(arg).commaSeparatedList() <<
|
IRVariable(arg).commaSeparatedList() <<
|
||||||
")";
|
")\n";
|
||||||
else if (auto functionType = dynamic_cast<FunctionType const*>(paramTypes[i]))
|
else if (auto functionType = dynamic_cast<FunctionType const*>(paramTypes[i]))
|
||||||
{
|
{
|
||||||
solAssert(
|
solAssert(
|
||||||
@ -1594,7 +1594,7 @@ void IRGeneratorForStatements::endVisit(MemberAccess const& _memberAccess)
|
|||||||
auto contract = dynamic_cast<ContractDefinition const*>(functionDefinition.scope());
|
auto contract = dynamic_cast<ContractDefinition const*>(functionDefinition.scope());
|
||||||
solAssert(contract && contract->isLibrary(), "");
|
solAssert(contract && contract->isLibrary(), "");
|
||||||
define(IRVariable(_memberAccess).part("address")) << linkerSymbol(*contract) << "\n";
|
define(IRVariable(_memberAccess).part("address")) << linkerSymbol(*contract) << "\n";
|
||||||
define(IRVariable(_memberAccess).part("functionSelector")) << memberFunctionType->externalIdentifier();
|
define(IRVariable(_memberAccess).part("functionSelector")) << memberFunctionType->externalIdentifier() << "\n";
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1809,15 +1809,13 @@ void IRGeneratorForStatements::endVisit(MemberAccess const& _memberAccess)
|
|||||||
baseRef <<
|
baseRef <<
|
||||||
", " <<
|
", " <<
|
||||||
offset <<
|
offset <<
|
||||||
")" <<
|
")\n";
|
||||||
std::endl;
|
|
||||||
else
|
else
|
||||||
define(_memberAccess) <<
|
define(_memberAccess) <<
|
||||||
m_utils.readFromCalldata(*_memberAccess.annotation().type) <<
|
m_utils.readFromCalldata(*_memberAccess.annotation().type) <<
|
||||||
"(" <<
|
"(" <<
|
||||||
offset <<
|
offset <<
|
||||||
")" <<
|
")\n";
|
||||||
std::endl;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -2073,7 +2071,7 @@ void IRGeneratorForStatements::endVisit(IndexAccess const& _indexAccess)
|
|||||||
IRVariable(_indexAccess.baseExpression()).commaSeparatedList() +
|
IRVariable(_indexAccess.baseExpression()).commaSeparatedList() +
|
||||||
", " +
|
", " +
|
||||||
expressionAsType(*_indexAccess.indexExpression(), *TypeProvider::uint256()) +
|
expressionAsType(*_indexAccess.indexExpression(), *TypeProvider::uint256()) +
|
||||||
")\n";
|
")";
|
||||||
if (arrayType.isByteArray())
|
if (arrayType.isByteArray())
|
||||||
define(_indexAccess) <<
|
define(_indexAccess) <<
|
||||||
m_utils.cleanupFunction(*arrayType.baseType()) <<
|
m_utils.cleanupFunction(*arrayType.baseType()) <<
|
||||||
@ -2087,7 +2085,7 @@ void IRGeneratorForStatements::endVisit(IndexAccess const& _indexAccess)
|
|||||||
indexAccessFunctionCall <<
|
indexAccessFunctionCall <<
|
||||||
")\n";
|
")\n";
|
||||||
else
|
else
|
||||||
define(_indexAccess) << indexAccessFunctionCall;
|
define(_indexAccess) << indexAccessFunctionCall << "\n";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,7 @@ contract C {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ====
|
// ====
|
||||||
|
// compileViaYul: also
|
||||||
// EVMVersion: >=byzantium
|
// EVMVersion: >=byzantium
|
||||||
// ----
|
// ----
|
||||||
// library: L
|
// library: L
|
||||||
|
Loading…
Reference in New Issue
Block a user