mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
cosmetic changes
This commit is contained in:
parent
52050201e3
commit
1ed86b33bc
@ -251,7 +251,7 @@ void Compiler::registerStateVariables(ContractDefinition const& _contract)
|
|||||||
|
|
||||||
void Compiler::initializeStateVariables(ContractDefinition const& _contract)
|
void Compiler::initializeStateVariables(ContractDefinition const& _contract)
|
||||||
{
|
{
|
||||||
for(ASTPointer<VariableDeclaration> const& variable: _contract.getStateVariables())
|
for (ASTPointer<VariableDeclaration> const& variable: _contract.getStateVariables())
|
||||||
if (variable->getValue())
|
if (variable->getValue())
|
||||||
{
|
{
|
||||||
compileExpression(*(variable->getValue()), (variable->getValue())->getType());
|
compileExpression(*(variable->getValue()), (variable->getValue())->getType());
|
||||||
|
@ -64,7 +64,7 @@ void ExpressionCompiler::appendStateVariableInitialization(CompilerContext& _con
|
|||||||
|
|
||||||
void ExpressionCompiler::appendStateVariableInitialization(VariableDeclaration const& _varDecl)
|
void ExpressionCompiler::appendStateVariableInitialization(VariableDeclaration const& _varDecl)
|
||||||
{
|
{
|
||||||
m_currentLValue.fromStateVariable(_varDecl);
|
m_currentLValue.fromVariableDeclaration(_varDecl);
|
||||||
m_currentLValue.storeValue(*_varDecl.getType(), _varDecl.getLocation());
|
m_currentLValue.storeValue(*_varDecl.getType(), _varDecl.getLocation());
|
||||||
m_currentLValue.reset();
|
m_currentLValue.reset();
|
||||||
}
|
}
|
||||||
@ -1024,22 +1024,17 @@ void ExpressionCompiler::LValue::fromIdentifier(Identifier const& _identifier, D
|
|||||||
m_baseStackOffset = m_context->getBaseStackOffsetOfVariable(_declaration);
|
m_baseStackOffset = m_context->getBaseStackOffsetOfVariable(_declaration);
|
||||||
}
|
}
|
||||||
else if (m_context->isStateVariable(&_declaration))
|
else if (m_context->isStateVariable(&_declaration))
|
||||||
{
|
//{
|
||||||
*m_context << m_context->getStorageLocationOfVariable(_declaration);
|
fromVariableDeclaration(_declaration);
|
||||||
m_type = LValueType::Storage;
|
//}
|
||||||
m_dataType = _identifier.getType();
|
|
||||||
solAssert(m_dataType->getStorageSize() <= numeric_limits<unsigned>::max(),
|
|
||||||
"The storage size of " + m_dataType->toString() + " should fit in an unsigned");
|
|
||||||
m_size = unsigned(m_dataType->getStorageSize());
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_sourceLocation(_identifier.getLocation())
|
BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_sourceLocation(_identifier.getLocation())
|
||||||
<< errinfo_comment("Identifier type not supported or identifier not found."));
|
<< errinfo_comment("Identifier type not supported or identifier not found."));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExpressionCompiler::LValue::fromStateVariable(VariableDeclaration const& _declaration)
|
void ExpressionCompiler::LValue::fromVariableDeclaration(Declaration const& _declaration)
|
||||||
{
|
{
|
||||||
solAssert(m_context->isStateVariable(&_declaration), "Not a state variable.");
|
//solAssert(m_context->isStateVariable(&_declaration), "Not a state variable.");
|
||||||
*m_context << m_context->getStorageLocationOfVariable(_declaration);
|
*m_context << m_context->getStorageLocationOfVariable(_declaration);
|
||||||
m_type = LValueType::Storage;
|
m_type = LValueType::Storage;
|
||||||
m_dataType = _declaration.getType();
|
m_dataType = _declaration.getType();
|
||||||
|
@ -137,7 +137,7 @@ private:
|
|||||||
|
|
||||||
/// Set type according to the declaration and retrieve the reference.
|
/// Set type according to the declaration and retrieve the reference.
|
||||||
/// @a _declaration is the variable declaration
|
/// @a _declaration is the variable declaration
|
||||||
void fromStateVariable(VariableDeclaration const& _declaration);
|
void fromVariableDeclaration(const Declaration &_declaration);
|
||||||
|
|
||||||
void reset() { m_type = LValueType::None; m_dataType.reset(); m_baseStackOffset = 0; m_size = 0; }
|
void reset() { m_type = LValueType::None; m_dataType.reset(); m_baseStackOffset = 0; m_size = 0; }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user