Ignore:
Timestamp:
Jun 2, 2022, 4:12:53 AM (2 years ago)
Author:
JiadaL <j82liang@…>
Branches:
ADT, ast-experimental, master, pthread-emulation, qualifiedEnum
Children:
1df492a, 90a8125, e5d9274
Parents:
01f6a06
Message:

Implement the struct enum

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/CandidateFinder.cpp

    r01f6a06 rfc134a48  
    899899
    900900                                                if (argType.as<ast::PointerType>()) funcFinder.otypeKeys.insert(Mangle::Encoding::pointer);
     901                                                else if (const ast::EnumInstType * enumInst = argType.as<ast::EnumInstType>()) {
     902                                                        const ast::EnumDecl * enumDecl = enumInst->base;
     903                                                        if ( const ast::Type* enumType = enumDecl->base ) {
     904                                                                // instance of enum (T) is a instance of type (T)
     905                                                                funcFinder.otypeKeys.insert(Mangle::mangle(enumType, Mangle::NoGenericParams | Mangle::Type));
     906                                                        } else {
     907                                                                // instance of an untyped enum is techically int
     908                                                                funcFinder.otypeKeys.insert(Mangle::mangle(enumDecl, Mangle::NoGenericParams | Mangle::Type));
     909                                                        }
     910                                                }
    901911                                                else funcFinder.otypeKeys.insert(Mangle::mangle(argType, Mangle::NoGenericParams | Mangle::Type));
    902912                                        }
     
    918928
    919929                        // find function operators
    920                         ast::ptr< ast::Expr > opExpr = new ast::NameExpr{ untypedExpr->location, "?()" };
     930                        ast::ptr< ast::Expr > opExpr = new ast::NameExpr{ untypedExpr->location, "?()" }; // ??? why not ?{}
    921931                        CandidateFinder opFinder( context, tenv );
    922932                        // okay if there aren't any function operations
Note: See TracChangeset for help on using the changeset viewer.