Changeset e6cee92 for src/SynTree


Ignore:
Timestamp:
Jul 17, 2017, 3:25:58 PM (7 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:
795d450
Parents:
7ebaa56
Message:

Fix TupleAssignment? code for references

Location:
src/SynTree
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Expression.cc

    r7ebaa56 re6cee92  
    502502}
    503503
    504 AsmExpr::AsmExpr( const AsmExpr & other ) : inout( maybeClone( other.inout ) ), constraint( maybeClone( other.constraint ) ), operand( maybeClone( other.operand ) ) {}
     504AsmExpr::AsmExpr( const AsmExpr & other ) : Expression( other ), inout( maybeClone( other.inout ) ), constraint( maybeClone( other.constraint ) ), operand( maybeClone( other.operand ) ) {}
    505505
    506506
  • src/SynTree/ReferenceType.cc

    r7ebaa56 re6cee92  
    1919
    2020ReferenceType::ReferenceType( const Type::Qualifiers &tq, Type *base, const std::list< Attribute * > & attributes )
    21   : Type( tq, attributes ), base( base ) {
     21        : Type( tq, attributes ), base( base ) {
     22        assertf( base, "Reference Type with a null base created." );
    2223}
    2324
    2425ReferenceType::ReferenceType( const ReferenceType &other )
    25   : Type( other ), base( maybeClone( other.base ) ) {
     26        : Type( other ), base( maybeClone( other.base ) ) {
    2627}
    2728
    2829ReferenceType::~ReferenceType() {
    29   delete base;
     30        delete base;
     31}
     32
     33int ReferenceType::referenceDepth() const {
     34        return base->referenceDepth()+1;
    3035}
    3136
    3237void ReferenceType::print( std::ostream &os, int indent ) const {
    33   Type::print( os, indent );
    34   os << "reference to ";
    35   if ( base ) {
    36     base->print( os, indent );
    37   } // if
     38        Type::print( os, indent );
     39        os << "reference to ";
     40        if ( base ) {
     41                base->print( os, indent );
     42        } // if
    3843}
    3944
  • src/SynTree/Type.cc

    r7ebaa56 re6cee92  
    8181}
    8282
     83int Type::referenceDepth() const { return 0; }
     84
    8385void Type::print( std::ostream &os, int indent ) const {
    8486        if ( ! forall.empty() ) {
  • src/SynTree/Type.h

    r7ebaa56 re6cee92  
    163163        Type * stripReferences();
    164164
     165        /// return the number of references occuring consecutively on the outermost layer of this type (i.e. do not count references nested within other types)
     166        virtual int referenceDepth() const;
     167
    165168        virtual bool isComplete() const { return true; }
    166169
     
    304307        void set_base( Type *newValue ) { base = newValue; }
    305308
     309        virtual int referenceDepth() const;
     310
    306311        virtual ReferenceType *clone() const { return new ReferenceType( *this ); }
    307312        virtual void accept( Visitor & v ) { v.visit( this ); }
  • src/SynTree/TypeExpr.cc

    r7ebaa56 re6cee92  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // TypeExpr.cc -- 
     7// TypeExpr.cc --
    88//
    99// Author           : Richard C. Bilson
     
    2121}
    2222
    23 TypeExpr::TypeExpr( const TypeExpr &other ) : type( maybeClone( other.type ) ) {
     23TypeExpr::TypeExpr( const TypeExpr &other ) : Expression( other ), type( maybeClone( other.type ) ) {
    2424}
    2525
Note: See TracChangeset for help on using the changeset viewer.