Changeset 62423350 for src/Tuples


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/Tuples/TupleExpansion.cc

    rbb1cd95 r62423350  
    310310        Type * makeTupleType( const std::list< Expression * > & exprs ) {
    311311                // produce the TupleType which aggregates the types of the exprs
    312                 TupleType *tupleType = new TupleType( Type::Qualifiers( Type::Const | Type::Volatile | Type::Restrict | Type::Lvalue | Type::Atomic | Type::Mutex ) );
    313                 Type::Qualifiers &qualifiers = tupleType->get_qualifiers();
     312                std::list< Type * > types;
     313                Type::Qualifiers qualifiers( Type::Const | Type::Volatile | Type::Restrict | Type::Lvalue | Type::Atomic | Type::Mutex );
    314314                for ( Expression * expr : exprs ) {
    315315                        assert( expr->get_result() );
    316316                        if ( expr->get_result()->isVoid() ) {
    317317                                // if the type of any expr is void, the type of the entire tuple is void
    318                                 delete tupleType;
    319318                                return new VoidType( Type::Qualifiers() );
    320319                        }
    321320                        Type * type = expr->get_result()->clone();
    322                         tupleType->get_types().push_back( type );
     321                        types.push_back( type );
    323322                        // the qualifiers on the tuple type are the qualifiers that exist on all component types
    324323                        qualifiers &= type->get_qualifiers();
    325324                } // for
    326325                if ( exprs.empty() ) qualifiers = Type::Qualifiers();
    327                 return tupleType;
     326                return new TupleType( qualifiers, types );
    328327        }
    329328
Note: See TracChangeset for help on using the changeset viewer.