mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
added createing FunctionType from ArrayType VariableDeclaration
added test
This commit is contained in:
parent
45870ed956
commit
7eec25b6eb
@ -71,16 +71,20 @@ void ExpressionCompiler::appendStateVariableAccessor(VariableDeclaration const&
|
|||||||
m_context << location.first;
|
m_context << location.first;
|
||||||
|
|
||||||
TypePointer returnType = _varDecl.getType();
|
TypePointer returnType = _varDecl.getType();
|
||||||
for (TypePointer const& paramType: paramTypes)
|
if (ArrayType const* arrayType = dynamic_cast<ArrayType const*>(returnType.get()))
|
||||||
{
|
{
|
||||||
// move offset to memory
|
(void)arrayType;
|
||||||
CompilerUtils(m_context).storeInMemory(length);
|
} else
|
||||||
unsigned argLen = paramType->getCalldataEncodedSize();
|
for (TypePointer const& paramType: paramTypes)
|
||||||
length -= argLen;
|
{
|
||||||
m_context << u256(argLen + 32) << u256(length) << eth::Instruction::SHA3;
|
// move offset to memory
|
||||||
|
CompilerUtils(m_context).storeInMemory(length);
|
||||||
|
unsigned argLen = paramType->getCalldataEncodedSize();
|
||||||
|
length -= argLen;
|
||||||
|
m_context << u256(argLen + 32) << u256(length) << eth::Instruction::SHA3;
|
||||||
|
|
||||||
returnType = dynamic_cast<MappingType const&>(*returnType).getValueType();
|
returnType = dynamic_cast<MappingType const&>(*returnType).getValueType();
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned retSizeOnStack = 0;
|
unsigned retSizeOnStack = 0;
|
||||||
solAssert(accessorType.getReturnParameterTypes().size() >= 1, "");
|
solAssert(accessorType.getReturnParameterTypes().size() >= 1, "");
|
||||||
|
17
Types.cpp
17
Types.cpp
@ -1002,12 +1002,17 @@ FunctionType::FunctionType(VariableDeclaration const& _varDecl):
|
|||||||
retParamNames.push_back(member.first);
|
retParamNames.push_back(member.first);
|
||||||
retParams.push_back(member.second);
|
retParams.push_back(member.second);
|
||||||
}
|
}
|
||||||
}
|
} else
|
||||||
else
|
if (auto arrayType = dynamic_cast<ArrayType const*>(returnType.get()))
|
||||||
{
|
{
|
||||||
retParams.push_back(returnType);
|
params.push_back(make_shared<IntegerType>(256));
|
||||||
retParamNames.push_back("");
|
paramNames.push_back("");
|
||||||
}
|
returnType = arrayType->getBaseType();
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
retParams.push_back(returnType);
|
||||||
|
retParamNames.push_back("");
|
||||||
|
}
|
||||||
|
|
||||||
swap(params, m_parameterTypes);
|
swap(params, m_parameterTypes);
|
||||||
swap(paramNames, m_parameterNames);
|
swap(paramNames, m_parameterNames);
|
||||||
|
Loading…
Reference in New Issue
Block a user