diff options
author | Christian <c@ethdev.com> | 2015-02-14 08:22:44 +0800 |
---|---|---|
committer | Christian <c@ethdev.com> | 2015-02-17 02:25:24 +0800 |
commit | f7ba85e0ecb6f690d62bcf66e0f0525f2ed97337 (patch) | |
tree | bbd2b50913748f78b311b6cbea27bb6ba5ec9c9e /AST.h | |
parent | 3e29ec2cb2075fc6734a0f350503c393fbeeb3d6 (diff) | |
download | dexon-solidity-f7ba85e0ecb6f690d62bcf66e0f0525f2ed97337.tar.gz dexon-solidity-f7ba85e0ecb6f690d62bcf66e0f0525f2ed97337.tar.zst dexon-solidity-f7ba85e0ecb6f690d62bcf66e0f0525f2ed97337.zip |
No write access to parameters of external functions.
Diffstat (limited to 'AST.h')
-rw-r--r-- | AST.h | 16 |
1 files changed, 7 insertions, 9 deletions
@@ -132,7 +132,6 @@ private: class Declaration: public ASTNode { public: - enum class LValueType { None, Local, Storage }; /// Visibility ordered from restricted to unrestricted. enum class Visibility { Default, Private, Protected, Public, External }; @@ -156,8 +155,7 @@ public: /// The current contract has to be given since this context can change the type, especially of /// contract types. virtual TypePointer getType(ContractDefinition const* m_currentContract = nullptr) const = 0; - /// @returns the lvalue type of expressions referencing this declaration - virtual LValueType getLValueType() const { return LValueType::None; } + virtual bool isLValue() const { return false; } protected: virtual Visibility getDefaultVisibility() const { return Visibility::Public; } @@ -448,8 +446,9 @@ public: TypePointer getType(ContractDefinition const* = nullptr) const { return m_type; } void setType(std::shared_ptr<Type const> const& _type) { m_type = _type; } - virtual LValueType getLValueType() const override; + virtual bool isLValue() const override; bool isLocalVariable() const { return !!dynamic_cast<FunctionDefinition const*>(getScope()); } + bool isFunctionParameter() const; bool isStateVariable() const { return m_isStateVariable; } bool isIndexed() const { return m_isIndexed; } @@ -887,8 +886,7 @@ public: virtual void checkTypeRequirements() = 0; std::shared_ptr<Type const> const& getType() const { return m_type; } - bool isLValue() const { return m_lvalue != Declaration::LValueType::None; } - bool isLocalLValue() const { return m_lvalue == Declaration::LValueType::Local; } + bool isLValue() const { return m_isLValue; } /// Helper function, infer the type via @ref checkTypeRequirements and then check that it /// is implicitly convertible to @a _expectedType. If not, throw exception. @@ -903,9 +901,9 @@ public: protected: //! Inferred type of the expression, only filled after a call to checkTypeRequirements(). std::shared_ptr<Type const> m_type; - //! If this expression is an lvalue (i.e. something that can be assigned to) and is stored - //! locally or in storage. This is set during calls to @a checkTypeRequirements() - Declaration::LValueType m_lvalue = Declaration::LValueType::None; + //! If this expression is an lvalue (i.e. something that can be assigned to). + //! This is set during calls to @a checkTypeRequirements() + bool m_isLValue = false; //! Whether the outer expression requested the address (true) or the value (false) of this expression. bool m_lvalueRequested = false; }; |