Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/GenInit.cpp

    re6491ca red96731  
    162162                                // FROM USER:  float a[ rand() ];
    163163                                // TO GCC:     const size_t __len_of_a = rand(); float a[ __len_of_a ];
    164                                 ast::ObjectDecl * arrayDimension = nullptr;
    165 
    166                                 const ast::TypeExpr * ty = dynamic_cast< const ast::TypeExpr * >( arrayType->dimension.get() );
    167                                 if ( ty ) {
    168                                         auto inst = ty->type.as<ast::EnumInstType>();
    169                                         if ( inst ) {
    170                                                 if ( inst->base->isCfa ) {
    171                                                         arrayDimension = new ast::ObjectDecl(
    172                                                                 arrayType->dimension->location,
    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                                                 }
    182                                         }
    183                                 }
    184                                 if ( arrayDimension == nullptr ) {
    185                                         arrayDimension = new ast::ObjectDecl(
     164
     165                                ast::ObjectDecl * arrayDimension = new ast::ObjectDecl(
     166                                        arrayType->dimension->location,
     167                                        dimensionName.newName(),
     168                                        dimType,
     169                                        new ast::SingleInit(
    186170                                                arrayType->dimension->location,
    187                                                 dimensionName.newName(),
    188                                                 dimType,
    189                                                 new ast::SingleInit(
    190                                                         arrayType->dimension->location,
    191                                                         arrayType->dimension
    192                                                 )
    193                                         );
    194                                 }
     171                                                arrayType->dimension
     172                                        )
     173                                );
    195174
    196175                                ast::ArrayType * mutType = ast::mutate( arrayType );
Note: See TracChangeset for help on using the changeset viewer.