Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Label.hpp

    re0115286 r14cebb7a  
    2525namespace ast {
    2626
    27 class Attribute;
     27        class Attribute;
    2828
    29 /// Named labels for statements
    30 class Label {
    31 public:
    32         CodeLocation location;
    33         std::string name;
    34         std::vector< ptr<Attribute> > attributes;
     29        /// Named labels for statements
     30        class Label {
     31        public:
     32                CodeLocation location;
     33                std::string name;
     34                std::vector< ptr<Attribute> > attributes;
    3535
    36         Label( CodeLocation loc, const std::string& name = "",
    37                 const std::vector<ptr<Attribute>>& attrs = std::vector<ptr<Attribute>>{} )
    38         : location( loc ), name( name ), attributes( attrs ) {}
     36                Label( CodeLocation loc, const std::string& name = "",
     37                        const std::vector<ptr<Attribute>>& attrs = std::vector<ptr<Attribute>>{} )
     38                : location( loc ), name( name ), attributes( attrs ) {}
    3939
    40         operator std::string () const { return name; }
    41         bool empty() { return name.empty(); }
    42 };
     40                operator std::string () const { return name; }
     41                bool empty() { return name.empty(); }
     42        };
    4343
    44 inline bool operator== ( const Label& l1, const Label& l2 ) { return l1.name == l2.name; }
    45 inline bool operator!= ( const Label& l1, const Label& l2 ) { return !(l1 == l2); }
    46 inline bool operator<  ( const Label& l1, const Label& l2 ) { return l1.name < l2.name; }
     44        inline bool operator== ( const Label& l1, const Label& l2 ) { return l1.name == l2.name; }
     45        inline bool operator!= ( const Label& l1, const Label& l2 ) { return !(l1 == l2); }
     46        inline bool operator<  ( const Label& l1, const Label& l2 ) { return l1.name < l2.name; }
    4747
    48 inline std::ostream& operator<< ( std::ostream& out, const Label& l ) { return out << l.name; }
    49 
    50 
    51 //=================================================================================================
    52 /// This disgusting and giant piece of boiler-plate is here to solve a cyclic dependency
    53 /// remove only if there is a better solution
    54 /// The problem is that ast::ptr< ... > uses increment/decrement which won't work well with
    55 /// forward declarations
    56 inline void increment( const class Label * node, Node::ref_type ref ) { node->increment( ref ); }
    57 inline void decrement( const class Label * node, Node::ref_type ref ) { node->decrement( ref ); }
     48        inline std::ostream& operator<< ( std::ostream& out, const Label& l ) { return out << l.name; }
    5849
    5950}
Note: See TracChangeset for help on using the changeset viewer.