Changeset 5d125e4 for src/SynTree
- Timestamp:
- Jul 15, 2016, 10:16:47 PM (9 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:
- 873ffb7
- Parents:
- 5ed9061
- Location:
- src/SynTree
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/AggregateDecl.cc
r5ed9061 r5d125e4 10 10 // Created On : Sun May 17 23:56:39 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Mar 2 17:28:00 201613 // Update Count : 712 // Last Modified On : Wed Jul 13 18:03:30 2016 13 // Update Count : 10 14 14 // 15 15 … … 19 19 20 20 21 AggregateDecl::AggregateDecl( const std::string &name ) : Parent( name, DeclarationNode::NoStorageClass, LinkageSpec::Cforall ) {21 AggregateDecl::AggregateDecl( const std::string &name ) : Parent( name, DeclarationNode::NoStorageClass, LinkageSpec::Cforall ), body( false ) { 22 22 } 23 23 … … 25 25 cloneAll( other.members, members ); 26 26 cloneAll( other.parameters, parameters ); 27 body = other.body; 27 28 } 28 29 … … 37 38 38 39 os << typeString() << " " << get_name(); 40 os << string( indent+2, ' ' ) << "with body " << has_body() << endl; 41 39 42 if ( ! parameters.empty() ) { 40 43 os << endl << string( indent+2, ' ' ) << "with parameters" << endl; … … 52 55 53 56 os << typeString() << " " << get_name(); 57 os << string( indent+2, ' ' ) << "with body " << has_body() << endl; 58 54 59 if ( ! parameters.empty() ) { 55 60 os << endl << string( indent+2, ' ' ) << "with parameters" << endl; -
src/SynTree/Declaration.h
r5ed9061 r5d125e4 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Jun 30 21:17:24201613 // Update Count : 3 812 // Last Modified On : Tue Jul 12 21:03:17 2016 13 // Update Count : 39 14 14 // 15 15 … … 210 210 std::list<TypeDecl*>& get_parameters() { return parameters; } 211 211 212 bool has_body() const { return body; } 213 AggregateDecl * set_body( bool body ) { AggregateDecl::body = body; return this; } 214 212 215 virtual void print( std::ostream &os, int indent = 0 ) const; 213 216 virtual void printShort( std::ostream &os, int indent = 0 ) const; … … 218 221 std::list<Declaration*> members; 219 222 std::list<TypeDecl*> parameters; 223 bool body; 220 224 }; 221 225 … … 229 233 virtual void accept( Visitor &v ) { v.visit( this ); } 230 234 virtual Declaration *acceptMutator( Mutator &m ) { return m.mutate( this ); } 231 232 235 private: 233 236 virtual std::string typeString() const; -
src/SynTree/ReferenceToType.cc
r5ed9061 r5d125e4 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Mar 2 17:28:51201613 // Update Count : 512 // Last Modified On : Wed Jul 13 18:03:30 2016 13 // Update Count : 9 14 14 // 15 15 … … 69 69 } 70 70 71 void StructInstType::print( std::ostream &os, int indent ) const { 72 using std::endl; 73 74 if ( baseStruct == NULL ) ReferenceToType::print( os, indent ); 75 else { 76 Type::print( os, indent ); 77 os << "instance of " << typeString() << " " << name << " with body " << baseStruct->has_body() << " "; 78 if ( ! parameters.empty() ) { 79 os << endl << std::string( indent, ' ' ) << "with parameters" << endl; 80 printAll( parameters, os, indent+2 ); 81 } // if 82 } // if 83 } 84 71 85 std::string UnionInstType::typeString() const { return "union"; } 72 86 … … 79 93 assert( baseUnion ); 80 94 doLookup( baseUnion->get_members(), baseUnion->get_parameters(), parameters, name, foundDecls ); 95 } 96 97 void UnionInstType::print( std::ostream &os, int indent ) const { 98 using std::endl; 99 100 if ( baseUnion == NULL ) ReferenceToType::print( os, indent ); 101 else { 102 Type::print( os, indent ); 103 os << "instance of " << typeString() << " " << name << " with body " << baseUnion->has_body() << " "; 104 if ( ! parameters.empty() ) { 105 os << endl << std::string( indent, ' ' ) << "with parameters" << endl; 106 printAll( parameters, os, indent+2 ); 107 } // if 108 } // if 81 109 } 82 110 -
src/SynTree/Type.h
r5ed9061 r5d125e4 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Mar 2 17:29:08201613 // Update Count : 2 112 // Last Modified On : Wed Jul 13 11:46:54 2016 13 // Update Count : 23 14 14 // 15 15 … … 226 226 virtual std::string typeString() const = 0; 227 227 std::list< Expression* > parameters; 228 private:229 228 std::string name; 229 private: 230 230 }; 231 231 … … 249 249 virtual void accept( Visitor &v ) { v.visit( this ); } 250 250 virtual Type *acceptMutator( Mutator &m ) { return m.mutate( this ); } 251 252 virtual void print( std::ostream &os, int indent = 0 ) const; 251 253 private: 252 254 virtual std::string typeString() const; … … 276 278 virtual void accept( Visitor &v ) { v.visit( this ); } 277 279 virtual Type *acceptMutator( Mutator &m ) { return m.mutate( this ); } 280 281 virtual void print( std::ostream &os, int indent = 0 ) const; 278 282 private: 279 283 virtual std::string typeString() const;
Note: See TracChangeset
for help on using the changeset viewer.