From 00b0b0933de8f745451652e8838f0c09a741228e Mon Sep 17 00:00:00 2001 From: liana Date: Wed, 14 Jan 2015 13:52:03 +0100 Subject: - added functionality to set values to 0 when deleting structure(not for mapping) - added unit test Made some changes after Christian`s review on pull request - remove/edit comments - BoolType and ContractType return VoidType after delete - fixed constructor_arguments test - fixed set to 0 when deleting variable from stack - changed test case to test that --- ExpressionCompiler.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'ExpressionCompiler.h') diff --git a/ExpressionCompiler.h b/ExpressionCompiler.h index 98f58c85..665ee3c9 100644 --- a/ExpressionCompiler.h +++ b/ExpressionCompiler.h @@ -119,7 +119,7 @@ private: /// Set type according to the declaration and retrieve the reference. /// @a _expression is the current expression void fromIdentifier(Identifier const& _identifier, Declaration const& _declaration); - void reset() { m_type = NONE; m_baseStackOffset = 0; } + void reset() { m_type = NONE; m_baseStackOffset = 0; m_size = 0; } bool isValid() const { return m_type != NONE; } bool isInOnStack() const { return m_type == STACK; } @@ -138,7 +138,9 @@ private: /// Also removes the stored value from the stack if @a _move is /// true. @a _expression is the current expression, used for error reporting. void storeValue(Expression const& _expression, bool _move = false) const; - + /// Stores zero in the lvalue. + /// @a _expression is the current expression, used for error reporting. + void setToZero(Expression const& _expression) const; /// Convenience function to convert the stored reference to a value and reset type to NONE if /// the reference was not requested by @a _expression. void retrieveValueIfLValueNotRequested(Expression const& _expression); @@ -149,8 +151,8 @@ private: /// If m_type is STACK, this is base stack offset (@see /// CompilerContext::getBaseStackOffsetOfVariable) of a local variable. unsigned m_baseStackOffset = 0; - /// Size of the value of this lvalue on the stack. - unsigned m_stackSize = 0; + /// Size of the value of this lvalue on the stack or the storage. + unsigned m_size = 0; }; bool m_optimize; -- cgit