Ignore:
Timestamp:
Jun 29, 2017, 5:06:24 PM (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:
a12d5aa
Parents:
bb1cd95
Message:

Big push on designations and initialization: works with generic types, tuples, arrays, tests pass.
Refactor guard_value_impl.
Add list of declarations to TupleType?.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/Unify.cc

    rbb1cd95 r62423350  
    606606                        } else if ( tupleParam ) {
    607607                                // bundle other parameters into tuple to match
    608                                 TupleType* binder = new TupleType{ paramTy->get_qualifiers() };
     608                                std::list< Type * > binderTypes;
    609609
    610610                                do {
    611                                         binder->get_types().push_back( otherParam->get_type()->clone() );
     611                                        binderTypes.push_back( otherParam->get_type()->clone() );
    612612                                        ++jt;
    613613
     
    618618                                } while (true);
    619619
    620                                 otherParamTy = binder;
     620                                otherParamTy = new TupleType{ paramTy->get_qualifiers(), binderTypes };
    621621                                ++it;  // skip ttype parameter for break
    622622                        } else if ( otherTupleParam ) {
    623623                                // bundle parameters into tuple to match other
    624                                 TupleType* binder = new TupleType{ otherParamTy->get_qualifiers() };
     624                                std::list< Type * > binderTypes;
    625625
    626626                                do {
    627                                         binder->get_types().push_back( param->get_type()->clone() );
     627                                        binderTypes.push_back( param->get_type()->clone() );
    628628                                        ++it;
    629629
     
    634634                                } while (true);
    635635
    636                                 paramTy = binder;
     636                                paramTy = new TupleType{ otherParamTy->get_qualifiers(), binderTypes };
    637637                                ++jt;  // skip ttype parameter for break
    638638                        }
     
    756756                        return function->get_returnVals().front()->get_type()->clone();
    757757                } else {
    758                         TupleType * tupleType = new TupleType( Type::Qualifiers() );
     758                        std::list< Type * > types;
    759759                        for ( DeclarationWithType * decl : function->get_returnVals() ) {
    760                                 tupleType->get_types().push_back( decl->get_type()->clone() );
     760                                types.push_back( decl->get_type()->clone() );
    761761                        } // for
    762                         return tupleType;
     762                        return new TupleType( Type::Qualifiers(), types );
    763763                }
    764764        }
Note: See TracChangeset for help on using the changeset viewer.