Changeset 82f3226 for src


Ignore:
Timestamp:
Dec 1, 2017, 10:37:40 AM (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:
ad6cd6d
Parents:
2449aef
Message:

Remove trailing whitespace in TupleAssignment?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Tuples/TupleAssignment.cc

    r2449aef r82f3226  
    6262                struct Matcher {
    6363                  public:
    64                         Matcher( TupleAssignSpotter &spotter, const ResolvExpr::AltList& lhs, const 
     64                        Matcher( TupleAssignSpotter &spotter, const ResolvExpr::AltList& lhs, const
    6565                                ResolvExpr::AltList& rhs );
    6666                        virtual ~Matcher() {}
     
    7676                struct MassAssignMatcher : public Matcher {
    7777                  public:
    78                         MassAssignMatcher( TupleAssignSpotter &spotter, const ResolvExpr::AltList& lhs, 
     78                        MassAssignMatcher( TupleAssignSpotter &spotter, const ResolvExpr::AltList& lhs,
    7979                                const ResolvExpr::AltList& rhs ) : Matcher(spotter, lhs, rhs) {}
    8080                        virtual void match( std::list< Expression * > &out );
     
    8383                struct MultipleAssignMatcher : public Matcher {
    8484                  public:
    85                         MultipleAssignMatcher( TupleAssignSpotter &spotter, const ResolvExpr::AltList& lhs, 
     85                        MultipleAssignMatcher( TupleAssignSpotter &spotter, const ResolvExpr::AltList& lhs,
    8686                                const ResolvExpr::AltList& rhs ) : Matcher(spotter, lhs, rhs) {}
    8787                        virtual void match( std::list< Expression * > &out );
     
    120120        }
    121121
    122         void handleTupleAssignment( ResolvExpr::AlternativeFinder & currentFinder, UntypedExpr * expr, 
     122        void handleTupleAssignment( ResolvExpr::AlternativeFinder & currentFinder, UntypedExpr * expr,
    123123                                std::vector<ResolvExpr::AlternativeFinder> &args ) {
    124124                TupleAssignSpotter spotter( currentFinder );
     
    129129                : currentFinder(f) {}
    130130
    131         void TupleAssignSpotter::spot( UntypedExpr * expr, 
     131        void TupleAssignSpotter::spot( UntypedExpr * expr,
    132132                        std::vector<ResolvExpr::AlternativeFinder> &args ) {
    133133                if (  NameExpr *op = dynamic_cast< NameExpr * >(expr->get_function()) ) {
     
    138138                                if ( args.size() == 0 ) return;
    139139
    140                                 // if an assignment only takes 1 argument, that's odd, but maybe someone wrote 
     140                                // if an assignment only takes 1 argument, that's odd, but maybe someone wrote
    141141                                // the function, in which case AlternativeFinder will handle it normally
    142142                                if ( args.size() == 1 && CodeGen::isAssignment( fname ) ) return;
     
    147147                                        if ( ! refToTuple(lhsAlt.expr) ) continue;
    148148
    149                                         // explode is aware of casts - ensure every LHS expression is sent into explode 
     149                                        // explode is aware of casts - ensure every LHS expression is sent into explode
    150150                                        // with a reference cast
    151                                         // xxx - this seems to change the alternatives before the normal 
     151                                        // xxx - this seems to change the alternatives before the normal
    152152                                        //  AlternativeFinder flow; maybe this is desired?
    153153                                        if ( ! dynamic_cast<CastExpr*>( lhsAlt.expr ) ) {
    154                                                 lhsAlt.expr = new CastExpr( lhsAlt.expr, 
    155                                                                 new ReferenceType( Type::Qualifiers(), 
     154                                                lhsAlt.expr = new CastExpr( lhsAlt.expr,
     155                                                                new ReferenceType( Type::Qualifiers(),
    156156                                                                        lhsAlt.expr->get_result()->clone() ) );
    157157                                        }
     
    161161                                        explode( lhsAlt, currentFinder.get_indexer(), back_inserter(lhs), true );
    162162                                        for ( ResolvExpr::Alternative& alt : lhs ) {
    163                                                 // each LHS value must be a reference - some come in with a cast expression, 
     163                                                // each LHS value must be a reference - some come in with a cast expression,
    164164                                                // if not just cast to reference here
    165165                                                if ( ! dynamic_cast<ReferenceType*>( alt.expr->get_result() ) ) {
    166                                                         alt.expr = new CastExpr( alt.expr, 
    167                                                                 new ReferenceType( Type::Qualifiers(), 
     166                                                        alt.expr = new CastExpr( alt.expr,
     167                                                                new ReferenceType( Type::Qualifiers(),
    168168                                                                        alt.expr->get_result()->clone() ) );
    169169                                                }
     
    179179                                                // TODO build iterative version of this instead of using combos
    180180                                                std::vector< ResolvExpr::AltList > rhsAlts;
    181                                                 combos( std::next(args.begin(), 1), args.end(), 
     181                                                combos( std::next(args.begin(), 1), args.end(),
    182182                                                        std::back_inserter( rhsAlts ) );
    183183                                                for ( const ResolvExpr::AltList& rhsAlt : rhsAlts ) {
    184184                                                        // multiple assignment
    185185                                                        ResolvExpr::AltList rhs;
    186                                                         explode( rhsAlt, currentFinder.get_indexer(), 
     186                                                        explode( rhsAlt, currentFinder.get_indexer(),
    187187                                                                std::back_inserter(rhs), true );
    188188                                                        matcher.reset( new MultipleAssignMatcher( *this, lhs, rhs ) );
     
    194194                                                        if ( isTuple(rhsAlt.expr) ) {
    195195                                                                // multiple assignment
    196                                                                 explode( rhsAlt, currentFinder.get_indexer(), 
     196                                                                explode( rhsAlt, currentFinder.get_indexer(),
    197197                                                                        std::back_inserter(rhs), true );
    198198                                                                matcher.reset( new MultipleAssignMatcher( *this, lhs, rhs ) );
     
    223223                ResolvExpr::AltList current;
    224224                // now resolve new assignments
    225                 for ( std::list< Expression * >::iterator i = new_assigns.begin(); 
     225                for ( std::list< Expression * >::iterator i = new_assigns.begin();
    226226                                i != new_assigns.end(); ++i ) {
    227227                        PRINT(
     
    230230                        )
    231231
    232                         ResolvExpr::AlternativeFinder finder{ currentFinder.get_indexer(), 
     232                        ResolvExpr::AlternativeFinder finder{ currentFinder.get_indexer(),
    233233                                currentFinder.get_environ() };
    234234                        try {
     
    254254                // xxx -- was push_front
    255255                currentFinder.get_alternatives().push_back( ResolvExpr::Alternative(
    256                         new TupleAssignExpr(solved_assigns, matcher->tmpDecls), matcher->compositeEnv, 
     256                        new TupleAssignExpr(solved_assigns, matcher->tmpDecls), matcher->compositeEnv,
    257257                        ResolvExpr::sumCost( current ) + matcher->baseCost ) );
    258258        }
    259259
    260         TupleAssignSpotter::Matcher::Matcher( TupleAssignSpotter &spotter, 
    261                 const ResolvExpr::AltList &lhs, const ResolvExpr::AltList &rhs ) 
    262         : lhs(lhs), rhs(rhs), spotter(spotter), 
     260        TupleAssignSpotter::Matcher::Matcher( TupleAssignSpotter &spotter,
     261                const ResolvExpr::AltList &lhs, const ResolvExpr::AltList &rhs )
     262        : lhs(lhs), rhs(rhs), spotter(spotter),
    263263          baseCost( ResolvExpr::sumCost( lhs ) + ResolvExpr::sumCost( rhs ) ) {
    264264                simpleCombineEnvironments( lhs.begin(), lhs.end(), compositeEnv );
Note: See TracChangeset for help on using the changeset viewer.