diff options
author | Liana Husikyan <liana@ethdev.com> | 2015-02-20 19:27:39 +0800 |
---|---|---|
committer | Liana Husikyan <liana@ethdev.com> | 2015-02-21 05:51:16 +0800 |
commit | 858acaa1937ccc2f6cc13bb3076abc32c43789b0 (patch) | |
tree | 6628fd9080584e7dbae13272a00aee9a2357df1a /ExpressionCompiler.cpp | |
parent | 1ed86b33bcb07f432209953ec4ed1779d0831452 (diff) | |
download | dexon-solidity-858acaa1937ccc2f6cc13bb3076abc32c43789b0.tar.gz dexon-solidity-858acaa1937ccc2f6cc13bb3076abc32c43789b0.tar.zst dexon-solidity-858acaa1937ccc2f6cc13bb3076abc32c43789b0.zip |
corrected accept for variableDeclaration
changes after code review
Diffstat (limited to 'ExpressionCompiler.cpp')
-rw-r--r-- | ExpressionCompiler.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/ExpressionCompiler.cpp b/ExpressionCompiler.cpp index c2a10ab4..653bf829 100644 --- a/ExpressionCompiler.cpp +++ b/ExpressionCompiler.cpp @@ -58,15 +58,19 @@ void ExpressionCompiler::appendStateVariableAccessor(CompilerContext& _context, void ExpressionCompiler::appendStateVariableInitialization(CompilerContext& _context, VariableDeclaration const& _varDecl, bool _optimize) { + compileExpression(_context, *(_varDecl.getValue()), _optimize); + if (_varDecl.getValue()->getType()) + appendTypeConversion(_context, *(_varDecl.getValue())->getType(), *(_varDecl.getValue())->getType()); + ExpressionCompiler compiler(_context, _optimize); compiler.appendStateVariableInitialization(_varDecl); } void ExpressionCompiler::appendStateVariableInitialization(VariableDeclaration const& _varDecl) { - m_currentLValue.fromVariableDeclaration(_varDecl); - m_currentLValue.storeValue(*_varDecl.getType(), _varDecl.getLocation()); - m_currentLValue.reset(); + LValue lvalue = LValue(m_context); + lvalue.fromVariableDeclaration(_varDecl); + lvalue.storeValue(*_varDecl.getType(), _varDecl.getLocation()); } bool ExpressionCompiler::visit(Assignment const& _assignment) @@ -1024,9 +1028,7 @@ void ExpressionCompiler::LValue::fromIdentifier(Identifier const& _identifier, D m_baseStackOffset = m_context->getBaseStackOffsetOfVariable(_declaration); } else if (m_context->isStateVariable(&_declaration)) - //{ fromVariableDeclaration(_declaration); - //} else BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_sourceLocation(_identifier.getLocation()) << errinfo_comment("Identifier type not supported or identifier not found.")); @@ -1034,7 +1036,6 @@ void ExpressionCompiler::LValue::fromIdentifier(Identifier const& _identifier, D void ExpressionCompiler::LValue::fromVariableDeclaration(Declaration const& _declaration) { - //solAssert(m_context->isStateVariable(&_declaration), "Not a state variable."); *m_context << m_context->getStorageLocationOfVariable(_declaration); m_type = LValueType::Storage; m_dataType = _declaration.getType(); |