Changeset 89e6ffc for src/SynTree
- Timestamp:
- Sep 19, 2016, 5:23:41 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:
- a6fe3de
- Parents:
- fc4a0fa
- Location:
- src/SynTree
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Mutator.cc
rfc4a0fa r89e6ffc 453 453 } 454 454 455 Type *Mutator::mutate( ZeroType *zeroType ) { 456 mutateAll( zeroType->get_forall(), *this ); 457 return zeroType; 458 } 459 460 Type *Mutator::mutate( OneType *oneType ) { 461 mutateAll( oneType->get_forall(), *this ); 462 return oneType; 463 } 464 455 465 Initializer *Mutator::mutate( SingleInit *singleInit ) { 456 466 singleInit->set_value( singleInit->get_value()->acceptMutator( *this ) ); -
src/SynTree/Mutator.h
rfc4a0fa r89e6ffc 95 95 virtual Type* mutate( AttrType *attrType ); 96 96 virtual Type* mutate( VarArgsType *varArgsType ); 97 virtual Type* mutate( ZeroType *zeroType ); 98 virtual Type* mutate( OneType *oneType ); 97 99 98 100 virtual Initializer* mutate( SingleInit *singleInit ); -
src/SynTree/SynTree.h
rfc4a0fa r89e6ffc 102 102 class AttrType; 103 103 class VarArgsType; 104 class ZeroType; 105 class OneType; 104 106 105 107 class Initializer; -
src/SynTree/Type.h
rfc4a0fa r89e6ffc 418 418 }; 419 419 420 /// Represents a zero constant 421 class ZeroType : public Type { 422 public: 423 ZeroType(); 424 ZeroType( Type::Qualifiers tq ); 425 426 virtual ZeroType *clone() const { return new ZeroType( *this ); } 427 virtual void accept( Visitor &v ) { v.visit( this ); } 428 virtual Type *acceptMutator( Mutator &m ) { return m.mutate( this ); } 429 virtual void print( std::ostream &os, int indent = 0 ) const; 430 }; 431 432 /// Represents a one constant 433 class OneType : public Type { 434 public: 435 OneType(); 436 OneType( Type::Qualifiers tq ); 437 438 virtual OneType *clone() const { return new OneType( *this ); } 439 virtual void accept( Visitor &v ) { v.visit( this ); } 440 virtual Type *acceptMutator( Mutator &m ) { return m.mutate( this ); } 441 virtual void print( std::ostream &os, int indent = 0 ) const; 442 }; 443 420 444 inline Type::Qualifiers &Type::Qualifiers::operator+=( const Type::Qualifiers &other ) { 421 445 isConst |= other.isConst; -
src/SynTree/TypeSubstitution.cc
rfc4a0fa r89e6ffc 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
rfc4a0fa r89e6ffc 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
rfc4a0fa r89e6ffc 383 383 } 384 384 385 void Visitor::visit( ZeroType *zeroType ) { 386 acceptAll( zeroType->get_forall(), *this ); 387 } 388 389 void Visitor::visit( OneType *oneType ) { 390 acceptAll( oneType->get_forall(), *this ); 391 } 392 385 393 void Visitor::visit( SingleInit *singleInit ) { 386 394 singleInit->get_value()->accept( *this ); -
src/SynTree/Visitor.h
rfc4a0fa r89e6ffc 95 95 virtual void visit( AttrType *attrType ); 96 96 virtual void visit( VarArgsType *varArgsType ); 97 virtual void visit( ZeroType *zeroType ); 98 virtual void visit( OneType *oneType ); 97 99 98 100 virtual void visit( SingleInit *singleInit ); -
src/SynTree/module.mk
rfc4a0fa r89e6ffc 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.