Changeset 23b6643f for src/SynTree
- Timestamp:
- Sep 20, 2016, 4:47:34 PM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 1132b62
- Parents:
- aefcc3b (diff), db46512 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- src/SynTree
- Files:
-
- 1 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Mutator.cc
raefcc3b r23b6643f 480 480 } 481 481 482 Type *Mutator::mutate( ZeroType *zeroType ) { 483 mutateAll( zeroType->get_forall(), *this ); 484 return zeroType; 485 } 486 487 Type *Mutator::mutate( OneType *oneType ) { 488 mutateAll( oneType->get_forall(), *this ); 489 return oneType; 490 } 491 482 492 Initializer *Mutator::mutate( SingleInit *singleInit ) { 483 493 singleInit->set_value( singleInit->get_value()->acceptMutator( *this ) ); -
src/SynTree/Mutator.h
raefcc3b r23b6643f 99 99 virtual Type* mutate( AttrType *attrType ); 100 100 virtual Type* mutate( VarArgsType *varArgsType ); 101 virtual Type* mutate( ZeroType *zeroType ); 102 virtual Type* mutate( OneType *oneType ); 101 103 102 104 virtual Initializer* mutate( SingleInit *singleInit ); -
src/SynTree/SynTree.h
raefcc3b r23b6643f 106 106 class AttrType; 107 107 class VarArgsType; 108 class ZeroType; 109 class OneType; 108 110 109 111 class Initializer; -
src/SynTree/Type.h
raefcc3b r23b6643f 436 436 }; 437 437 438 /// Represents a zero constant 439 class ZeroType : public Type { 440 public: 441 ZeroType(); 442 ZeroType( Type::Qualifiers tq ); 443 444 virtual ZeroType *clone() const { return new ZeroType( *this ); } 445 virtual void accept( Visitor &v ) { v.visit( this ); } 446 virtual Type *acceptMutator( Mutator &m ) { return m.mutate( this ); } 447 virtual void print( std::ostream &os, int indent = 0 ) const; 448 }; 449 450 /// Represents a one constant 451 class OneType : public Type { 452 public: 453 OneType(); 454 OneType( Type::Qualifiers tq ); 455 456 virtual OneType *clone() const { return new OneType( *this ); } 457 virtual void accept( Visitor &v ) { v.visit( this ); } 458 virtual Type *acceptMutator( Mutator &m ) { return m.mutate( this ); } 459 virtual void print( std::ostream &os, int indent = 0 ) const; 460 }; 461 438 462 inline Type::Qualifiers &Type::Qualifiers::operator&=( const Type::Qualifiers &other ) { 439 463 isConst &= other.isConst; -
src/SynTree/TypeSubstitution.cc
raefcc3b r23b6643f 179 179 } 180 180 181 Type * TypeSubstitution::mutate( VoidType * basicType ) {182 return handleType( basicType );181 Type * TypeSubstitution::mutate( VoidType *voidType ) { 182 return handleType( voidType ); 183 183 } 184 184 … … 221 221 Type * TypeSubstitution::mutate( VarArgsType *varArgsType ) { 222 222 return handleType( varArgsType ); 223 } 224 225 Type * TypeSubstitution::mutate( ZeroType *zeroType ) { 226 return handleType( zeroType ); 227 } 228 229 Type * TypeSubstitution::mutate( OneType *oneType ) { 230 return handleType( oneType ); 223 231 } 224 232 -
src/SynTree/TypeSubstitution.h
raefcc3b r23b6643f 76 76 virtual Type* mutate(TupleType *tupleType); 77 77 virtual Type* mutate(VarArgsType *varArgsType); 78 virtual Type* mutate(ZeroType *zeroType); 79 virtual Type* mutate(OneType *oneType); 78 80 79 81 // TODO: worry about traversing into a forall-qualified function type or type decl with assertions -
src/SynTree/Visitor.cc
raefcc3b r23b6643f 406 406 } 407 407 408 void Visitor::visit( ZeroType *zeroType ) { 409 acceptAll( zeroType->get_forall(), *this ); 410 } 411 412 void Visitor::visit( OneType *oneType ) { 413 acceptAll( oneType->get_forall(), *this ); 414 } 415 408 416 void Visitor::visit( SingleInit *singleInit ) { 409 417 singleInit->get_value()->accept( *this ); -
src/SynTree/Visitor.h
raefcc3b r23b6643f 99 99 virtual void visit( AttrType *attrType ); 100 100 virtual void visit( VarArgsType *varArgsType ); 101 virtual void visit( ZeroType *zeroType ); 102 virtual void visit( OneType *oneType ); 101 103 102 104 virtual void visit( SingleInit *singleInit ); -
src/SynTree/module.mk
raefcc3b r23b6643f 26 26 SynTree/AttrType.cc \ 27 27 SynTree/VarArgsType.cc \ 28 SynTree/ZeroOneType.cc \ 28 29 SynTree/Constant.cc \ 29 30 SynTree/Expression.cc \
Note: See TracChangeset
for help on using the changeset viewer.