Changeset bf32bb8 for src/SynTree


Ignore:
Timestamp:
Oct 18, 2016, 4:23:04 PM (9 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:
f0121d7
Parents:
848ce71
Message:

implement transformation for MemberTupleExprs?

Location:
src/SynTree
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified src/SynTree/Expression.cc

    r848ce71 rbf32bb8  
    580580
    581581
    582 UniqueExpr::UniqueExpr( Expression *expr ) : expr( new Expression* ) {
     582long long UniqueExpr::count = 0;
     583UniqueExpr::UniqueExpr( Expression *expr, long long idVal ) : expr( new Expression* ), id( idVal ) {
     584        assert( count != -1 );
     585        if ( id == -1 ) id = count++;
    583586        set_expr( expr );
    584587        assert( expr );
    585         assert( expr->has_result() );
    586         set_result( expr->get_result()->clone() );
    587 }
    588 UniqueExpr::UniqueExpr( const UniqueExpr &other ) : Expression( other ), expr( other.expr ) {
     588        if ( expr->get_result() ) {
     589                set_result( expr->get_result()->clone() );
     590        }
     591}
     592UniqueExpr::UniqueExpr( const UniqueExpr &other ) : Expression( other ), expr( other.expr ), id( other.id ) {
    589593}
    590594UniqueExpr::~UniqueExpr() {
     
    594598}
    595599void UniqueExpr::print( std::ostream &os, int indent ) const {
    596         os << "Unique Expression: " << std::endl << std::string( indent+2, ' ' );
     600        os << "Unique Expression with id:" << id << std::endl << std::string( indent+2, ' ' );
    597601        get_expr()->print( os, indent+2 );
    598602}
  • TabularUnified src/SynTree/Expression.h

    r848ce71 rbf32bb8  
    735735class UniqueExpr : public Expression {
    736736public:
    737         UniqueExpr( Expression * expr );
     737        UniqueExpr( Expression * expr, long long idVal = -1 );
    738738        UniqueExpr( const UniqueExpr & other );
    739739        ~UniqueExpr();
     
    742742        UniqueExpr * set_expr( Expression * newValue ) { *expr = newValue; return this; }
    743743
     744        int get_id() const { return id; }
     745
    744746        virtual UniqueExpr *clone() const { return new UniqueExpr( *this ); }
    745747        virtual void accept( Visitor &v ) { v.visit( this ); }
     
    748750private:
    749751        std::shared_ptr< Expression * > expr;
     752        int id;
     753        static long long count;
    750754};
    751755
Note: See TracChangeset for help on using the changeset viewer.