diff options
author | chriseth <c@ethdev.com> | 2015-11-23 03:39:10 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-11-27 00:49:39 +0800 |
commit | d71cd3aa2b235f877b7928b57c94159e2c16865c (patch) | |
tree | b24bc90e27cdc7e8cf2a5674aa9376bef72db2aa /libsolidity/ast/AST.h | |
parent | 09b2f9acb7f5f47f53c4b56fdf0f86946551bf12 (diff) | |
download | dexon-solidity-d71cd3aa2b235f877b7928b57c94159e2c16865c.tar dexon-solidity-d71cd3aa2b235f877b7928b57c94159e2c16865c.tar.gz dexon-solidity-d71cd3aa2b235f877b7928b57c94159e2c16865c.tar.bz2 dexon-solidity-d71cd3aa2b235f877b7928b57c94159e2c16865c.tar.lz dexon-solidity-d71cd3aa2b235f877b7928b57c94159e2c16865c.tar.xz dexon-solidity-d71cd3aa2b235f877b7928b57c94159e2c16865c.tar.zst dexon-solidity-d71cd3aa2b235f877b7928b57c94159e2c16865c.zip |
Added the `using x for y` directive.
Diffstat (limited to 'libsolidity/ast/AST.h')
-rw-r--r-- | libsolidity/ast/AST.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/libsolidity/ast/AST.h b/libsolidity/ast/AST.h index a28d9f4f..2d6e9cfc 100644 --- a/libsolidity/ast/AST.h +++ b/libsolidity/ast/AST.h @@ -335,6 +335,33 @@ private: std::vector<ASTPointer<Expression>> m_arguments; }; +/** + * `using LibraryName for uint` will attach all functions from the library LibraryName + * to `uint` if the first parameter matches the type. `using LibraryName for *` attaches + * the function to any matching type. + */ +class UsingForDirective: public ASTNode +{ +public: + UsingForDirective( + SourceLocation const& _location, + ASTPointer<Identifier> const& _libraryName, + ASTPointer<TypeName> const& _typeName + ): + ASTNode(_location), m_libraryName(_libraryName), m_typeName(_typeName) {} + + virtual void accept(ASTVisitor& _visitor) override; + virtual void accept(ASTConstVisitor& _visitor) const override; + + Identifier const& libraryName() const { return *m_libraryName; } + /// @returns the type name the library is attached to, null for `*`. + TypeName const* typeName() const { return m_typeName.get(); } + +private: + ASTPointer<Identifier> m_libraryName; + ASTPointer<TypeName> m_typeName; +}; + class StructDefinition: public Declaration { public: |