Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/Resolver.cpp

    r10c1770 r64f3b9f  
    703703        } else {
    704704                if ( !objectDecl->isTypeFixed ) {
    705                         objectDecl = fixObjectType(objectDecl, context);
     705                        auto newDecl = fixObjectType(objectDecl, context);
     706                        auto mutDecl = mutate(newDecl);
    706707
    707708                        // generate CtorInit wrapper when necessary.
     
    709710                        // this object in visitor pass, thus disabling CtorInit codegen.
    710711                        // this happens on aggregate members and function parameters.
    711                         if ( shouldGenCtorInit( objectDecl ) ) {
     712                        if ( shouldGenCtorInit( mutDecl ) ) {
    712713                                // constructed objects cannot be designated
    713                                 if ( InitTweak::isDesignated( objectDecl->init )
    714                                                 && !ast::Pass<ResolveDesignators>::read(
    715                                                         objectDecl->init.get(), context ) ) {
    716                                         SemanticError( objectDecl, "Cannot include designations in the initializer for a managed Object.\n"
    717                                                         "If this is really what you want, initialize with @=." );
     714                                if ( InitTweak::isDesignated( mutDecl->init ) ) {
     715                                        ast::Pass<ResolveDesignators> res( context );
     716                                        maybe_accept( mutDecl->init.get(), res );
     717                                        if ( !res.core.result ) {
     718                                                SemanticError( mutDecl, "Cannot include designations in the initializer for a managed Object.\n"
     719                                                                           "If this is really what you want, initialize with @=." );
     720                                        }
    718721                                }
    719722                                // constructed objects should not have initializers nested too deeply
    720                                 if ( !InitTweak::checkInitDepth( objectDecl ) ) SemanticError( objectDecl, "Managed object's initializer is too deep " );
    721 
    722                                 objectDecl = ast::mutate_field( objectDecl, &ast::ObjectDecl::init,
    723                                         InitTweak::genCtorInit( objectDecl->location, objectDecl ) );
     723                                if ( ! InitTweak::checkInitDepth( mutDecl ) ) SemanticError( mutDecl, "Managed object's initializer is too deep " );
     724
     725                                mutDecl->init = InitTweak::genCtorInit( mutDecl->location, mutDecl );
    724726                        }
     727
     728                        objectDecl = mutDecl;
    725729                }
    726730                currentObject = ast::CurrentObject{ objectDecl->location, objectDecl->get_type() };
Note: See TracChangeset for help on using the changeset viewer.