Changeset 0992849


Ignore:
Timestamp:
Feb 1, 2018, 4:33:00 PM (4 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
624b722
Parents:
295e5071
Message:

Assign a result type to StmtExpr? based on returnDecl in FixInit?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Expression.cc

    r295e5071 r0992849  
    613613        delete result;
    614614        result = nullptr;
    615         if ( ! body.empty() ) {
     615        if ( ! returnDecls.empty() ) {
     616                // prioritize return decl for result type, since if a return decl exists, then
     617                // the StmtExpr is currently in an intermediate state where the body will always
     618                // give a void result type.
     619                result = returnDecls.front()->get_type()->clone();
     620        } else if ( ! body.empty() ) {
    616621                if ( ExprStmt * exprStmt = dynamic_cast< ExprStmt * >( body.back() ) ) {
    617622                        result = maybeClone( exprStmt->expr->result );
Note: See TracChangeset for help on using the changeset viewer.