Changeset 2162c2c for src/SynTree


Ignore:
Timestamp:
Jan 11, 2017, 4:11:02 PM (9 years ago)
Author:
Thierry Delisle <tdelisle@…>
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, stuck-waitfor-destruct, with_gc
Children:
075734f
Parents:
bb82c03 (diff), d3a85240 (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' of plg.uwaterloo.ca:software/cfa/cfa-cc

Location:
src/SynTree
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/ApplicationExpr.cc

    rbb82c03 r2162c2c  
    2424
    2525ParamEntry::ParamEntry( const ParamEntry &other ) :
    26                 decl( other.decl ), actualType( maybeClone( other.actualType ) ), formalType( maybeClone( other.formalType ) ), expr( maybeClone( other.expr ) ) {
     26                decl( other.decl ), actualType( maybeClone( other.actualType ) ), formalType( maybeClone( other.formalType ) ), expr( maybeClone( other.expr ) ), inferParams( new InferredParams( *other.inferParams ) ) {
    2727}
    2828
     
    3434        formalType = maybeClone( other.formalType );
    3535        expr = maybeClone( other.expr );
     36        *inferParams = *other.inferParams;
    3637        return *this;
    3738}
     
    6263}
    6364
     65void printInferParams( const InferredParams & inferParams, std::ostream &os, int indent, int level ) {
     66        if ( ! inferParams.empty() ) {
     67                os << std::string(indent, ' ') << "with inferred parameters " << level << ":" << std::endl;
     68                for ( InferredParams::const_iterator i = inferParams.begin(); i != inferParams.end(); ++i ) {
     69                        os << std::string(indent+2, ' ');
     70                        Declaration::declFromId( i->second.decl )->printShort( os, indent+2 );
     71                        os << std::endl;
     72                        printInferParams( *i->second.inferParams, os, indent+2, level+1 );
     73                } // for
     74        } // if
     75}
     76
    6477void ApplicationExpr::print( std::ostream &os, int indent ) const {
    6578        os << "Application of" << std::endl << std::string(indent+2, ' ');
     
    6982                printAll( args, os, indent+2 );
    7083        } // if
    71         if ( ! inferParams.empty() ) {
    72                 os << std::string(indent, ' ') << "with inferred parameters:" << std::endl;
    73                 for ( InferredParams::const_iterator i = inferParams.begin(); i != inferParams.end(); ++i ) {
    74                         os << std::string(indent+2, ' ');
    75                         Declaration::declFromId( i->second.decl )->printShort( os, indent+2 );
    76                         os << std::endl;
    77                 } // for
    78         } // if
     84        printInferParams( inferParams, os, indent+2, 0 );
    7985        Expression::print( os, indent );
    8086}
  • src/SynTree/Declaration.cc

    rbb82c03 r2162c2c  
    5757
    5858std::ostream & operator<<( std::ostream & out, const Declaration * decl ) {
    59         decl->print( out );
     59        if ( decl ){
     60                decl->print( out );
     61        } else {
     62                out << "nullptr";
     63        }
    6064        return out;
    6165}
  • src/SynTree/Declaration.h

    rbb82c03 r2162c2c  
    179179        typedef NamedTypeDecl Parent;
    180180  public:
    181         enum Kind { Any, Dtype, Ftype };
     181        enum Kind { Any, Dtype, Ftype, Ttype };
    182182        /// Data extracted from a type decl
    183183        struct Data {
  • src/SynTree/Expression.cc

    rbb82c03 r2162c2c  
    672672
    673673std::ostream & operator<<( std::ostream & out, const Expression * expr ) {
    674         expr->print( out );
     674        if ( expr ) {
     675                expr->print( out );
     676        } else {
     677                out << "nullptr";
     678        }
    675679        return out;
    676680}
  • src/SynTree/Expression.h

    rbb82c03 r2162c2c  
    5454};
    5555
     56struct ParamEntry;
     57typedef std::map< UniqueId, ParamEntry > InferredParams;
     58
    5659/// ParamEntry contains the i.d. of a declaration and a type that is derived from that declaration,
    5760/// but subject to decay-to-pointer and type parameter renaming
    5861struct ParamEntry {
    59         ParamEntry(): decl( 0 ), actualType( 0 ), formalType( 0 ), expr( 0 ) {}
    60         ParamEntry( UniqueId decl, Type *actualType, Type *formalType, Expression* expr ): decl( decl ), actualType( actualType ), formalType( formalType ), expr( expr ) {}
     62        ParamEntry(): decl( 0 ), actualType( 0 ), formalType( 0 ), expr( 0 ), inferParams( new InferredParams ) {}
     63        ParamEntry( UniqueId decl, Type *actualType, Type *formalType, Expression* expr ): decl( decl ), actualType( actualType ), formalType( formalType ), expr( expr ), inferParams( new InferredParams ) {}
    6164        ParamEntry( const ParamEntry &other );
    6265        ~ParamEntry();
     
    6770        Type *formalType;
    6871        Expression* expr;
    69 };
    70 
    71 typedef std::map< UniqueId, ParamEntry > InferredParams;
     72        std::unique_ptr< InferredParams > inferParams;
     73};
    7274
    7375/// ApplicationExpr represents the application of a function to a set of parameters.  This is the result of running an
     
    634636};
    635637
     638/// UntypedTupleExpr represents a tuple expression ( [a, b, c] ) before resolution
     639class UntypedTupleExpr : public Expression {
     640  public:
     641        UntypedTupleExpr( const std::list< Expression * > & exprs, Expression *_aname = nullptr );
     642        UntypedTupleExpr( const UntypedTupleExpr &other );
     643        virtual ~UntypedTupleExpr();
     644
     645        std::list<Expression*>& get_exprs() { return exprs; }
     646
     647        virtual UntypedTupleExpr *clone() const { return new UntypedTupleExpr( *this ); }
     648        virtual void accept( Visitor &v ) { v.visit( this ); }
     649        virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
     650        virtual void print( std::ostream &os, int indent = 0 ) const;
     651  private:
     652        std::list<Expression*> exprs;
     653};
     654
    636655/// TupleExpr represents a tuple expression ( [a, b, c] )
    637656class TupleExpr : public Expression {
    638657  public:
    639         TupleExpr( const std::list< Expression * > & exprs = std::list< Expression * >(), Expression *_aname = nullptr );
     658        TupleExpr( const std::list< Expression * > & exprs, Expression *_aname = nullptr );
    640659        TupleExpr( const TupleExpr &other );
    641660        virtual ~TupleExpr();
    642661
    643         void set_exprs( std::list<Expression*> newValue ) { exprs = newValue; }
    644662        std::list<Expression*>& get_exprs() { return exprs; }
    645663
  • src/SynTree/FunctionType.cc

    rbb82c03 r2162c2c  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // FunctionType.cc -- 
     7// FunctionType.cc --
    88//
    99// Author           : Richard C. Bilson
     
    1919#include "Declaration.h"
    2020#include "Common/utility.h"
     21#include "Tuples/Tuples.h"
    2122
    2223FunctionType::FunctionType( const Type::Qualifiers &tq, bool isVarArgs ) : Type( tq ), isVarArgs( isVarArgs ) {
     
    3132        deleteAll( returnVals );
    3233        deleteAll( parameters );
     34}
     35
     36namespace {
     37        bool containsTtype( const std::list<DeclarationWithType * > & l ) {
     38                if ( ! l.empty() ) {
     39                        return Tuples::isTtype( l.back()->get_type() );
     40                }
     41                return false;
     42        }
     43}
     44
     45bool FunctionType::isTtype() const {
     46        return containsTtype( returnVals ) || containsTtype( parameters );
    3347}
    3448
  • src/SynTree/Mutator.cc

    rbb82c03 r2162c2c  
    2323#include "Constant.h"
    2424#include "Common/utility.h"
     25#include "TypeSubstitution.h"
    2526
    2627Mutator::Mutator() {}
     
    178179
    179180Expression *Mutator::mutate( ApplicationExpr *applicationExpr ) {
     181        applicationExpr->set_env( maybeMutate( applicationExpr->get_env(), *this ) );
    180182        applicationExpr->set_result( maybeMutate( applicationExpr->get_result(), *this ) );
    181183        applicationExpr->set_function( maybeMutate( applicationExpr->get_function(), *this ) );
     
    185187
    186188Expression *Mutator::mutate( UntypedExpr *untypedExpr ) {
     189        untypedExpr->set_env( maybeMutate( untypedExpr->get_env(), *this ) );
    187190        untypedExpr->set_result( maybeMutate( untypedExpr->get_result(), *this ) );
    188191        mutateAll( untypedExpr->get_args(), *this );
     
    191194
    192195Expression *Mutator::mutate( NameExpr *nameExpr ) {
     196        nameExpr->set_env( maybeMutate( nameExpr->get_env(), *this ) );
    193197        nameExpr->set_result( maybeMutate( nameExpr->get_result(), *this ) );
    194198        return nameExpr;
     
    196200
    197201Expression *Mutator::mutate( AddressExpr *addressExpr ) {
     202        addressExpr->set_env( maybeMutate( addressExpr->get_env(), *this ) );
    198203        addressExpr->set_result( maybeMutate( addressExpr->get_result(), *this ) );
    199204        addressExpr->set_arg( maybeMutate( addressExpr->get_arg(), *this ) );
     
    202207
    203208Expression *Mutator::mutate( LabelAddressExpr *labelAddressExpr ) {
     209        labelAddressExpr->set_env( maybeMutate( labelAddressExpr->get_env(), *this ) );
    204210        labelAddressExpr->set_result( maybeMutate( labelAddressExpr->get_result(), *this ) );
    205211        labelAddressExpr->set_arg( maybeMutate( labelAddressExpr->get_arg(), *this ) );
     
    208214
    209215Expression *Mutator::mutate( CastExpr *castExpr ) {
     216        castExpr->set_env( maybeMutate( castExpr->get_env(), *this ) );
    210217        castExpr->set_result( maybeMutate( castExpr->get_result(), *this ) );
    211218        castExpr->set_arg( maybeMutate( castExpr->get_arg(), *this ) );
     
    214221
    215222Expression *Mutator::mutate( UntypedMemberExpr *memberExpr ) {
     223        memberExpr->set_env( maybeMutate( memberExpr->get_env(), *this ) );
    216224        memberExpr->set_result( maybeMutate( memberExpr->get_result(), *this ) );
    217225        memberExpr->set_aggregate( maybeMutate( memberExpr->get_aggregate(), *this ) );
     
    221229
    222230Expression *Mutator::mutate( MemberExpr *memberExpr ) {
     231        memberExpr->set_env( maybeMutate( memberExpr->get_env(), *this ) );
    223232        memberExpr->set_result( maybeMutate( memberExpr->get_result(), *this ) );
    224233        memberExpr->set_aggregate( maybeMutate( memberExpr->get_aggregate(), *this ) );
     
    227236
    228237Expression *Mutator::mutate( VariableExpr *variableExpr ) {
     238        variableExpr->set_env( maybeMutate( variableExpr->get_env(), *this ) );
    229239        variableExpr->set_result( maybeMutate( variableExpr->get_result(), *this ) );
    230240        return variableExpr;
     
    232242
    233243Expression *Mutator::mutate( ConstantExpr *constantExpr ) {
     244        constantExpr->set_env( maybeMutate( constantExpr->get_env(), *this ) );
    234245        constantExpr->set_result( maybeMutate( constantExpr->get_result(), *this ) );
    235246//  maybeMutate( constantExpr->get_constant(), *this )
     
    238249
    239250Expression *Mutator::mutate( SizeofExpr *sizeofExpr ) {
     251        sizeofExpr->set_env( maybeMutate( sizeofExpr->get_env(), *this ) );
    240252        sizeofExpr->set_result( maybeMutate( sizeofExpr->get_result(), *this ) );
    241253        if ( sizeofExpr->get_isType() ) {
     
    248260
    249261Expression *Mutator::mutate( AlignofExpr *alignofExpr ) {
     262        alignofExpr->set_env( maybeMutate( alignofExpr->get_env(), *this ) );
    250263        alignofExpr->set_result( maybeMutate( alignofExpr->get_result(), *this ) );
    251264        if ( alignofExpr->get_isType() ) {
     
    258271
    259272Expression *Mutator::mutate( UntypedOffsetofExpr *offsetofExpr ) {
     273        offsetofExpr->set_env( maybeMutate( offsetofExpr->get_env(), *this ) );
    260274        offsetofExpr->set_result( maybeMutate( offsetofExpr->get_result(), *this ) );
    261275        offsetofExpr->set_type( maybeMutate( offsetofExpr->get_type(), *this ) );
     
    264278
    265279Expression *Mutator::mutate( OffsetofExpr *offsetofExpr ) {
     280        offsetofExpr->set_env( maybeMutate( offsetofExpr->get_env(), *this ) );
    266281        offsetofExpr->set_result( maybeMutate( offsetofExpr->get_result(), *this ) );
    267282        offsetofExpr->set_type( maybeMutate( offsetofExpr->get_type(), *this ) );
     
    271286
    272287Expression *Mutator::mutate( OffsetPackExpr *offsetPackExpr ) {
     288        offsetPackExpr->set_env( maybeMutate( offsetPackExpr->get_env(), *this ) );
    273289        offsetPackExpr->set_result( maybeMutate( offsetPackExpr->get_result(), *this ) );
    274290        offsetPackExpr->set_type( maybeMutate( offsetPackExpr->get_type(), *this ) );
     
    277293
    278294Expression *Mutator::mutate( AttrExpr *attrExpr ) {
     295        attrExpr->set_env( maybeMutate( attrExpr->get_env(), *this ) );
    279296        attrExpr->set_result( maybeMutate( attrExpr->get_result(), *this ) );
    280297        if ( attrExpr->get_isType() ) {
     
    287304
    288305Expression *Mutator::mutate( LogicalExpr *logicalExpr ) {
     306        logicalExpr->set_env( maybeMutate( logicalExpr->get_env(), *this ) );
    289307        logicalExpr->set_result( maybeMutate( logicalExpr->get_result(), *this ) );
    290308        logicalExpr->set_arg1( maybeMutate( logicalExpr->get_arg1(), *this ) );
     
    294312
    295313Expression *Mutator::mutate( ConditionalExpr *conditionalExpr ) {
     314        conditionalExpr->set_env( maybeMutate( conditionalExpr->get_env(), *this ) );
    296315        conditionalExpr->set_result( maybeMutate( conditionalExpr->get_result(), *this ) );
    297316        conditionalExpr->set_arg1( maybeMutate( conditionalExpr->get_arg1(), *this ) );
     
    302321
    303322Expression *Mutator::mutate( CommaExpr *commaExpr ) {
     323        commaExpr->set_env( maybeMutate( commaExpr->get_env(), *this ) );
    304324        commaExpr->set_result( maybeMutate( commaExpr->get_result(), *this ) );
    305325        commaExpr->set_arg1( maybeMutate( commaExpr->get_arg1(), *this ) );
     
    309329
    310330Expression *Mutator::mutate( TypeExpr *typeExpr ) {
     331        typeExpr->set_env( maybeMutate( typeExpr->get_env(), *this ) );
    311332        typeExpr->set_result( maybeMutate( typeExpr->get_result(), *this ) );
    312333        typeExpr->set_type( maybeMutate( typeExpr->get_type(), *this ) );
     
    315336
    316337Expression *Mutator::mutate( AsmExpr *asmExpr ) {
     338        asmExpr->set_env( maybeMutate( asmExpr->get_env(), *this ) );
    317339        asmExpr->set_inout( maybeMutate( asmExpr->get_inout(), *this ) );
    318340        asmExpr->set_constraint( maybeMutate( asmExpr->get_constraint(), *this ) );
     
    322344
    323345Expression* Mutator::mutate( ImplicitCopyCtorExpr *impCpCtorExpr ) {
     346        impCpCtorExpr->set_env( maybeMutate( impCpCtorExpr->get_env(), *this ) );
     347        impCpCtorExpr->set_result( maybeMutate( impCpCtorExpr->get_result(), *this ) );
    324348        impCpCtorExpr->set_callExpr( maybeMutate( impCpCtorExpr->get_callExpr(), *this ) );
    325349        mutateAll( impCpCtorExpr->get_tempDecls(), *this );
     
    330354
    331355Expression* Mutator::mutate( ConstructorExpr *ctorExpr ) {
     356        ctorExpr->set_env( maybeMutate( ctorExpr->get_env(), *this ) );
    332357        ctorExpr->set_result( maybeMutate( ctorExpr->get_result(), *this ) );
    333358        ctorExpr->set_callExpr( maybeMutate( ctorExpr->get_callExpr(), *this ) );
     
    336361
    337362Expression *Mutator::mutate( CompoundLiteralExpr *compLitExpr ) {
     363        compLitExpr->set_env( maybeMutate( compLitExpr->get_env(), *this ) );
    338364        compLitExpr->set_result( maybeMutate( compLitExpr->get_result(), *this ) );
    339365        compLitExpr->set_type( maybeMutate( compLitExpr->get_type(), *this ) );
     
    343369
    344370Expression *Mutator::mutate( UntypedValofExpr *valofExpr ) {
     371        valofExpr->set_env( maybeMutate( valofExpr->get_env(), *this ) );
    345372        valofExpr->set_result( maybeMutate( valofExpr->get_result(), *this ) );
    346373        return valofExpr;
     
    348375
    349376Expression *Mutator::mutate( RangeExpr *rangeExpr ) {
     377        rangeExpr->set_env( maybeMutate( rangeExpr->get_env(), *this ) );
    350378        rangeExpr->set_low( maybeMutate( rangeExpr->get_low(), *this ) );
    351379        rangeExpr->set_high( maybeMutate( rangeExpr->get_high(), *this ) );
     
    353381}
    354382
    355 Expression *Mutator::mutate( TupleExpr *tupleExpr ) {
     383Expression *Mutator::mutate( UntypedTupleExpr *tupleExpr ) {
     384        tupleExpr->set_env( maybeMutate( tupleExpr->get_env(), *this ) );
    356385        tupleExpr->set_result( maybeMutate( tupleExpr->get_result(), *this ) );
    357386        mutateAll( tupleExpr->get_exprs(), *this );
     
    359388}
    360389
     390Expression *Mutator::mutate( TupleExpr *tupleExpr ) {
     391        tupleExpr->set_env( maybeMutate( tupleExpr->get_env(), *this ) );
     392        tupleExpr->set_result( maybeMutate( tupleExpr->get_result(), *this ) );
     393        mutateAll( tupleExpr->get_exprs(), *this );
     394        return tupleExpr;
     395}
     396
    361397Expression *Mutator::mutate( TupleIndexExpr *tupleExpr ) {
     398        tupleExpr->set_env( maybeMutate( tupleExpr->get_env(), *this ) );
    362399        tupleExpr->set_result( maybeMutate( tupleExpr->get_result(), *this ) );
    363400        tupleExpr->set_tuple( maybeMutate( tupleExpr->get_tuple(), *this ) );
     
    366403
    367404Expression *Mutator::mutate( MemberTupleExpr *tupleExpr ) {
     405        tupleExpr->set_env( maybeMutate( tupleExpr->get_env(), *this ) );
    368406        tupleExpr->set_result( maybeMutate( tupleExpr->get_result(), *this ) );
    369407        tupleExpr->set_member( maybeMutate( tupleExpr->get_member(), *this ) );
     
    373411
    374412Expression *Mutator::mutate( TupleAssignExpr *assignExpr ) {
     413        assignExpr->set_env( maybeMutate( assignExpr->get_env(), *this ) );
    375414        assignExpr->set_result( maybeMutate( assignExpr->get_result(), *this ) );
    376415        assignExpr->set_stmtExpr( maybeMutate( assignExpr->get_stmtExpr(), *this ) );
     
    379418
    380419Expression *Mutator::mutate( StmtExpr *stmtExpr ) {
     420        stmtExpr->set_env( maybeMutate( stmtExpr->get_env(), *this ) );
    381421        stmtExpr->set_result( maybeMutate( stmtExpr->get_result(), *this ) );
    382422        stmtExpr->set_statements( maybeMutate( stmtExpr->get_statements(), *this ) );
     
    387427
    388428Expression *Mutator::mutate( UniqueExpr *uniqueExpr ) {
     429        uniqueExpr->set_env( maybeMutate( uniqueExpr->get_env(), *this ) );
    389430        uniqueExpr->set_result( maybeMutate( uniqueExpr->get_result(), *this ) );
    390431        uniqueExpr->set_expr( maybeMutate( uniqueExpr->get_expr(), *this ) );
  • src/SynTree/Mutator.h

    rbb82c03 r2162c2c  
    7878        virtual Expression* mutate( UntypedValofExpr *valofExpr );
    7979        virtual Expression* mutate( RangeExpr *rangeExpr );
     80        virtual Expression* mutate( UntypedTupleExpr *tupleExpr );
    8081        virtual Expression* mutate( TupleExpr *tupleExpr );
    8182        virtual Expression* mutate( TupleIndexExpr *tupleExpr );
  • src/SynTree/Statement.cc

    rbb82c03 r2162c2c  
    388388
    389389std::ostream & operator<<( std::ostream & out, const Statement * statement ) {
    390         statement->print( out );
     390        if ( statement ) {
     391                statement->print( out );
     392        } else {
     393                out << "nullptr";
     394        }
    391395        return out;
    392396}
  • src/SynTree/SynTree.h

    rbb82c03 r2162c2c  
    8383class UntypedValofExpr;
    8484class RangeExpr;
     85class UntypedTupleExpr;
    8586class TupleExpr;
    8687class TupleIndexExpr;
  • src/SynTree/TupleExpr.cc

    rbb82c03 r2162c2c  
    2121#include "VarExprReplacer.h"
    2222
     23UntypedTupleExpr::UntypedTupleExpr( const std::list< Expression * > & exprs, Expression *_aname ) : Expression( _aname ), exprs( exprs ) {
     24}
     25
     26UntypedTupleExpr::UntypedTupleExpr( const UntypedTupleExpr &other ) : Expression( other ) {
     27        cloneAll( other.exprs, exprs );
     28}
     29
     30UntypedTupleExpr::~UntypedTupleExpr() {
     31        deleteAll( exprs );
     32}
     33
     34void UntypedTupleExpr::print( std::ostream &os, int indent ) const {
     35        os << "Untyped Tuple:" << std::endl;
     36        printAll( exprs, os, indent+2 );
     37        Expression::print( os, indent );
     38}
     39
    2340TupleExpr::TupleExpr( const std::list< Expression * > & exprs, Expression *_aname ) : Expression( _aname ), exprs( exprs ) {
    24         if ( ! exprs.empty() ) {
    25                 if ( std::all_of( exprs.begin(), exprs.end(), [](Expression * expr) { return expr->get_result(); } ) ) {
    26                         set_result( Tuples::makeTupleType( exprs ) );
    27                 }
    28         }
     41        set_result( Tuples::makeTupleType( exprs ) );
    2942}
    3043
     
    4558TupleIndexExpr::TupleIndexExpr( Expression * tuple, unsigned int index ) : tuple( tuple ), index( index )  {
    4659        TupleType * type = safe_dynamic_cast< TupleType * >( tuple->get_result() );
    47         assert( type->size() > index );
     60        assertf( type->size() > index, "TupleIndexExpr index out of bounds: tuple size %d, requested index %d in expr %s", type->size(), index, toString( tuple ).c_str() );
    4861        set_result( (*std::next( type->get_types().begin(), index ))->clone() );
    4962        get_result()->set_isLvalue( type->get_isLvalue() );
  • src/SynTree/Type.cc

    rbb82c03 r2162c2c  
    8585
    8686std::ostream & operator<<( std::ostream & out, const Type * type ) {
    87         type->print( out );
     87        if ( type ) {
     88                type->print( out );
     89        } else {
     90                out << "nullptr";
     91        }
    8892        return out;
    8993}
  • src/SynTree/Type.h

    rbb82c03 r2162c2c  
    204204        std::list<DeclarationWithType*> & get_returnVals() { return returnVals; }
    205205        std::list<DeclarationWithType*> & get_parameters() { return parameters; }
    206         bool get_isVarArgs() { return isVarArgs; }
     206        bool get_isVarArgs() const { return isVarArgs; }
    207207        void set_isVarArgs( bool newValue ) { isVarArgs = newValue; }
     208
     209        bool isTtype() const;
    208210
    209211        virtual FunctionType *clone() const { return new FunctionType( *this ); }
  • src/SynTree/TypeDecl.cc

    rbb82c03 r2162c2c  
    1818#include "Common/utility.h"
    1919
    20 TypeDecl::TypeDecl( const std::string &name, DeclarationNode::StorageClass sc, Type *type, Kind kind ) : Parent( name, sc, type ), kind( kind ), sized( kind == Any ) {
     20TypeDecl::TypeDecl( const std::string &name, DeclarationNode::StorageClass sc, Type *type, Kind kind ) : Parent( name, sc, type ), kind( kind ), sized( kind == Any || kind == Ttype ) {
    2121}
    2222
     
    2525
    2626std::string TypeDecl::typeString() const {
    27         static const char *kindNames[] = { "type", "incomplete type", "function type" };
     27        static const char *kindNames[] = { "type", "incomplete type", "function type", "tuple type" };
    2828        return kindNames[ kind ];
    2929}
  • src/SynTree/TypeSubstitution.cc

    rbb82c03 r2162c2c  
    231231}
    232232
     233TypeSubstitution * TypeSubstitution::acceptMutator( Mutator & mutator ) {
     234        for ( auto & p : typeEnv ) {
     235                p.second = maybeMutate( p.second, mutator );
     236        }
     237        for ( auto & p : varEnv ) {
     238                p.second = maybeMutate( p.second, mutator );
     239        }
     240        return this;
     241}
     242
    233243void TypeSubstitution::print( std::ostream &os, int indent ) const {
    234244        os << std::string( indent, ' ' ) << "Types:" << std::endl;
  • src/SynTree/TypeSubstitution.h

    rbb82c03 r2162c2c  
    5353
    5454        void normalize();
     55
     56        TypeSubstitution * acceptMutator( Mutator & mutator );
    5557
    5658        void print( std::ostream &os, int indent = 0 ) const;
  • src/SynTree/Visitor.cc

    rbb82c03 r2162c2c  
    273273
    274274void Visitor::visit( ImplicitCopyCtorExpr *impCpCtorExpr ) {
     275        maybeAccept( impCpCtorExpr->get_result(), *this );
    275276        maybeAccept( impCpCtorExpr->get_callExpr(), *this );
    276277        acceptAll( impCpCtorExpr->get_tempDecls(), *this );
     
    298299        maybeAccept( rangeExpr->get_low(), *this );
    299300        maybeAccept( rangeExpr->get_high(), *this );
     301}
     302
     303void Visitor::visit( UntypedTupleExpr *tupleExpr ) {
     304        maybeAccept( tupleExpr->get_result(), *this );
     305        acceptAll( tupleExpr->get_exprs(), *this );
    300306}
    301307
  • src/SynTree/Visitor.h

    rbb82c03 r2162c2c  
    7878        virtual void visit( UntypedValofExpr *valofExpr );
    7979        virtual void visit( RangeExpr *rangeExpr );
     80        virtual void visit( UntypedTupleExpr *tupleExpr );
    8081        virtual void visit( TupleExpr *tupleExpr );
    8182        virtual void visit( TupleIndexExpr *tupleExpr );
Note: See TracChangeset for help on using the changeset viewer.