- Timestamp:
- Aug 18, 2016, 5:00:28 PM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 5b7a60c8
- Parents:
- 1cb2282
- Location:
- src/Parser
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/DeclarationNode.cc
r1cb2282 r99cad3aa 10 10 // Created On : Sat May 16 12:34:05 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Aug 17 11:08:56201613 // Update Count : 18 012 // Last Modified On : Wed Aug 17 23:14:51 2016 13 // Update Count : 181 14 14 // 15 15 … … 779 779 } 780 780 781 DeclarationNode *DeclarationNode::appendList( DeclarationNode *node ) {782 return (DeclarationNode *)set_last( node );783 }784 785 781 DeclarationNode *DeclarationNode::extractAggregate() const { 786 782 if ( type ) { -
src/Parser/ParseNode.cc
r1cb2282 r99cad3aa 10 10 // Created On : Sat May 16 13:26:29 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Aug 16 21:31:47201613 // Update Count : 12 512 // Last Modified On : Wed Aug 17 23:14:16 2016 13 // Update Count : 126 14 14 // 15 15 … … 19 19 int ParseNode::indent_by = 4; 20 20 21 ParseNode::ParseNode() {};22 ParseNode::ParseNode( const string *name ) : name( *name ) { assert( false ); delete name; }23 ParseNode::ParseNode( const string &name ) : name( name ) { assert( false ); }24 25 ParseNode::~ParseNode() {26 delete next;27 };28 29 ParseNode *ParseNode::get_last() {30 ParseNode *current;31 for ( current = this; current->get_next() != 0; current = current->get_next() );32 return current;33 }34 35 ParseNode *ParseNode::set_last( ParseNode *newlast ) {36 if ( newlast != 0 ) get_last()->set_next( newlast );37 return this;38 }39 40 21 // Local Variables: // 41 22 // tab-width: 4 // -
src/Parser/ParseNode.h
r1cb2282 r99cad3aa 10 10 // Created On : Sat May 16 13:28:16 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Aug 16 21:32:18201613 // Update Count : 5 3812 // Last Modified On : Wed Aug 17 23:15:59 2016 13 // Update Count : 541 14 14 // 15 15 … … 40 40 class ParseNode { 41 41 public: 42 ParseNode() ;43 ParseNode( const std::string * );44 ParseNode( const std::string & ); // for copy constructing subclasses45 virtual ~ParseNode() ;42 ParseNode() {}; 43 ParseNode( const std::string *name ) : name( *name ) { assert( false ); delete name; } 44 ParseNode( const std::string &name ) : name( name ) { assert( false ); } 45 virtual ~ParseNode() { delete next; }; 46 46 virtual ParseNode *clone() const = 0; 47 47 48 48 ParseNode *get_next() const { return next; } 49 49 ParseNode *set_next( ParseNode *newlink ) { next = newlink; return this; } 50 ParseNode *get_last(); 51 ParseNode *set_last( ParseNode *newlast ); 50 ParseNode *get_last() { 51 ParseNode *current; 52 for ( current = this; current->get_next() != 0; current = current->get_next() ); 53 return current; 54 } 55 ParseNode *set_last( ParseNode *newlast ) { 56 if ( newlast != 0 ) get_last()->set_next( newlast ); 57 return this; 58 } 52 59 53 60 const std::string &get_name() const { return name; } … … 254 261 DeclarationNode *cloneBaseType( DeclarationNode *newdecl ); 255 262 256 DeclarationNode *appendList( DeclarationNode * ); 263 DeclarationNode *appendList( DeclarationNode *node ) { 264 return (DeclarationNode *)set_last( node ); 265 } 257 266 258 267 void print( std::ostream &os, int indent = 0 ) const;
Note: See TracChangeset
for help on using the changeset viewer.