Changeset e7f8119 for src/AST/Expr.hpp


Ignore:
Timestamp:
Jun 10, 2019, 10:52:03 AM (5 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
6355ba7
Parents:
9856ca9 (diff), 61c7239 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Expr.hpp

    r9856ca9 re7f8119  
    1717
    1818#include <cassert>
     19#include <deque>
    1920#include <map>
    2021#include <string>
     
    111112                }
    112113
    113                 const ResnSlots& resnSlotsConst() const {
     114                const ResnSlots& resnSlots() const {
    114115                        if (mode == Slots) {
    115116                                return data.resnSlots;
     
    128129                }
    129130
    130                 const InferredParams& inferParamsConst() const {
     131                const InferredParams& inferParams() const {
    131132                        if (mode == Params) {
    132133                                return data.inferParams;
     
    134135                        assert(!"Mode was not already Params");
    135136                        return *((InferredParams*)nullptr);
     137                }
     138
     139                /// splices other InferUnion into this one. Will fail if one union is in `Slots` mode
     140                /// and the other is in `Params`.
     141                void splice( InferUnion && o ) {
     142                        if ( o.mode == Empty ) return;
     143                        if ( mode == Empty ) { init_from( o ); return; }
     144                        assert( mode == o.mode && "attempt to splice incompatible InferUnion" );
     145
     146                        if ( mode == Slots ){
     147                                data.resnSlots.insert(
     148                                        data.resnSlots.end(), o.data.resnSlots.begin(), o.data.resnSlots.end() );
     149                        } else if ( mode == Params ) {
     150                                for ( const auto & p : o.data.inferParams ) {
     151                                        data.inferParams[p.first] = std::move(p.second);
     152                                }
     153                        } else assert(!"invalid mode");
    136154                }
    137155        };
     
    695713public:
    696714        ptr<Expr> expr;
    697         std::vector<InitAlternative> initAlts;
    698 
    699         UntypedInitExpr( const CodeLocation & loc, const Expr * e, std::vector<InitAlternative> && as )
     715        std::deque<InitAlternative> initAlts;
     716
     717        UntypedInitExpr( const CodeLocation & loc, const Expr * e, std::deque<InitAlternative> && as )
    700718        : Expr( loc ), expr( e ), initAlts( std::move(as) ) {}
    701719
Note: See TracChangeset for help on using the changeset viewer.