Ignore:
Timestamp:
May 10, 2019, 3:00:41 PM (5 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
2a5e8a6
Parents:
1f93c2c
Message:

Fix a cyclic dependency with ptr and nodes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/ParseNode.hpp

    r1f93c2c re0115286  
    2222namespace ast {
    2323
    24         /// AST node with an included source location
    25         class ParseNode : public Node {
    26         public:
    27                 CodeLocation location;
     24/// AST node with an included source location
     25class ParseNode : public Node {
     26public:
     27        CodeLocation location;
    2828
    29                 // Default constructor is deliberately omitted, all ParseNodes must have a location.
    30                 // Escape hatch if needed is to explicitly pass a default-constructed location, but
    31                 // this should be used sparingly.
     29        // Default constructor is deliberately omitted, all ParseNodes must have a location.
     30        // Escape hatch if needed is to explicitly pass a default-constructed location, but
     31        // this should be used sparingly.
    3232
    33                 ParseNode( const CodeLocation& loc ) : Node(), location(loc) {}
     33        ParseNode( const CodeLocation& loc ) : Node(), location(loc) {}
    3434
    35                 ParseNode( const ParseNode& o ) = default;
    36         };
     35        ParseNode( const ParseNode& o ) = default;
     36};
    3737
     38
     39//=================================================================================================
     40/// This disgusting and giant piece of boiler-plate is here to solve a cyclic dependency
     41/// remove only if there is a better solution
     42/// The problem is that ast::ptr< ... > uses increment/decrement which won't work well with
     43/// forward declarations
     44inline void increment( const class ParseNode * node, Node::ref_type ref ) { node->increment( ref ); }
     45inline void decrement( const class ParseNode * node, Node::ref_type ref ) { node->decrement( ref ); }
    3846}
    3947
Note: See TracChangeset for help on using the changeset viewer.