Ignore:
Timestamp:
Mar 10, 2022, 2:03:43 AM (2 years ago)
Author:
JiadaL <j82liang@…>
Branches:
ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
Children:
f238fcc2
Parents:
786c438
Message:

The compiler now will add a cast to base type for the usage of type enum; but it will fail because of violating some restrictions for the auto-gen functions. Need to investiage more

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/CodeGenerator.cc

    r786c438 r3e54399  
    348348                                des->accept( *visitor );
    349349                        } else {
    350                                 // otherwise, it has to be a ConstantExpr or CastExpr, initializing array eleemnt
     350                                // otherwise, it has to be a ConstantExpr or CastExpr, initializing array element
    351351                                output << "[";
    352352                                des->accept( *visitor );
     
    662662                        output << opInfo->symbol;
    663663                } else {
     664                        if (dynamic_cast<EnumInstType *>(variableExpr->get_var()->get_type())
     665                        && dynamic_cast<EnumInstType *>(variableExpr->get_var()->get_type())->baseEnum->base) {
     666                                output << '(' <<genType(dynamic_cast<EnumInstType *>(variableExpr->get_var()->get_type())->baseEnum->base, "", options) << ')';
     667                        }
    664668                        output << mangleName( variableExpr->get_var() );
    665669                } // if
Note: See TracChangeset for help on using the changeset viewer.