Changeset 748c751 for src


Ignore:
Timestamp:
Apr 18, 2024, 8:38:33 PM (4 months ago)
Author:
JiadaL <j82liang@…>
Branches:
master
Children:
38093ae
Parents:
cdb4eaa
Message:

Remove unnecessary implicit enum type conversion

Location:
src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/ConversionCost.cc

    rcdb4eaa r748c751  
    379379void ConversionCost::postvisit( const ast::EnumAttrType * src ) {
    380380    auto dstAsEnumAttrType = dynamic_cast<const ast::EnumAttrType *>(dst);
    381     if ( src->attr == ast::EnumAttribute::Label ) {
    382         if ( dstAsEnumAttrType && dstAsEnumAttrType->attr == ast::EnumAttribute::Label ) {
    383             cost = costCalc( src->instance, dstAsEnumAttrType->instance, srcIsLvalue, symtab, env );
    384         }
    385         // Add Conversion To String
    386     } else if ( src->attr == ast::EnumAttribute::Value ) {
     381        assert( src->attr != ast::EnumAttribute::Label );
     382    if ( src->attr == ast::EnumAttribute::Value ) {
    387383        if ( dstAsEnumAttrType && dstAsEnumAttrType->attr == ast::EnumAttribute::Value) {
    388384            cost = costCalc( src->instance, dstAsEnumAttrType->instance, srcIsLvalue, symtab, env );
  • src/Validate/ImplementEnumFunc.cpp

    rcdb4eaa r748c751  
    296296        {new ast::ObjectDecl(getLocation(), "_i", new ast::EnumInstType(decl))},
    297297        {new ast::ObjectDecl(getLocation(), "_ret",
    298                              new ast::EnumAttrType(new ast::EnumInstType(decl),
    299                                                    ast::EnumAttribute::Posn))});
     298            new ast::BasicType(ast::BasicType::UnsignedInt))});
    300299}
    301300
Note: See TracChangeset for help on using the changeset viewer.