add tests for state variables accessors. normal and constant

fixed the issue with accessors for constant state variables
This commit is contained in:
LianaHus
2015-08-21 17:57:57 +02:00
parent 289b814670
commit 1af8ff0121
6 changed files with 45 additions and 4 deletions
+11
View File
@@ -67,8 +67,19 @@ void ExpressionCompiler::appendStateVariableInitialization(VariableDeclaration c
StorageItem(m_context, _varDecl).storeValue(*type, _varDecl.getLocation(), true);
}
void ExpressionCompiler::appendConstStateVariableAccessor(VariableDeclaration const& _varDecl)
{
solAssert(_varDecl.isConstant(), "");
_varDecl.getValue()->accept(*this);
// append return
m_context << eth::dupInstruction(_varDecl.getType()->getSizeOnStack() + 1);
m_context.appendJump(eth::AssemblyItem::JumpType::OutOfFunction);
}
void ExpressionCompiler::appendStateVariableAccessor(VariableDeclaration const& _varDecl)
{
solAssert(!_varDecl.isConstant(), "");
CompilerContext::LocationSetter locationSetter(m_context, _varDecl);
FunctionType accessorType(_varDecl);