Changeset b0d9ff7 for src/ResolvExpr


Ignore:
Timestamp:
Sep 1, 2022, 1:27:52 PM (2 years ago)
Author:
JiadaL <j82liang@…>
Branches:
ADT, ast-experimental, master, pthread-emulation, qualifiedEnum
Children:
12df6fe
Parents:
def751f
Message:

Fix up the QualifiedNameExpr?. It should now work on both old AST and new AST. There are some known bugs to fix so make all-tests will fail.

Location:
src/ResolvExpr
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/CandidateFinder.cpp

    rdef751f rb0d9ff7  
    862862                                }
    863863                        }
     864                }
     865
     866                void postvisit( const ast::QualifiedNameExpr * qualifiedNameExpr ) {
     867                        auto mangleName = Mangle::mangle(qualifiedNameExpr->var);
     868                        addCandidate( qualifiedNameExpr, tenv );
    864869                }
    865870
  • src/ResolvExpr/ConversionCost.cc

    rdef751f rb0d9ff7  
    338338                } else if ( const EnumInstType * enumInst = dynamic_cast< const EnumInstType * >( dest ) ) {
    339339                        const EnumDecl * base_enum = enumInst->baseEnum;
    340                         if ( const Type * base = base_enum->base ) { // if the base enum has a base (if it is typed)
     340                        if ( const Type * base = base_enum->base ) {
    341341                                if ( const BasicType * enumBaseAstBasic = dynamic_cast< const BasicType *> (base) ) {
    342342                                        conversionCostFromBasicToBasic(basicType, enumBaseAstBasic);
     
    632632        } else if ( const ast::EnumInstType * enumInst = dynamic_cast< const ast::EnumInstType * >( dst ) ) {
    633633                const ast::EnumDecl * enumDecl = enumInst->base.get();
    634                 if ( const ast::Type * enumType = enumDecl->base.get() ) {
     634                if ( enumDecl->isTyped && !enumDecl->base.get() ) {
     635                        cost = Cost::infinity;
     636                } else if ( const ast::Type * enumType = enumDecl->base.get() ) {
    635637                        if ( const ast::BasicType * enumTypeAsBasic = dynamic_cast<const ast::BasicType *>(enumType) ) {
    636638                                conversionCostFromBasicToBasic( basicType, enumTypeAsBasic );
     
    694696        const ast::EnumDecl * baseEnum = enumInstType->base;
    695697        if ( const ast::Type * baseType = baseEnum->base ) {
    696                 cost = costCalc( baseType, dst, srcIsLvalue, symtab, env );
    697                 // cost = Cost::safe;
     698                costCalc( baseType, dst, srcIsLvalue, symtab, env );
    698699        } else {
    699700                (void)enumInstType;
Note: See TracChangeset for help on using the changeset viewer.