mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Fix WordSizeTransform to properly assign default types.
This commit is contained in:
parent
9f0cef97c2
commit
d3739fe620
@ -43,7 +43,11 @@ void WordSizeTransform::operator()(FunctionCall& _fc)
|
|||||||
{
|
{
|
||||||
if (BuiltinFunction const* fun = m_inputDialect.builtin(_fc.functionName.name))
|
if (BuiltinFunction const* fun = m_inputDialect.builtin(_fc.functionName.name))
|
||||||
if (fun->literalArguments)
|
if (fun->literalArguments)
|
||||||
|
{
|
||||||
|
for (Expression& arg: _fc.arguments)
|
||||||
|
get<Literal>(arg).type = m_defaultType;
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
rewriteFunctionCallArguments(_fc.arguments);
|
rewriteFunctionCallArguments(_fc.arguments);
|
||||||
}
|
}
|
||||||
@ -85,8 +89,13 @@ void WordSizeTransform::operator()(Block& _block)
|
|||||||
{
|
{
|
||||||
VariableDeclaration& varDecl = std::get<VariableDeclaration>(_s);
|
VariableDeclaration& varDecl = std::get<VariableDeclaration>(_s);
|
||||||
|
|
||||||
// Special handling for datasize and dataoffset - they will only need one variable.
|
if (!varDecl.value)
|
||||||
if (varDecl.value && holds_alternative<FunctionCall>(*varDecl.value))
|
rewriteVarDeclList(varDecl.variables);
|
||||||
|
else if (holds_alternative<FunctionCall>(*varDecl.value))
|
||||||
|
{
|
||||||
|
visit(*varDecl.value);
|
||||||
|
|
||||||
|
// Special handling for datasize and dataoffset - they will only need one variable.
|
||||||
if (BuiltinFunction const* f = m_inputDialect.builtin(std::get<FunctionCall>(*varDecl.value).functionName.name))
|
if (BuiltinFunction const* f = m_inputDialect.builtin(std::get<FunctionCall>(*varDecl.value).functionName.name))
|
||||||
if (f->literalArguments)
|
if (f->literalArguments)
|
||||||
{
|
{
|
||||||
@ -108,12 +117,6 @@ void WordSizeTransform::operator()(Block& _block)
|
|||||||
return {std::move(ret)};
|
return {std::move(ret)};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
|
||||||
!varDecl.value ||
|
|
||||||
holds_alternative<FunctionCall>(*varDecl.value)
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (varDecl.value) visit(*varDecl.value);
|
|
||||||
rewriteVarDeclList(varDecl.variables);
|
rewriteVarDeclList(varDecl.variables);
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
@ -144,8 +147,11 @@ void WordSizeTransform::operator()(Block& _block)
|
|||||||
Assignment& assignment = std::get<Assignment>(_s);
|
Assignment& assignment = std::get<Assignment>(_s);
|
||||||
yulAssert(assignment.value, "");
|
yulAssert(assignment.value, "");
|
||||||
|
|
||||||
// Special handling for datasize and dataoffset - they will only need one variable.
|
|
||||||
if (holds_alternative<FunctionCall>(*assignment.value))
|
if (holds_alternative<FunctionCall>(*assignment.value))
|
||||||
|
{
|
||||||
|
visit(*assignment.value);
|
||||||
|
|
||||||
|
// Special handling for datasize and dataoffset - they will only need one variable.
|
||||||
if (BuiltinFunction const* f = m_inputDialect.builtin(std::get<FunctionCall>(*assignment.value).functionName.name))
|
if (BuiltinFunction const* f = m_inputDialect.builtin(std::get<FunctionCall>(*assignment.value).functionName.name))
|
||||||
if (f->literalArguments)
|
if (f->literalArguments)
|
||||||
{
|
{
|
||||||
@ -167,9 +173,6 @@ void WordSizeTransform::operator()(Block& _block)
|
|||||||
return {std::move(ret)};
|
return {std::move(ret)};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (holds_alternative<FunctionCall>(*assignment.value))
|
|
||||||
{
|
|
||||||
if (assignment.value) visit(*assignment.value);
|
|
||||||
rewriteIdentifierList(assignment.variableNames);
|
rewriteIdentifierList(assignment.variableNames);
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user