Changeset 36dfdac for src


Ignore:
Timestamp:
Dec 11, 2024, 7:53:36 PM (7 days ago)
Author:
Michael Brooks <mlbrooks@…>
Branches:
master
Children:
bad15f7
Parents:
5d3d281
Message:

Enable partial autogen for types declared inside functions.

Done by giving pass cores finer grained error-recovery points, which causes Resolver's existing error-recovery logic to kick in for autogens within function bodies.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Pass.impl.hpp

    r5d3d281 r36dfdac  
    218218        __pass::resultNstmt<container_t> new_kids;
    219219        for ( auto value : enumerate( statements ) ) {
     220                size_t i = value.idx;
     221                const Stmt * stmt = value.val;
    220222                try {
    221                         size_t i = value.idx;
    222                         const Stmt * stmt = value.val;
    223223                        __pedantic_pass_assert( stmt );
    224224                        const ast::Stmt * new_stmt = stmt->accept( *this );
     
    246246                        new_kids.take_all( stmts_after );
    247247                } catch ( SemanticErrorException &e ) {
     248                        if ( auto dstmt = dynamic_cast<const DeclStmt *>( stmt ) ) {
     249                                assert( dstmt->decl->unique() );
     250                                auto & declLink = const_cast< ptr<Decl> & >( dstmt->decl );
     251                  if ( !__pass::on_error (core, declLink, 0) ) goto handled;
     252                        }
    248253                        errors.append( e );
     254                  handled:;
    249255                }
    250256        }
Note: See TracChangeset for help on using the changeset viewer.