Changeset 5bb1ac1 for src/ResolvExpr


Ignore:
Timestamp:
Apr 10, 2022, 11:03:20 PM (2 years ago)
Author:
JiadaL <j82liang@…>
Branches:
ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
Children:
7ee5d6d
Parents:
d8e2a09
Message:

Allow generic types

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/Resolver.cc

    rd8e2a09 r5bb1ac1  
    14781478
    14791479                        if (dynamic_cast< const ast::EnumInstType * >( objectDecl->get_type() )->base->base) { // const ast::PointerType &
     1480                                // const ast::Type * enumBase =  (dynamic_cast< const ast::EnumInstType * >( objectDecl->get_type() )->base->base.get());
     1481                                // const ast::PointerType * enumBaseAsPtr = dynamic_cast<const ast::PointerType *>(enumBase);
     1482
     1483                                // if ( enumBaseAsPtr ) {
     1484                                //      const ast::Type * pointerBase = enumBaseAsPtr->base.get();
     1485                                //      if ( dynamic_cast<const ast::BasicType *>(pointerBase) ) {
     1486                                //              objectDecl = fixObjectType(objectDecl, context);
     1487                                //              if (dynamic_cast<const ast::BasicType *>(pointerBase)->kind == ast::BasicType::Char)
     1488                                //              currentObject = ast::CurrentObject{
     1489                                //                      objectDecl->location,  new ast::PointerType{
     1490                                //                              new ast::BasicType{ ast::BasicType::Char }
     1491                                //                      } };
     1492                                //      } else {
     1493                                //              objectDecl = fixObjectType(objectDecl, context);
     1494                                //              currentObject = ast::CurrentObject{objectDecl->location, new ast::BasicType{ ast::BasicType::SignedInt } };
     1495                                //      }
     1496                                // }
     1497                                objectDecl = fixObjectType( objectDecl, context );
    14801498                                const ast::Type * enumBase =  (dynamic_cast< const ast::EnumInstType * >( objectDecl->get_type() )->base->base.get());
    1481                                 const ast::PointerType * enumBaseAsPtr = dynamic_cast<const ast::PointerType *>(enumBase);
    1482 
    1483                                 if ( enumBaseAsPtr ) {
    1484                                         const ast::Type * pointerBase = enumBaseAsPtr->base.get();
    1485                                         if ( dynamic_cast<const ast::BasicType *>(pointerBase) ) {
    1486                                                 objectDecl = fixObjectType(objectDecl, context);
    1487                                                 if (dynamic_cast<const ast::BasicType *>(pointerBase)->kind == ast::BasicType::Char)
    1488                                                 currentObject = ast::CurrentObject{
    1489                                                         objectDecl->location,  new ast::PointerType{
    1490                                                                 new ast::BasicType{ ast::BasicType::Char }
    1491                                                         } };
    1492                                         } else {
    1493                                                 objectDecl = fixObjectType(objectDecl, context);
    1494                                                 currentObject = ast::CurrentObject{objectDecl->location, new ast::BasicType{ ast::BasicType::SignedInt } };
    1495                                         }
    1496                                 }
     1499                                currentObject = ast::CurrentObject{
     1500                                        objectDecl->location,
     1501                                        enumBase
     1502                                };
    14971503                        } else {
    1498                                 objectDecl = fixObjectType(objectDecl, context);
     1504                                objectDecl = fixObjectType( objectDecl, context );
    14991505                                currentObject = ast::CurrentObject{
    15001506                                        objectDecl->location, new ast::BasicType{ ast::BasicType::SignedInt } };
Note: See TracChangeset for help on using the changeset viewer.