aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-07-16 18:31:24 +0800
committerchriseth <c@ethdev.com>2015-07-16 18:31:24 +0800
commit63d603bccc68981843df5f96c6a90f04ed3968a1 (patch)
tree8680f7ebe43e0f82974c025f0df422223161cb6d
parenta2796c3d15593d9744433dbfb35d166c07e3dec6 (diff)
parent2ce6d3bceec703e0d33e0ca7923072b18b5f2e91 (diff)
downloaddexon-solidity-63d603bccc68981843df5f96c6a90f04ed3968a1.tar
dexon-solidity-63d603bccc68981843df5f96c6a90f04ed3968a1.tar.gz
dexon-solidity-63d603bccc68981843df5f96c6a90f04ed3968a1.tar.bz2
dexon-solidity-63d603bccc68981843df5f96c6a90f04ed3968a1.tar.lz
dexon-solidity-63d603bccc68981843df5f96c6a90f04ed3968a1.tar.xz
dexon-solidity-63d603bccc68981843df5f96c6a90f04ed3968a1.tar.zst
dexon-solidity-63d603bccc68981843df5f96c6a90f04ed3968a1.zip
Merge pull request #2482 from chriseth/sol_fix_initialiseStorageStrings
Fix for initialising storage strings.
-rw-r--r--ExpressionCompiler.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/ExpressionCompiler.cpp b/ExpressionCompiler.cpp
index 6a2e185c..470fd7c5 100644
--- a/ExpressionCompiler.cpp
+++ b/ExpressionCompiler.cpp
@@ -48,12 +48,23 @@ void ExpressionCompiler::appendStateVariableInitialization(VariableDeclaration c
{
if (!_varDecl.getValue())
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);
_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)