mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #2482 from chriseth/sol_fix_initialiseStorageStrings
Fix for initialising storage strings.
This commit is contained in:
commit
63d603bccc
@ -48,12 +48,23 @@ void ExpressionCompiler::appendStateVariableInitialization(VariableDeclaration c
|
|||||||
{
|
{
|
||||||
if (!_varDecl.getValue())
|
if (!_varDecl.getValue())
|
||||||
return;
|
return;
|
||||||
solAssert(!!_varDecl.getValue()->getType(), "Type information not available.");
|
TypePointer type = _varDecl.getValue()->getType();
|
||||||
|
solAssert(!!type, "Type information not available.");
|
||||||
CompilerContext::LocationSetter locationSetter(m_context, _varDecl);
|
CompilerContext::LocationSetter locationSetter(m_context, _varDecl);
|
||||||
_varDecl.getValue()->accept(*this);
|
_varDecl.getValue()->accept(*this);
|
||||||
utils().convertType(*_varDecl.getValue()->getType(), *_varDecl.getType(), true);
|
|
||||||
|
|
||||||
StorageItem(m_context, _varDecl).storeValue(*_varDecl.getType(), _varDecl.getLocation(), true);
|
if (_varDecl.getType()->dataStoredIn(DataLocation::Storage))
|
||||||
|
{
|
||||||
|
// reference type, only convert value to mobile type and do final conversion in storeValue.
|
||||||
|
utils().convertType(*type, *type->mobileType());
|
||||||
|
type = type->mobileType();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
utils().convertType(*type, *_varDecl.getType());
|
||||||
|
type = _varDecl.getType();
|
||||||
|
}
|
||||||
|
StorageItem(m_context, _varDecl).storeValue(*type, _varDecl.getLocation(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExpressionCompiler::appendStateVariableAccessor(VariableDeclaration const& _varDecl)
|
void ExpressionCompiler::appendStateVariableAccessor(VariableDeclaration const& _varDecl)
|
||||||
|
Loading…
Reference in New Issue
Block a user