From d71cd3aa2b235f877b7928b57c94159e2c16865c Mon Sep 17 00:00:00 2001 From: chriseth Date: Sun, 22 Nov 2015 20:39:10 +0100 Subject: Added the `using x for y` directive. --- libsolidity/ast/AST.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'libsolidity/ast/AST.h') 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> 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 const& _libraryName, + ASTPointer 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 m_libraryName; + ASTPointer m_typeName; +}; + class StructDefinition: public Declaration { public: -- cgit v1.2.3