|
|
@ -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
|
|
|
|
}; |
|
|
|