Changeset 17fa94f for src/ResolvExpr


Ignore:
Timestamp:
Feb 11, 2025, 11:24:07 AM (8 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
master
Children:
691bf0a
Parents:
3e5e32cf
Message:

Reworked some nodes so they can be typed or untyped. This allowed me to remove TranslationDeps as the type information is only needed in the candidate finder, which can easily insert it.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/CandidateFinder.cpp

    r3e5e32cf r17fa94f  
    14861486
    14871487        void Finder::postvisit( const ast::SizeofExpr * sizeofExpr ) {
     1488                const ast::Type * type = resolveTypeof( sizeofExpr->type, context );
     1489                const ast::Type * sizeType = context.global.sizeType.get();
    14881490                addCandidate(
    1489                         new ast::SizeofExpr{
    1490                                 sizeofExpr->location, resolveTypeof( sizeofExpr->type, context ) },
     1491                        new ast::SizeofExpr( sizeofExpr->location, type, sizeType ),
     1492                        tenv );
     1493        }
     1494
     1495        void Finder::postvisit( const ast::AlignofExpr * alignofExpr ) {
     1496                const ast::Type * type = resolveTypeof( alignofExpr->type, context );
     1497                const ast::Type * sizeType = context.global.sizeType.get();
     1498                addCandidate(
     1499                        new ast::AlignofExpr( alignofExpr->location, type, sizeType ),
    14911500                        tenv );
    14921501        }
     
    15161525        }
    15171526
    1518         void Finder::postvisit( const ast::AlignofExpr * alignofExpr ) {
    1519                 addCandidate(
    1520                         new ast::AlignofExpr{
    1521                                 alignofExpr->location, resolveTypeof( alignofExpr->type, context ) },
    1522                         tenv );
    1523         }
    1524 
    15251527        void Finder::postvisit( const ast::UntypedOffsetofExpr * offsetofExpr ) {
    15261528                const ast::BaseInstType * aggInst;
     
    15291531                else return;
    15301532
     1533                const ast::Type * sizeType = context.global.sizeType.get();
    15311534                for ( const ast::Decl * member : aggInst->lookup( offsetofExpr->member ) ) {
    15321535                        auto dwt = strict_dynamic_cast< const ast::DeclWithType * >( member );
    15331536                        addCandidate(
    1534                                 new ast::OffsetofExpr{ offsetofExpr->location, aggInst, dwt }, tenv );
     1537                                new ast::OffsetofExpr( offsetofExpr->location, aggInst, dwt, sizeType ), tenv );
    15351538                }
    15361539        }
Note: See TracChangeset for help on using the changeset viewer.