diff options
author | Christian <c@ethdev.com> | 2014-11-22 02:14:56 +0800 |
---|---|---|
committer | Christian <c@ethdev.com> | 2014-11-24 04:28:45 +0800 |
commit | 583a315d3d282ab9fd871bb2ea3beded367be6d0 (patch) | |
tree | 8471241f34041fe5aadd7fc0a574fef8c80e2aa8 /AST.h | |
parent | c50cd646ce3b8b6c20da747efee89f9420526cae (diff) | |
download | dexon-solidity-583a315d3d282ab9fd871bb2ea3beded367be6d0.tar.gz dexon-solidity-583a315d3d282ab9fd871bb2ea3beded367be6d0.tar.zst dexon-solidity-583a315d3d282ab9fd871bb2ea3beded367be6d0.zip |
Magic variables.
Diffstat (limited to 'AST.h')
-rw-r--r-- | AST.h | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -230,6 +230,28 @@ private: std::shared_ptr<Type const> m_type; ///< derived type, initially empty }; +/** + * Pseudo AST node that is used as declaration for "this", "msg", "tx" and "block" when the + * identifier is encountered. Will never have a valid location in the source code. + */ +class MagicVariableDeclaration: public Declaration +{ +public: + enum class VariableKind { THIS, MSG, TX, BLOCK }; + MagicVariableDeclaration(VariableKind _kind, ASTString const& _name, + std::shared_ptr<Type const> const& _type): + Declaration(Location(), std::make_shared<ASTString>(_name)), m_kind(_kind), m_type(_type) {} + virtual void accept(ASTVisitor&) override { BOOST_THROW_EXCEPTION(InternalCompilerError() + << errinfo_comment("MagicVariableDeclaration used inside real AST.")); } + + std::shared_ptr<Type const> const& getType() const { return m_type; } + VariableKind getKind() const { return m_kind; } + +private: + VariableKind m_kind; + std::shared_ptr<Type const> m_type; +}; + /// Types /// @{ |