From f0494307232e52dcc268f5f32d26cc89d7e98e3a Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 1 Mar 2016 22:56:39 +0100 Subject: Code generation (missing external access and source locations). --- libsolidity/ast/AST.cpp | 7 +++++++ libsolidity/ast/AST.h | 15 ++++++++++----- libsolidity/ast/ASTAnnotations.h | 11 +++++++++++ 3 files changed, 28 insertions(+), 5 deletions(-) (limited to 'libsolidity/ast') diff --git a/libsolidity/ast/AST.cpp b/libsolidity/ast/AST.cpp index b5affa8e..294daa13 100644 --- a/libsolidity/ast/AST.cpp +++ b/libsolidity/ast/AST.cpp @@ -363,6 +363,13 @@ StatementAnnotation& Statement::annotation() const return static_cast(*m_annotation); } +InlineAssemblyAnnotation& InlineAssembly::annotation() const +{ + if (!m_annotation) + m_annotation = new InlineAssemblyAnnotation(); + return static_cast(*m_annotation); +} + ReturnAnnotation& Return::annotation() const { if (!m_annotation) diff --git a/libsolidity/ast/AST.h b/libsolidity/ast/AST.h index f53c78f2..7bb2529a 100644 --- a/libsolidity/ast/AST.h +++ b/libsolidity/ast/AST.h @@ -855,8 +855,11 @@ public: virtual StatementAnnotation& annotation() const override; }; -// Forward-declaration to InlineAssembly.h -class AsmData; +namespace assembly +{ +// Forward-declaration to AsmData.h +struct Block; +} /** * Inline assembly. @@ -867,16 +870,18 @@ public: InlineAssembly( SourceLocation const& _location, ASTPointer const& _docString, - std::shared_ptr const& _operations + std::shared_ptr const& _operations ): Statement(_location, _docString), m_operations(_operations) {} virtual void accept(ASTVisitor& _visitor) override; virtual void accept(ASTConstVisitor& _visitor) const override; - AsmData const& operations() const { return *m_operations; } + assembly::Block const& operations() const { return *m_operations; } + + virtual InlineAssemblyAnnotation& annotation() const override; private: - std::shared_ptr m_operations; + std::shared_ptr m_operations; }; /** diff --git a/libsolidity/ast/ASTAnnotations.h b/libsolidity/ast/ASTAnnotations.h index 235338bb..2a192e47 100644 --- a/libsolidity/ast/ASTAnnotations.h +++ b/libsolidity/ast/ASTAnnotations.h @@ -110,6 +110,17 @@ struct StatementAnnotation: ASTAnnotation, DocumentedAnnotation { }; +namespace assembly +{ +struct Identifier; // forward +} + +struct InlineAssemblyAnnotation: StatementAnnotation +{ + /// Mapping containing resolved references to external identifiers. + std::map externalReferences; +}; + struct ReturnAnnotation: StatementAnnotation { /// Reference to the return parameters of the function. -- cgit v1.2.3