Ignore:
Timestamp:
Oct 19, 2017, 12:01:04 PM (8 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
837ce06
Parents:
b96ec83 (diff), a15b72c (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' into cleanup-dtors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Tuples/TupleAssignment.cc

    rb96ec83 r6840e7c  
    4141#include "SynTree/Visitor.h"               // for Visitor
    4242
     43#if 0
     44#define PRINT(x) x
     45#else
     46#define PRINT(x)
     47#endif
     48
    4349namespace Tuples {
    4450        class TupleAssignSpotter {
     
    8490        bool isTuple( Expression *expr ) {
    8591                if ( ! expr ) return false;
    86                 assert( expr->has_result() );
     92                assert( expr->result );
    8793                return dynamic_cast< TupleType * >( expr->get_result()->stripReferences() );
    8894        }
     
    119125                if (  NameExpr *op = dynamic_cast< NameExpr * >(expr->get_function()) ) {
    120126                        if ( CodeGen::isCtorDtorAssign( op->get_name() ) ) {
    121                                 fname = op->get_name();
     127                               fname = op->get_name();
     128                                PRINT( std::cerr << "TupleAssignment: " << fname << std::endl; )
    122129                                for ( std::list<ResolvExpr::AltList>::const_iterator ali = possibilities.begin(); ali != possibilities.end(); ++ali ) {
    123130                                        if ( ali->size() == 0 ) continue; // AlternativeFinder will natrually handle this case, if it's legal
     
    131138                                        const ResolvExpr::Alternative & alt1 = ali->front();
    132139                                        auto begin = std::next(ali->begin(), 1), end = ali->end();
     140                                        PRINT( std::cerr << "alt1 is " << alt1.expr << std::endl; )
    133141                                        if ( refToTuple(alt1.expr) ) {
     142                                                PRINT( std::cerr << "and is reference to tuple" << std::endl; )
    134143                                                if ( isMultAssign( begin, end ) ) {
     144                                                        PRINT( std::cerr << "possible multiple assignment" << std::endl; )
    135145                                                        matcher.reset( new MultipleAssignMatcher( *this, *ali ) );
    136146                                                } else {
    137147                                                        // mass assignment
     148                                                        PRINT( std::cerr << "possible mass assignment" << std::endl; )
    138149                                                        matcher.reset( new MassAssignMatcher( *this,  *ali ) );
    139150                                                }
     
    159170                // now resolve new assignments
    160171                for ( std::list< Expression * >::iterator i = new_assigns.begin(); i != new_assigns.end(); ++i ) {
     172                        PRINT(
     173                                std::cerr << "== resolving tuple assign ==" << std::endl;
     174                                std::cerr << *i << std::endl;
     175                        )
     176
    161177                        ResolvExpr::AlternativeFinder finder( currentFinder.get_indexer(), currentFinder.get_environ() );
    162178                        try {
     
    238254
    239255        ObjectDecl * TupleAssignSpotter::Matcher::newObject( UniqueName & namer, Expression * expr ) {
    240                 assert( expr->has_result() && ! expr->get_result()->isVoid() );
     256                assert( expr->result && ! expr->get_result()->isVoid() );
    241257                ObjectDecl * ret = new ObjectDecl( namer.newName(), Type::StorageClasses(), LinkageSpec::Cforall, nullptr, expr->get_result()->clone(), new SingleInit( expr->clone() ) );
    242258                // if expression type is a reference, don't need to construct anything, a simple initializer is sufficient.
     
    248264                        ctorInit->accept( rm );
    249265                }
     266                PRINT( std::cerr << "new object: " << ret << std::endl; )
    250267                return ret;
    251268        }
Note: See TracChangeset for help on using the changeset viewer.