Changeset 7933351 for src/SynTree


Ignore:
Timestamp:
Dec 13, 2016, 4:59:46 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:
ea83e00a
Parents:
fc638d2
Message:

add tuple cast resolution code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Type.h

    rfc638d2 r7933351  
    7272        virtual unsigned size() const { return 1; };
    7373        virtual bool isVoid() const { return size() == 0; }
     74        virtual Type * getComponent( unsigned i ) { assertf( size() == 1 && i == 0, "Type::getComponent was called with size %d and index %d\n", size(), i ); return this; }
    7475
    7576        virtual Type *clone() const = 0;
     
    372373        iterator end() { return types.end(); }
    373374
     375        virtual Type * getComponent( unsigned i ) {
     376                assertf( i < size(), "TupleType::getComponent: index %d must be less than size %d", i, size() );
     377                return *(begin()+i);
     378        }
     379
    374380        virtual TupleType *clone() const { return new TupleType( *this ); }
    375381        virtual void accept( Visitor &v ) { v.visit( this ); }
Note: See TracChangeset for help on using the changeset viewer.