Ignore:
Timestamp:
Apr 25, 2024, 3:48:17 PM (17 months ago)
Author:
JiadaL <j82liang@…>
Branches:
master
Children:
eb7586e
Parents:
cf191ac (diff), 55c97e4 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

resolve conflict

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/ConversionCost.cc

    rcf191ac r7042c60  
    3131#define PRINT(x)
    3232#endif
     33
     34namespace {
    3335
    3436        // GENERATED START, DO NOT EDIT
     
    152154        );
    153155
    154 namespace {
    155156        int localPtrsAssignable(const ast::Type * t1, const ast::Type * t2,
    156157                        const ast::SymbolTable &, const ast::TypeEnvironment & env ) {
     
    379380
    380381void ConversionCost::postvisit( const ast::EnumAttrType * src ) {
    381     auto dstAsEnumAttrType = dynamic_cast<const ast::EnumAttrType *>(dst);
     382        auto dstAsEnumAttrType = dynamic_cast<const ast::EnumAttrType *>(dst);
    382383        assert( src->attr != ast::EnumAttribute::Label );
    383     if ( src->attr == ast::EnumAttribute::Value ) {
    384         if ( dstAsEnumAttrType && dstAsEnumAttrType->attr == ast::EnumAttribute::Value) {
    385             cost = costCalc( src->instance, dstAsEnumAttrType->instance, srcIsLvalue, symtab, env );
    386         } else {
    387             auto baseType = src->instance->base->base;
    388             cost = costCalc( baseType, dst, srcIsLvalue, symtab, env );
     384        if ( src->attr == ast::EnumAttribute::Value ) {
     385                if ( dstAsEnumAttrType && dstAsEnumAttrType->attr == ast::EnumAttribute::Value) {
     386                        cost = costCalc( src->instance, dstAsEnumAttrType->instance, srcIsLvalue, symtab, env );
     387                } else {
     388                        auto baseType = src->instance->base->base;
     389                        cost = costCalc( baseType, dst, srcIsLvalue, symtab, env );
    389390                        if ( cost < Cost::infinity ) {
    390391                                cost.incUnsafe();
    391392                        }
    392         }
    393     } else { // ast::EnumAttribute::Posn
    394         if ( auto dstBase = dynamic_cast<const ast::EnumInstType *>( dst ) ) {
    395                     cost = costCalc( src->instance, dstBase, srcIsLvalue, symtab, env );
    396                     if ( cost < Cost::unsafe ) cost.incSafe();
    397             } else {
    398                     static ast::ptr<ast::BasicType> integer = { new ast::BasicType( ast::BasicKind::SignedInt ) };
    399                     cost = costCalc( integer, dst, srcIsLvalue, symtab, env );
    400                     if ( cost < Cost::unsafe ) {
    401                             cost.incSafe();
    402                     }
    403             }
    404     }
     393                }
     394        } else { // ast::EnumAttribute::Posn
     395                if ( auto dstBase = dynamic_cast<const ast::EnumInstType *>( dst ) ) {
     396                        cost = costCalc( src->instance, dstBase, srcIsLvalue, symtab, env );
     397                        if ( cost < Cost::unsafe ) cost.incSafe();
     398                } else {
     399                        static ast::ptr<ast::BasicType> integer = { new ast::BasicType( ast::BasicKind::SignedInt ) };
     400                        cost = costCalc( integer, dst, srcIsLvalue, symtab, env );
     401                        if ( cost < Cost::unsafe ) {
     402                                cost.incSafe();
     403                        }
     404                }
     405        }
    405406}
    406407
Note: See TracChangeset for help on using the changeset viewer.