Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Expr.hpp

    re67991f r99da267  
    3030
    3131// Must be included in *all* AST classes; should be #undef'd at the end of the file
    32 #define MUTATE_FRIEND template<typename node_t> friend node_t * mutate(const node_t * node);
     32#define MUTATE_FRIEND \
     33    template<typename node_t> friend node_t * mutate(const node_t * node); \
     34        template<typename node_t> friend node_t * shallowCopy(const node_t * node);
     35
    3336
    3437class ConverterOldToNew;
     
    4750
    4851        ParamEntry() : decl( 0 ), declptr( nullptr ), actualType( nullptr ), formalType( nullptr ), expr( nullptr ) {}
    49         ParamEntry(
    50                 UniqueId id, const Decl * declptr, const Type * actual, const Type * formal,
     52        ParamEntry( 
     53                UniqueId id, const Decl * declptr, const Type * actual, const Type * formal, 
    5154                const Expr * e )
    5255        : decl( id ), declptr( declptr ), actualType( actual ), formalType( formal ), expr( e ) {}
     
    112115                        case Empty: new(&data.resnSlots) ResnSlots{}; mode = Slots; // fallthrough
    113116                        case Slots: return data.resnSlots;
    114                         case Params: assertf(false, "Cannot return to resnSlots from Params"); abort();
     117                        case Params: assert(!"Cannot return to resnSlots from Params");
    115118                        }
    116                         assertf(false, "unreachable");
     119                        return *((ResnSlots*)nullptr);
    117120                }
    118121
     
    121124                                return data.resnSlots;
    122125                        }
    123                         assertf(false, "Mode was not already resnSlots");
    124                         abort();
     126                        assert(!"Mode was not already resnSlots");
     127                        return *((ResnSlots*)nullptr);
    125128                }
    126129
     
    131134                        case Params: return data.inferParams;
    132135                        }
    133                         assertf(false, "unreachable");
     136                        assert(!"unreachable");
     137                        return *((InferredParams*)nullptr);
    134138                }
    135139
     
    138142                                return data.inferParams;
    139143                        }
    140                         assertf(false, "Mode was not already Params");
    141                         abort();
     144                        assert(!"Mode was not already Params");
     145                        return *((InferredParams*)nullptr);
    142146                }
    143147
    144148                void set_inferParams( InferredParams && ps ) {
    145149                        switch(mode) {
    146                         case Slots:
     150                        case Slots: 
    147151                                data.resnSlots.~ResnSlots();
    148152                                // fallthrough
    149                         case Empty:
     153                        case Empty: 
    150154                                new(&data.inferParams) InferredParams{ std::move( ps ) };
    151155                                mode = Params;
     
    171175                                        data.inferParams[p.first] = std::move(p.second);
    172176                                }
    173                         } else assertf(false, "invalid mode");
     177                        } else assert(!"invalid mode");
    174178                }
    175179        };
     
    383387
    384388        ConstantExpr(
    385                 const CodeLocation & loc, const Type * ty, const std::string & r,
     389                const CodeLocation & loc, const Type * ty, const std::string & r, 
    386390                        std::optional<unsigned long long> i )
    387391        : Expr( loc, ty ), rep( r ), ival( i ) {}
     
    769773public:
    770774        ptr<Expr> expr;
    771         readonly<Decl> deleteStmt;
    772 
    773         DeletedExpr( const CodeLocation & loc, const Expr * e, const Decl * del )
     775        readonly<Node> deleteStmt;
     776
     777        DeletedExpr( const CodeLocation & loc, const Expr * e, const Node * del )
    774778        : Expr( loc, e->result ), expr( e ), deleteStmt( del ) { assert( expr->result ); }
    775779
Note: See TracChangeset for help on using the changeset viewer.