Changeset 23b6643f for src/SynTree


Ignore:
Timestamp:
Sep 20, 2016, 4:47:34 PM (8 years ago)
Author:
Rob Schluntz <rschlunt@…>
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.
Message:

Merge branch 'master' into tuples

Conflicts:

src/Makefile.in
src/ResolvExpr/Unify.cc
src/SynTree/Type.h

Location:
src/SynTree
Files:
1 added
9 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Mutator.cc

    raefcc3b r23b6643f  
    480480}
    481481
     482Type *Mutator::mutate( ZeroType *zeroType ) {
     483        mutateAll( zeroType->get_forall(), *this );
     484        return zeroType;
     485}
     486
     487Type *Mutator::mutate( OneType *oneType ) {
     488        mutateAll( oneType->get_forall(), *this );
     489        return oneType;
     490}
     491
    482492Initializer *Mutator::mutate( SingleInit *singleInit ) {
    483493        singleInit->set_value( singleInit->get_value()->acceptMutator( *this ) );
  • src/SynTree/Mutator.h

    raefcc3b r23b6643f  
    9999        virtual Type* mutate( AttrType *attrType );
    100100        virtual Type* mutate( VarArgsType *varArgsType );
     101        virtual Type* mutate( ZeroType *zeroType );
     102        virtual Type* mutate( OneType *oneType );
    101103
    102104        virtual Initializer* mutate( SingleInit *singleInit );
  • src/SynTree/SynTree.h

    raefcc3b r23b6643f  
    106106class AttrType;
    107107class VarArgsType;
     108class ZeroType;
     109class OneType;
    108110
    109111class Initializer;
  • src/SynTree/Type.h

    raefcc3b r23b6643f  
    436436};
    437437
     438/// Represents a zero constant
     439class 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
     451class 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
    438462inline Type::Qualifiers &Type::Qualifiers::operator&=( const Type::Qualifiers &other ) {
    439463        isConst &= other.isConst;
  • src/SynTree/TypeSubstitution.cc

    raefcc3b r23b6643f  
    179179}
    180180
    181 Type * TypeSubstitution::mutate( VoidType *basicType ) {
    182         return handleType( basicType );
     181Type * TypeSubstitution::mutate( VoidType *voidType ) {
     182        return handleType( voidType );
    183183}
    184184
     
    221221Type * TypeSubstitution::mutate( VarArgsType *varArgsType ) {
    222222        return handleType( varArgsType );
     223}
     224
     225Type * TypeSubstitution::mutate( ZeroType *zeroType ) {
     226        return handleType( zeroType );
     227}
     228
     229Type * TypeSubstitution::mutate( OneType *oneType ) {
     230        return handleType( oneType );
    223231}
    224232
  • src/SynTree/TypeSubstitution.h

    raefcc3b r23b6643f  
    7676        virtual Type* mutate(TupleType *tupleType);
    7777        virtual Type* mutate(VarArgsType *varArgsType);
     78        virtual Type* mutate(ZeroType *zeroType);
     79        virtual Type* mutate(OneType *oneType);
    7880
    7981        // TODO: worry about traversing into a forall-qualified function type or type decl with assertions
  • src/SynTree/Visitor.cc

    raefcc3b r23b6643f  
    406406}
    407407
     408void Visitor::visit( ZeroType *zeroType ) {
     409        acceptAll( zeroType->get_forall(), *this );
     410}
     411
     412void Visitor::visit( OneType *oneType ) {
     413        acceptAll( oneType->get_forall(), *this );
     414}
     415
    408416void Visitor::visit( SingleInit *singleInit ) {
    409417        singleInit->get_value()->accept( *this );
  • src/SynTree/Visitor.h

    raefcc3b r23b6643f  
    9999        virtual void visit( AttrType *attrType );
    100100        virtual void visit( VarArgsType *varArgsType );
     101        virtual void visit( ZeroType *zeroType );
     102        virtual void visit( OneType *oneType );
    101103
    102104        virtual void visit( SingleInit *singleInit );
  • src/SynTree/module.mk

    raefcc3b r23b6643f  
    2626       SynTree/AttrType.cc \
    2727       SynTree/VarArgsType.cc \
     28       SynTree/ZeroOneType.cc \
    2829       SynTree/Constant.cc \
    2930       SynTree/Expression.cc \
Note: See TracChangeset for help on using the changeset viewer.