Changeset 857b5f9 for src/AST/Expr.hpp


Ignore:
Timestamp:
Jan 23, 2025, 12:09:40 PM (3 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
master
Children:
9e72bae3
Parents:
829821c
Message:

CountExpr? -> CountofExpr?. Actually the main fix was making countof use the same pattern as sizeof/alignof, using a typeof to combine the two cases and have one field instead of two.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified src/AST/Expr.hpp

    r829821c r857b5f9  
    490490};
    491491
    492 class CountExpr final : public Expr {
    493 public:
    494         ptr<Expr> expr;
    495         ptr<Type> type;
    496 
    497         CountExpr( const CodeLocation & loc, const Expr * t );
    498         CountExpr( const CodeLocation & loc, const Type * t );
    499 
    500         const Expr * accept( Visitor & v )const override { return v.visit( this ); }
    501 private:
    502         CountExpr * clone() const override { return new CountExpr( *this ); }
    503         MUTATE_FRIEND
    504 };
    505 
    506492/// alignof expression, e.g. `alignof(int)`, `alignof 3+4`
    507493class AlignofExpr final : public Expr {
     
    514500private:
    515501        AlignofExpr * clone() const override { return new AlignofExpr{ *this }; }
     502        MUTATE_FRIEND
     503};
     504
     505/// countof expression, e.g. `countof(AnEnum)`, `countof pred(Head)`
     506class CountofExpr final : public Expr {
     507public:
     508        ptr<Type> type;
     509
     510        CountofExpr( const CodeLocation & loc, const Type * t );
     511
     512        const Expr * accept( Visitor & v ) const override { return v.visit( this ); }
     513private:
     514        CountofExpr * clone() const override { return new CountofExpr( *this ); }
    516515        MUTATE_FRIEND
    517516};
Note: See TracChangeset for help on using the changeset viewer.