Changeset 61e362f for src/Parser


Ignore:
Timestamp:
Jan 23, 2024, 2:16:13 PM (6 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
master
Children:
71b5aad5
Parents:
a4ed165
Message:

Changed notZeroExpr so that expressions with conditional contexts are handled in the resolver instead of the parser. Bugs kept the same from being done with statements. (Also a bit of clean-up from the last commit and a small fix in code-gen.)

Location:
src/Parser
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/ExpressionNode.cc

    ra4ed165 r61e362f  
    673673                ast::LogicalFlag flag ) {
    674674        return new ast::LogicalExpr( location,
    675                 notZeroExpr( maybeMoveBuild( expr_node1 ) ),
    676                 notZeroExpr( maybeMoveBuild( expr_node2 ) ),
     675                maybeMoveBuild( expr_node1 ),
     676                maybeMoveBuild( expr_node2 ),
    677677                flag
    678678        );
     
    713713                ExpressionNode * expr_node3 ) {
    714714        return new ast::ConditionalExpr( location,
    715                 notZeroExpr( maybeMoveBuild( expr_node1 ) ),
     715                maybeMoveBuild( expr_node1 ),
    716716                maybeMoveBuild( expr_node2 ),
    717717                maybeMoveBuild( expr_node3 )
  • src/Parser/parserutility.cc

    ra4ed165 r61e362f  
    2727//    if ( (int)(x != 0) ) ...
    2828
    29 ast::Expr * notZeroExpr( ast::Expr * orig ) {
     29ast::Expr * notZeroExpr( const ast::Expr * orig ) {
    3030        return ( !orig ) ? nullptr : new ast::CastExpr( orig->location,
    3131                ast::UntypedExpr::createCall( orig->location,
  • src/Parser/parserutility.h

    ra4ed165 r61e362f  
    2121}
    2222
    23 ast::Expr * notZeroExpr( ast::Expr *orig );
     23ast::Expr * notZeroExpr( const ast::Expr *orig );
    2424
    2525template< typename T >
Note: See TracChangeset for help on using the changeset viewer.