Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/GenInit.cpp

    r90e683b re6491ca  
    164164                                ast::ObjectDecl * arrayDimension = nullptr;
    165165
    166                                 if ( auto ty = dynamic_cast< const ast::TypeExpr * >( arrayType->dimension.get() ) ) {
     166                                const ast::TypeExpr * ty = dynamic_cast< const ast::TypeExpr * >( arrayType->dimension.get() );
     167                                if ( ty ) {
    167168                                        auto inst = ty->type.as<ast::EnumInstType>();
    168                                         if ( inst && !inst->base->is_c_enum() ) {
    169                                                 arrayDimension = new ast::ObjectDecl(
    170                                                         arrayType->dimension->location,
    171                                                         dimensionName.newName(),
    172                                                         new ast::BasicType( ast::BasicKind::UnsignedChar ),
    173                                                         new ast::SingleInit(
     169                                        if ( inst ) {
     170                                                if ( inst->base->isCfa ) {
     171                                                        arrayDimension = new ast::ObjectDecl(
    174172                                                                arrayType->dimension->location,
    175                                                                 ast::ConstantExpr::from_int( arrayType->dimension->location, inst->base->members.size() )
    176                                                         )
    177                                                 );
     173                                                                dimensionName.newName(),
     174                                                                new ast::BasicType( ast::BasicKind::UnsignedChar ),
     175                                                                new ast::SingleInit(
     176                                                                        arrayType->dimension->location,
     177                                                                        ast::ConstantExpr::from_int( arrayType->dimension->location, inst->base->members.size() )
     178                                                                )
     179                                                        );
     180                                                        // return arrayType;
     181                                                }
    178182                                        }
    179183                                }
Note: See TracChangeset for help on using the changeset viewer.