Changeset 0139351


Ignore:
Timestamp:
Mar 21, 2024, 11:25:00 AM (9 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
master
Children:
7d9a805b
Parents:
5b25c49
Message:

Add support for printing multiple returns. Mostly useful for early code dumps.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/CodeGenerator.cpp

    r5b25c49 r0139351  
    192192        }
    193193
    194         assert( decl->returns.size() < 2 );
    195194        if ( 1 == decl->returns.size() ) {
    196195                ast::ptr<ast::Type> const & type = decl->returns[0]->get_type();
    197196                output << genTypeNoAttr( type, acc.str(), subOptions );
    198         } else {
     197        } else if ( 0 == decl->returns.size() ) {
    199198                output << "void " + acc.str();
     199        } else {
     200                assertf( !options.genC, "Multi-return should not reach code generation." );
     201                ast::ptr<ast::Type> type = new ast::TupleType( copy( decl->type->returns ) );
     202                output << genTypeNoAttr( type, acc.str(), subOptions );
    200203        }
    201204
Note: See TracChangeset for help on using the changeset viewer.