diff options
author | Liana Husikyan <liana@ethdev.com> | 2015-03-03 19:58:01 +0800 |
---|---|---|
committer | Liana Husikyan <liana@ethdev.com> | 2015-03-16 17:46:46 +0800 |
commit | 67cd3a7180023f613efda64f4f4d2b1bc37990c6 (patch) | |
tree | 2a21e2f726baf19f39e999083158a32f90492cec /AST.h | |
parent | a16677dcfbd7fd7d42fbd6166e234b1b7001ec59 (diff) | |
download | dexon-solidity-67cd3a7180023f613efda64f4f4d2b1bc37990c6.tar.gz dexon-solidity-67cd3a7180023f613efda64f4f4d2b1bc37990c6.tar.zst dexon-solidity-67cd3a7180023f613efda64f4f4d2b1bc37990c6.zip |
added parsing for constant variables
Diffstat (limited to 'AST.h')
-rw-r--r-- | AST.h | 27 |
1 files changed, 19 insertions, 8 deletions
@@ -440,13 +440,22 @@ private: class VariableDeclaration: public Declaration { public: - VariableDeclaration(SourceLocation const& _location, ASTPointer<TypeName> const& _type, - ASTPointer<ASTString> const& _name, ASTPointer<Expression> _value, - Visibility _visibility, - bool _isStateVar = false, bool _isIndexed = false): - Declaration(_location, _name, _visibility), - m_typeName(_type), m_value(_value), - m_isStateVariable(_isStateVar), m_isIndexed(_isIndexed) {} + VariableDeclaration( + SourceLocation const& _location, + ASTPointer<TypeName> const& _type, + ASTPointer<ASTString> const& _name, + ASTPointer<Expression> _value, + Visibility _visibility, + bool _isStateVar = false, + bool _isIndexed = false, + bool _isConstant = false): + Declaration(_location, _name, _visibility), + m_typeName(_type), + m_value(_value), + m_isStateVariable(_isStateVar), + m_isIndexed(_isIndexed), + m_isConstant(_isConstant){} + virtual void accept(ASTVisitor& _visitor) override; virtual void accept(ASTConstVisitor& _visitor) const override; @@ -465,15 +474,17 @@ public: bool isExternalFunctionParameter() const; bool isStateVariable() const { return m_isStateVariable; } bool isIndexed() const { return m_isIndexed; } + bool isConstant() const { return m_isConstant; } protected: Visibility getDefaultVisibility() const override { return Visibility::Internal; } private: ASTPointer<TypeName> m_typeName; ///< can be empty ("var") - ASTPointer<Expression> m_value; ///< the assigned value, can be missing + ASTPointer<Expression> m_value; ///< the assigned value, can be missing bool m_isStateVariable; ///< Whether or not this is a contract state variable bool m_isIndexed; ///< Whether this is an indexed variable (used by events). + bool m_isConstant; ///< Whether the variable is a compile-time constant. std::shared_ptr<Type const> m_type; ///< derived type, initially empty }; |