Changeset 46da46b for src/AST/Expr.hpp


Ignore:
Timestamp:
May 2, 2023, 3:44:31 AM (17 months ago)
Author:
Fangren Yu <f37yu@…>
Branches:
ast-experimental, master
Children:
0c840fc
Parents:
1ab773e0
Message:

current progress

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Expr.hpp

    r1ab773e0 r46da46b  
    5555                const Expr * e )
    5656        : decl( id ), declptr( declptr ), actualType( actual ), formalType( formal ), expr( e ) {}
     57
     58        operator bool() {return declptr;}
    5759};
    5860
     
    334336        GeneratedFlag isGenerated;
    335337
     338        enum CastKind {
     339                Default, // C
     340                Coerce, // reinterpret cast
     341                Return  // overload selection
     342        };
     343
     344        CastKind kind = Default;
     345
    336346        CastExpr( const CodeLocation & loc, const Expr * a, const Type * to,
    337                 GeneratedFlag g = GeneratedCast ) : Expr( loc, to ), arg( a ), isGenerated( g ) {}
     347                GeneratedFlag g = GeneratedCast, CastKind kind = Default ) : Expr( loc, to ), arg( a ), isGenerated( g ), kind( kind ) {}
    338348        /// Cast-to-void
    339         CastExpr( const CodeLocation & loc, const Expr * a, GeneratedFlag g = GeneratedCast );
     349        CastExpr( const CodeLocation & loc, const Expr * a, GeneratedFlag g = GeneratedCast, CastKind kind = Default );
    340350
    341351        /// Wrap a cast expression around an existing expression (always generated)
Note: See TracChangeset for help on using the changeset viewer.