Ignore:
Timestamp:
Sep 27, 2017, 4:24:16 PM (4 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
7fc7cdb
Parents:
e4ea10b
git-author:
Rob Schluntz <rschlunt@…> (09/27/17 15:50:09)
git-committer:
Rob Schluntz <rschlunt@…> (09/27/17 16:24:16)
Message:

Make Attribute a child of BaseSyntaxNode?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Attribute.h

    re4ea10b r5ea7a22  
    2020#include <string>  // for string, operator==
    2121
     22#include "BaseSyntaxNode.h"
     23#include "Mutator.h"
     24#include "Visitor.h"
     25
    2226class Expression;
    2327
    2428// GCC attribute
    2529// https://gcc.gnu.org/onlinedocs/gcc-6.1.0/gcc/Attribute-Syntax.html#Attribute-Syntax
    26 class Attribute {
     30class Attribute : public BaseSyntaxNode {
    2731  public:
     32        std::string name;
     33        // to keep things nice and tight, use NameExpr for special identifier parameters
     34        std::list< Expression * > parameters;
     35
    2836        Attribute( std::string name = "", const std::list< Expression * > & parameters = std::list< Expression * >() ) : name( name ), parameters( parameters ) {}
    2937        Attribute( const Attribute &other );
     
    3644
    3745        Attribute * clone() const { return new Attribute( *this ); }
    38         void print( std:: ostream &os, int indent = 0 ) const;
    39   private:
    40         std::string name;
    41         // to keep things nice and tight, use NameExpr for special identifier parameters
    42         std::list< Expression * > parameters;
     46        virtual void accept( Visitor & v ) { v.visit( this ); }
     47        virtual Attribute * acceptMutator( Mutator & m ) { return m.mutate( this ); }
     48        virtual void print( std::ostream & os, int indent = 0 ) const;
    4349};
    4450
Note: See TracChangeset for help on using the changeset viewer.